I’ve a problem with running ds18b20 temperature sensor on sensor module. I tried examples for the sensor (both single and multi channel). But never get the TWR_DS18B20_EVENT_UPDATE event, always the TWR_DS18B20_EVENT_ERROR event (same behavior as the sensor is completely disconnected). But the wiring is good - board revision 1.1 and black wire is second, red third and yellow fifth.
Can you help me how to debug the problem?
connection seems ok.
- Do you have DS18b20 sensor from us?
- Can you confirm with other device that the DS18b20 sensor work ok?
During the years we updated the 1-wire driver so it would work also with DS18b20 clones that do not follow exact ds18b20 standard.
What device do you have so we could start to troubleshoot?
- logic analyzer or oscilloscope
We can also try to debug it using logs. I would first look whether the sensor replies to RESET pulse with a PRESENCE pulse. Can you uncomment this line and copy the log output? If the retries is zero, then it timeouts here. You might also try to increase
retries = 4 to the bigger number.
thank you for response. After more investigation I’ve found out that there is no voltage between VDD and GND, so probably there is something wrong with the sensor module. My college has more modules, but he is out of office so we will try another one next week.
To get the lowest power consumption, we turn off the VCC power to the sensor when it is not used.
However, in the latest SDK, it seems that power is kept on all the time, and you can decide whether to turn it off between measurements. You control that with a
Is that function in your SDK? Otherwise, you need to update SDK. Are you using Platformio or
make to compile your project?
In platformio.ini, set this line directly to SDK Github and clear project/delete
libdeps folder in
If you use a makefile, call
make update to update to the latest SDK.
Thank you, it’s solved. I’m not sure what helped, but here are steps what I did:
- Changed lib_deps from twr-sdk to GitHub - hardwario/twr-sdk: HARDWARIO Firmware SDK (Software Development Kit) and add twr_ds18b20_set_power_dynamic(&ds18b20, false); - sensor started to work
- Changed twr_ds18b20_set_power_dynamic(&ds18b20, true); - sensor worked
- Comment line twr_ds18b20_set_power_dynamic(&ds18b20, true); - sensor worked
- Changed lib_deps from GitHub - hardwario/twr-sdk: HARDWARIO Firmware SDK (Software Development Kit) to twr-sdk - sensor worked
Probably some updates were performed in the background and it works now.
Thank you for your help.
Weird that it was broken. Then by going forth and back, it is fixed
I’m glad you got it working.