danjperron / BitBangingDS18B20

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

Stops working after several days #15

Closed sithmein closed 11 months ago

sithmein commented 3 years ago

Maybe not a bug in the code itself but I have no clue at the moment and maybe someone can help me tracking down the problem. I'm reading six DS18B20 sensors using this library with the standard 3 pin wiring including external 5k pullup resistor. Everything works flawlessly at the beginning. However after a few days errors while reading start to occur such as None being returned from read (in Python) or not all sensors being found by the scan routine any more. This gets worse and worse until at some point no sensors can be read any more. I did some measurements and once I'm at that stage the data pin is pulling down the signal (to ~1.8V) so that I don't have the 3.3V any more which explains why reading doesn't work any more. Then I switch to a different GPIO pin and the same story repeats itself: no issues in the first few days, then errors start to occur until nothing can be read any more. Not even a reboot fixes it. Any clues what might be the problem or how I can narrow it down? I have some basic C and Python experience so I can experiment myself a bit but I would need some pointers first.

danjperron commented 3 years ago

Please what is your type of cable, The length of your cable, distance between each sensors.

What is the pull up resistor value.

"the data pin is pulling down the signal (to ~1.8V) so that I don't have the 3.3V any more"

This make no sense! If you pull down than it is near 0V. so 3.3V can't be! When this appends pull the wire on the GPIO out and check if you get 3.3V on the wire. The pull up needs to be on the wire.

Do you have another application which could change GPIO pin settings!

Le 23 mars 2021 à 16:18, sithmein @.***> a écrit :

the data pin is pulling down the signal (to ~1.8V) so that I don't have the 3.3V any more

sithmein commented 3 years ago

Thanks for the quick reply. My sensors are connected in star layout (I know, not ideal) with cable length between 50cm and 2m (hence a bus isn't really feasible). The pull-up resistor is 5k (2x10k in parallel). As I said the behaviour is really strange. Initially the data pin gets correctly pulled up to 3.3V but over time the voltage drops as if the data pin starts pulling it down - even with no sensors connected at all! When no data can be read any more I am only measuring 1.8V between DATA and GND (still 3.3V between VDD and GND). It looks like the data pin is slowly going bad. I can almost certainly rule out another application fiddling with the data pin.

danjperron commented 3 years ago

Use another Pin just in case.

Star with 2m maximum length is not an issue.
Could you post a picture into the raspberry pi forum?

I used this system in star mode on my pond for two years without any problem. It was to heat the pond for winter . Never had problem with it even if the temp hit at some occasions -30C.

Reading voltage sometimes doesn't give the full feature. You need to use an oscilloscope to see the signal. I think that it could be more than one application ,or the same in multi-thread, that concurrently use the GPIO. A scope is a most.

Le 25 mars 2021 à 16:49, sithmein @.***> a écrit :

Thanks for the quick reply. My sensors are connected in star layout (I know, not ideal) with cable length between 50cm and 2m (hence a bus isn't really feasible). The pull-up resistor is 5k (2x10k in parallel). As I said the behaviour is really strange. Initially the data pin gets correctly pulled up to 3.3V but over time the voltage drops as if the data pin starts pulling it down - even with no sensors connected at all! When no data can be read any more I am only measuring 1.8V between DATA and GND (still 3.3V between VDD and GND). It looks like the data pin is slowly going bad. I can almost certainly rule out another application fiddling with the data pin.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/danjperron/BitBangingDS18B20/issues/15#issuecomment-807460919, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBF7XBK6E5NN7QDMCGFNL3TFOOWDANCNFSM4ZV4YJ4A.

danjperron commented 11 months ago

Added Pi5 close old open issues