Page 1 of 1

DS18B20 on STM32F103C8

Posted: Wed Dec 23, 2020 8:24 pm
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.

Re: DS18B20 on STM32F103C8

Posted: Thu Dec 24, 2020 6:51 am
by fpiSTM
Hi, which core you used? I guess you used libmaple core ?

Re: DS18B20 on STM32F103C8

Posted: Thu Dec 24, 2020 7:31 am
by stevestrong
Which board have you selected in Arduino IDE?

Re: DS18B20 on STM32F103C8

Posted: Thu Dec 24, 2020 12:08 pm
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.

Re: DS18B20 on STM32F103C8

Posted: Thu Dec 24, 2020 2:43 pm
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

Re: DS18B20 on STM32F103C8

Posted: Sun Dec 27, 2020 4:07 pm
by Grzegorz70
IT WORKS!!!! Grrreeeeaaattt!!!
Thank You very much!!!!

Re: DS18B20 on STM32F103C8

Posted: Thu Jan 07, 2021 3:30 am
by dinihuygens
can we use this OneWireSTM library if our core is Arduino_STM32 core (not the rogerclark one)?

Re: DS18B20 on STM32F103C8

Posted: Thu Jan 07, 2021 5:43 am
by fpiSTM
Fot STM32 core use the standard OneWire library.

Re: DS18B20 on STM32F103C8

Posted: Sun Mar 28, 2021 9:18 am
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/