Posts: 12
Joined: Fri Aug 12, 2016 1:15 pm

Reset 1-wire Bus - DS18B20

Fri Oct 28, 2016 1:22 pm

I have a Pi3 application built in NODE JS which samples readings from 4 DS18B20 temperature sensors.

The sensors are connected using all three wires Data, Supply & Ground. I use a single 4.7k resistor to 'pull up' the data line to the 3.3V power line used to power the devices. Initially I used a permanent 3.3V pin on the Pi GPIO header to power the arrangement.

Sometimes I find that the sensors disappear and my application fails to log their temperatures. Restarting my NODEJS app or soft rebooting the Pi does not fix the problem. Only a power off restart of the Pi allows the sensors to the found once again.

So instead, I am now using a GPIO pin (3.3V) as the source of power for the four sensors. When my application detects the sensors have vanished I switch OFF the GPIO pin to power down the sensors for 20 seconds and then switch the GPIO pin back on. The sensors re-appear. A GPIO pin can supply enough current at 3.3V to power my four sensors.

So this mechanism seems to reset the 'hardware' side of the 1-wire bus and allows my sensors to be found once again.

I have not been able to figure out why the sensors vanish, but at least I can now recover gracefully from the problem under the control of my NODEJS app and without requiring a power off reboot of the Pi.

Hope you find this tip useful.

Posts: 6
Joined: Fri Aug 26, 2016 4:45 pm

Re: Reset 1-wire Bus - DS18B20

Wed Nov 23, 2016 5:18 pm

Thanks for the post. I am running into the same problem and find your solution really interesting. Right now I have mine set up to reboot when it detects it can no longer ‘see’ a sensor as a temporary solution. I am considering using your solution, but it will require some mods to my setup (my sensors are soldered to a proto hat) so I want to be sure there are no programming solutions first. Have you received any feedback or learned anything more about this?

FYI my device manages the irrigation and heating of my greenhouse protecting some valuable (at least to me) Bonsai and other plants, so I need this to be as reliable as possible.

Posts: 1
Joined: Thu Jan 12, 2017 10:57 am

Re: Reset 1-wire Bus - DS18B20

Thu Jan 12, 2017 11:00 am

Hi all,

I know this post is quite old but however I have exactly the same issues and the only "solution" for me is as well switch off the power for the W1 bus to reset and after a couple of seconds the bus is again online and sensors are available till next outtage.

Would be great if the problem could be identified.

Posts: 38
Joined: Tue Aug 28, 2012 5:52 pm

Re: Reset 1-wire Bus - DS18B20

Wed Feb 15, 2017 4:58 pm

I'm having the same issue with Cayenne IOT.
Randomly my one-wire temp sensors seem to go offline.
Every temp reads 32 degs F.

The only way to get them back is to power down the RPI2.

They worked fine for months so i'm lost on what the issue is.

Posts: 1
Joined: Tue Dec 12, 2017 4:42 am

Re: Reset 1-wire Bus - DS18B20

Tue Dec 12, 2017 4:45 am

I am having the same issue. So it seems like sensors gets out of sync. Because if you look at /sys/bus/w1/devices/ you can still see the exact number of sensors active it's just their ID's are messed and and obviously the data they are sending.

Don't know how to fix. And for me it started to happen like every few minutes... very annoying.

Return to “Other languages”

Who is online

Users browsing this forum: No registered users and 3 guests