DS18B20 on STM32F103C8

What are you developing?
Post Reply
Grzegorz70
Posts: 6
Joined: Wed Dec 23, 2020 8:01 pm

DS18B20 on STM32F103C8

Post by Grzegorz70 »

Hi All,

I'm building a project of motorcycle computer like device. It displays some important informations for bikers. It works on Arduino Nano but Nano was too slow. Now I'm trying to port it to stm32. Almost all works fine but I have a problem with OneWire library. I would like to use DS18B20 temperature sensor but it require OneWire library. Unfortunatelly it doesn't work with my STM32F103. During compilation it returns error that it can't be compiled for this type of board. I saw OneWireSTM library in Arduino IDE but how to use it instead classic OneWire? Should I change definition in DS18B20.h file from onewire.h na onewirestm.h? What about declaration or initialization? Should I use onewirestm.begin (); or other? Or maybe there is a modified version of classical library. Did someone has the same problem? Could you please help me withthat?

Best regards and Merry Christmass,
Greg.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: DS18B20 on STM32F103C8

Post by fpiSTM »

Hi, which core you used? I guess you used libmaple core ?
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: DS18B20 on STM32F103C8

Post by stevestrong »

Which board have you selected in Arduino IDE?
Grzegorz70
Posts: 6
Joined: Wed Dec 23, 2020 8:01 pm

Re: DS18B20 on STM32F103C8

Post by Grzegorz70 »

Hi,
I use STM32F103C8 "black pill" board with 64k memory. In board manager I've selected STM32F1xx/GD32F1xx boards ver. 2020.12.17 by stmduino and use Generic STM32F103C series with ST-Link programmer. My program works well without OneWire.h and DS18B20 libraries and commented all lines which use these libraries but if I uncomment them and libraries, I receive error.
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: DS18B20 on STM32F103C8

Post by stevestrong »

You should use in your sketch

Code: Select all

#include OneWireSTM.h
as shown by this example: https://github.com/rogerclarkmelbourne/ ... rature.ino
Grzegorz70
Posts: 6
Joined: Wed Dec 23, 2020 8:01 pm

Re: DS18B20 on STM32F103C8

Post by Grzegorz70 »

IT WORKS!!!! Grrreeeeaaattt!!!
Thank You very much!!!!
dinihuygens
Posts: 13
Joined: Thu Dec 17, 2020 9:20 am
Answers: 1

Re: DS18B20 on STM32F103C8

Post by dinihuygens »

can we use this OneWireSTM library if our core is Arduino_STM32 core (not the rogerclark one)?
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: DS18B20 on STM32F103C8

Post by fpiSTM »

Fot STM32 core use the standard OneWire library.
Araqel
Posts: 1
Joined: Tue Mar 24, 2020 3:26 pm

Re: DS18B20 on STM32F103C8

Post by Araqel »

stevestrong wrote: Thu Dec 24, 2020 2:43 pm You should use in your sketch

Code: Select all

#include OneWireSTM.h
as shown by this example: https://github.com/rogerclarkmelbourne/ ... rature.ino
Thanks a much!

I would like to share also a library free code, available here: https://how2electronics.com/interfacing ... ith-stm32/
Post Reply

Return to “Projects”