Posts: 7
Joined: Wed Apr 29, 2020 8:17 am

Problem with Raspberry Pi

Sat May 15, 2021 10:24 am

Hi, I have 4x raspberry Pi's 3a-3b+ working as temperature reporters in the barn.
They have a bus connected with 8x ds18b20 sensors
Every ten minutes it reads sensor data.
Connection is made via 1 wire protocol so it reads a certain file from /sys/bus/w1/devices/(deviceid) folders. Physical connection is 3 wires: to the bus: ground, voltage (3 or 5 volt) and data (gpio4)

Everything works fine, but like once in two weeks I get an error because N (random) amount of sensors out of 8 is not reporting. Raspberry loses some sensors, for example sensors 3,5,6 or 4-8 or 1,7.
That happens to every pi and to fix it, I have to physically reboot device. I unplug it, the plug it in. "sudo reboot now" does not help.

What can be wrong here? Is it related to electricity quality in the barn i.e. I need to filter that does not allow electricity jumps?
Don't want to manually reboot it every time please help!
topology.png (5.82 KiB) Viewed 360 times

User avatar
Posts: 1738
Joined: Fri Aug 10, 2012 12:38 pm
Location: Cumbria, UK

Re: Problem with Raspberry Pi

Sat May 15, 2021 10:57 am

How long are your cables? Are you using shielded cables?

Posts: 1964
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Problem with Raspberry Pi

Sat May 15, 2021 2:53 pm

Some general remarks on reliability are in

Posts: 237
Joined: Fri Jul 06, 2018 2:13 am
Location: USA

Re: Problem with Raspberry Pi

Wed May 19, 2021 11:07 pm

How long are the "stubs" between the temp sensors and the bus? They need to be as short as possible (less than a meter - 30cm or less would be better).

What is the voltage being applied to the sensors? 5V? Because the output configuration of the DS sensors is open-drain, you can safely wire 5V to the Vcc pin of the sensor, so long as the pullup resistor is connected to 3.3V and not worry about too high of a voltage on the GPIO pin, as the sensor output high voltage level is dictated by where the pullup resistor is connected (3.3V). This is the preferred way to wire these sensors when using the pullup & GPIO pin method (versus a 1 wire driver chip).

Be mindful of the amount of capacitance on the data line. This line should not be twisted with any other wires, unless that other wire is also being used for that same data (both wires connected in parallel).

Consider adding a small capacitor at the end sensor between Vdd and GND (this is what I did). 1uF or so should be fine.

Return to “Automation, sensing and robotics”