Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DS18B20 Issue #1393

Open
mfittipaldi90 opened this issue Aug 24, 2024 · 27 comments
Open

DS18B20 Issue #1393

mfittipaldi90 opened this issue Aug 24, 2024 · 27 comments

Comments

@mfittipaldi90
Copy link

mfittipaldi90 commented Aug 24, 2024

Describe the problem/bug

DS18B20 Temperature sensor stopped working overnight and got stuck at 0C. Config page for w1thermsensor shows two "00-00000000." device ID
Tried a config page for OW-Shell and device ID shows 2 different unique IDs

The input with ow-shell library provides erratic measurements ranging from 0C to 96C jumping all around.

I bought a new sensor (both from adafruit) and same behavior happens with brand new sensor. Sensors are installed with 4.7k pullup resistor between signal and VCC.

Versions:

  • Mycodo Version: 8.15.13
  • Raspberry Pi Version: 4b
  • Raspbian OS Version: [e.g. Buster Lite]

Screenshots

image
image

Additional context

Logs show:
2024-08-23 23:40:33,446 - ERROR - mycodo.inputs.ds18s20_f2982e8f - Error 101: Device not set up. See https://kizniche.github.io/Mycodo/Error-Codes#error-101 for more info.
2024-08-23 23:40:36,663 - ERROR - mycodo.inputs.ds18s20_f2982e8f - Initialization errored 3 times; giving up. Maybe the following traceback can help diagnose the issue.
Traceback (most recent call last):
File "/var/mycodo-root/mycodo/abstract_base_controller.py", line 57, in try_initialize
self.initialize()
File "/home/mfittipaldi/Mycodo/mycodo/inputs/ds18s20.py", line 98, in initialize
self.sensor = W1ThermSensor(
^^^^^^^^^^^^^^
File "/var/mycodo-root/env/lib/python3.11/site-packages/w1thermsensor/core.py", line 154, in init
raise NoSensorFoundError(
w1thermsensor.errors.NoSensorFoundError:
Could not find sensor of type DS18S20 with id 2e0000000000
Please check cabling and check your /boot/config.txt for
dtoverlay=w1-gpio
2024-08-23 23:40:36,664 - DEBUG - mycodo.controllers.controller_input_f2982e8f - get_measurement() found
2024-08-23 23:40:36,665 - DEBUG - mycodo.controllers.controller_input_f2982e8f - listener() not found
2024-08-23 23:40:36,665 - INFO - mycodo.controllers.controller_input_f2982e8f - Activated in 10172.7 ms
2024-08-23 23:40:36,665 - ERROR - mycodo.inputs.ds18s20_f2982e8f - Error 101: Device not set up. See https://kizniche.github.io/Mycodo/Error-Codes#error-101 for more info.
2024-08-23 23:40:41,669 - ERROR - mycodo.inputs.ds18s20_f2982e8f - Error 101: Device not set up. See https://kizniche.github.io/Mycodo/Error-Codes#error-101 for more info.
2024-08-23 23:40:48,471 - ERROR - mycodo.inputs.ds18s20_f2982e8f - Error 101: Device not set up. See https://kizniche.github.io/Mycodo/Error-Codes#error-101 for more info.
2024-08-23 23:40:56,683 - ERROR - mycodo.inputs.ds18s20_f2982e8f - Error 101: Device not set up. See https://kizniche.github.io/Mycodo/Error-Codes#error-101 for more info.
2024-08-23 23:40:56,683 - ERROR - mycodo.controllers.controller_input_f2982e8f - StopIteration raised 3 times. Possibly could not read input. Ensure it's connected properly and detected.
2024-08-23 23:41:03,487 - ERROR - mycodo.inputs.ds18s20_f2982e8f - Error 101: Device not set up. See https://kizniche.github.io/Mycodo/Error-Codes#error-101 for more info.
2024-08-23 23:41:03,487 - ERROR - mycodo.controllers.controller_input_f2982e8f - StopIteration raised 3 times. Possibly could not read input. Ensure it's connected properly and detected.

@kizniche
Copy link
Owner

Please describe the details of your wiring.

@mfittipaldi90
Copy link
Author

Sorry for the bad picture and diagram. This setup was working very well for the past weeks and just stopped working overnight.
Wiring

@kizniche
Copy link
Owner

What is the length of wire? Have you tried 5 VDC?

@kizniche
Copy link
Owner

Have you verified the resistance of the resistor?

@mfittipaldi90
Copy link
Author

Yes, tried the 5 VDC and still same behavior
Length of the wire is the length that came with the sensor itself plus the jumper wire that was soldered in.
Tried two different resistors that are 4.7k ea (both verified with multimeter).
Just tried reflashing my rpi and installing a fresh new mycodo and still not working... now I have to reconfigure it all again :)

@kizniche
Copy link
Owner

Have you tried one sensor at a time?

@mfittipaldi90
Copy link
Author

Yes, right now I have only one DS18B20 connected and still same behavior. Even swapping DS18B20 and behavior is the exact same. Keep getting phantom IDs and no data reads

@kizniche
Copy link
Owner

You've enabled 1wire after reinstalling?

@mfittipaldi90
Copy link
Author

mfittipaldi90 commented Aug 24, 2024

yes, it is enabled. Config file shows that. Also tried rebooting a few times

@kizniche
Copy link
Owner

Sounds like damaged hardware. Have you tried other software and hardware to communicate with the sensors?

@mfittipaldi90
Copy link
Author

mfittipaldi90 commented Aug 24, 2024 via email

@kizniche
Copy link
Owner

I would try assigning 1wire to another pin besides 4 and testing. Do you have an arduino-compatible microcontroller?

@kizniche
Copy link
Owner

And by try other software, there are many available to communicate with 1wire sensors, the ds18b20 in particular, since it's probably the most populate 1wire sensor in existence.

@kizniche
Copy link
Owner

There's also the possibility you have counterfeit sensors (very common). Did you buy from a reputable vendor?

@mfittipaldi90
Copy link
Author

mfittipaldi90 commented Aug 26, 2024 via email

@wbard93
Copy link

wbard93 commented Aug 27, 2024

I've had various problems with the DS18B20 stopping to work on the RPi. Usually it works for a while and the just stops. At least once it started working again when I disabled the input in Mycodo and re-enabled it but usually it starts working when I reboot the RPi. I remember one instance where using RPi routine independent of Mycodo I was able to read the temp and recovered it by reimaging the SD and reloading Mycodo.

I think one time that it stopped working, the RPi was bad. I've also had broken connections that have caused it to stop working.

I suspect at least part of the problem is a bug in the RPI DS18B20 library I'm using. In my view, it's not very reliable and is likely a result of the multi tasking RPi trying to talk using a bit-bang serial interface. My thought for the future is to not use the RPi to read it and use an Arduino connected to the RPi through some interface.

@kizniche
Copy link
Owner

I have several Pis reading ds18b20 in production systems that have run without issue for years. There's likely something about the setup of your systems that cause them to fail.

@mfittipaldi90
Copy link
Author

mfittipaldi90 commented Aug 27, 2024 via email

@mfittipaldi90
Copy link
Author

After a few days of without any issues, I had this behavior overnight. For 3 hours the temp sensor was gone and the EC/PH measurements were erratic/noisy. Even after the temperature sensor coming back online by itself, the measurements were fairly jumpy. At around 8:40 AM I performed a reboot of the raspberry pi and the measurements stabilized again. Not sure what could be causing this issue? Maybe a surge or drop in the wall outlet? I am running the 15 W Raspberry Pi power supply, and measure ~7 W usage with a power meter.

image

@kizniche
Copy link
Owner

Is the power to the water sensors isolated?

@mfittipaldi90
Copy link
Author

The power to the sensor is coming from the 3.3v or 5v pin of the raspberry pi. Do you recommend using a separate power source for it?

@kizniche
Copy link
Owner

There are almost always some type of electrical issue when you use pH and EC sensors without isolated power sources. It would certainly be something I would test.

@mfittipaldi90
Copy link
Author

For the pH and EC sensors, I am using an analog signal isolator in between them and the raspberry pi. Not sure if there is anything like that for the 1-wire. I could try to get an isolated external power supply for them

@kizniche
Copy link
Owner

Your DS sensor is submerged?

@mfittipaldi90
Copy link
Author

Yes it is. Same reservoir as the pH and EC

@kizniche
Copy link
Owner

Do any erratic measurements cease when you remove any sensor or combination of sensors from the fluid?

@mfittipaldi90
Copy link
Author

I saw that when the pH and EC sensors were together in the same res without the galvanic isolator circuits. Once I added those modules in, it was smooth. The overall behavior is stable and smooth overall. Not sure if it was a surge or spike in the outlet that friend the 1-wire on the RPI and that temporary loss on the second. I did add a surge protector to the outlet just in case...
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants