danjperron / BitBangingDS18B20

Method to access the DS18B20 sensor using Rapsberry Pi GPIO
41 stars 29 forks source link

Issues reading multiple 5m cable DS18B20 sensors #13

Closed Ralphie089 closed 4 years ago

Ralphie089 commented 4 years ago

Hi Dan,

I tested your read10.py script on a Raspberry Pi 3 with six DS18B20 (each 1 m cable). This works flawlessly. However, when I connect DS18B20 sensors with 5 m cable each, I can only read up to three sensors. If I connect four or more sensors, the script detects 0 sensors. Note that I am able to find all (3+) sensors in the ls /sys/bus/w1/devices/w1_slave/ folder. I can also read all of them individually using the Adafruit code, I'm just not able to read 3+ sensors with 5 m cables simultaneously anymore using your script.

Any idea what's causing my issue and how to solve it? I'm running the DS18B20s in normal power mode (no parasitic).

Best wishes, Ralf

danjperron commented 4 years ago

Hi Ralf,

     it depends of the kind of cable you are using.   Each cable adds capacitance  on the system this is why star configuration is very bad. 

Wire gauge is also a problem. You could try to add a 0.1µF capacitor between the GND and power on each DS18B20.

If it is a capacitance problem, you could try to reduce the resistor to 3k3 instead of 4k7.

Only one resistor at the end of the bus. Star mode are very bad ! Use a single bus with all the DS18B20 connect to the same line.

if it doesn't work you could try to use one GPIO per sensor and see if it is better. The code could handle multiple GPIOs.

Best regards,

Daniel Perron

Le 19 sept. 2020 à 13:02, Ralphie089 notifications@github.com a écrit :

Hi Dan,

I tested your read10.py script on a Raspberry Pi 3 with six DS18B20 (each 1 m cable). This works flawlessly. However, when I connect DS18B20 sensors with 5 m cable each, I can only read up to three sensors. If I connect four or more sensors, the script detects 0 sensors. Note that I am able to find all (3+) sensors in the ls /sys/bus/w1/devices/w1_slave/ folder. I can also read all of them individually using the Adafruit code https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/Raspberry_Pi_DS18B20_Temperature_Sensing/thermometer.py, I'm just not able to read 3+ sensors with 5 m cables simultaneously anymore using your script.

Any idea what's causing my issue and how to solve it? I'm running the DS18B20s in normal power mode (no parasitic).

Best wishes, Ralf

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/danjperron/BitBangingDS18B20/issues/13, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBF7XFBD2GRIMCWVBUK5I3SGTP4BANCNFSM4RTD3JGQ.

danjperron commented 4 years ago

if it is a problem with the capacitance you could try to increase the delay variable MICROSECONDA in/python/DS18B20.c. Don't forget to re-install the code each time you modify the variable. " sudo python3 setup.py install" Try 4 or 5.

Ralphie089 commented 4 years ago

Hi Dan,

Thanks for the very fast reply! Increasing the delay variable did the trick! With a value of 8 I am able to read all 14 DS18B20s (each with 5 m cable) simultaneously without issues :-)

Best wishes, Ralf