Rikkert-RS / VenusOS-TemperatureService

Temperature and Humidity d-bus services for Victron GX
BSD 3-Clause "New" or "Revised" License
19 stars 8 forks source link

The DS18B20 sensors disconnects after some time. #11

Open mcfrojd opened 1 year ago

mcfrojd commented 1 year ago

I am running a Raspberry Pi 3b+ with the latest release candidate v3.20~4. Screenshot MCRYZEN 2023-09-26 17_5148

( I have the same problem on my production system, a pi 4 with v3.01 ) VenusOS-TemperatureService version 0.5 Using two DS18B20 temperature sensors with a 4.7kohm resistor.

I have no trubbel setting them up and using them for a couple of days. But after some time the two DS18B20 temperature sensors will end up disconnected.

And this is the only thing i find in the logs at /data/log/VenusOS-TemperatureService/current

@40000000650cb9a5242d8efc INFO:root:1Wire Sensor found with no Service -> Create:
@40000000650cb9a5281d572c INFO:root:registered ourselves on D-Bus as com.victronenergy.temperature.Wire_id03
@40000000650cb9a52944cfcc INFO:root:Add setting /Settings/Temperature/3de104572da1/TemperatureType [0, 0, 3]
@40000000650cb9a52958d8b4 INFO:root:Add setting /Settings/Temperature/3de104572da1/CustomName ['', 0, 0]
@40000000650cb9a539272c14 INFO:root:Retreived setting /Settings/Temperature/1/TemperatureType /TemperatureType 2
@40000000650cb9a539324fa4 INFO:root:Retreived setting /Settings/Temperature/1/CustomName /CustomName CPU
@40000000650cb9a5393ce694 INFO:root:Retreived setting /Settings/Temperature/3de1045750fa/TemperatureType /TemperatureType 2
@40000000650cb9a539510ad4 INFO:root:Retreived setting /Settings/Temperature/3de1045750fa/CustomName /CustomName Probe1
@40000000650cb9a539512a14 INFO:root:Retreived setting /Settings/Temperature/3de104572da1/TemperatureType /TemperatureType 2
@40000000650cb9a5396788a4 INFO:root:Retreived setting /Settings/Temperature/3de104572da1/CustomName /CustomName Probe2
@40000000650cb9a5397d6e1c INFO:root:Created Service 1Wire ID: 3 Settings ID:3
@40000000650cb9c004b3ae94 INFO:root:W1-temp:28-3de1045750fa temperature interface connected
@40000000650cb9c0053d29e4 INFO:root:W1-temp:28-3de104572da1 temperature interface connected
@40000000650cb9c00580e5bc INFO:root:Connected to dbus, and switching over to GLib.MainLoop() (= event based)
@400000006512b44d223a90cc INFO:root:W1-temp:28-3de1045750fa temperature interface disconnected
@400000006512b4551efcea2c INFO:root:W1-temp:28-3de104572da1 temperature interface disconnected

Screenshot MCRYZEN 2023-09-26 17_4955

The CPU temperature keeps connected.

Is there any way to find out why they get disconnected? A reboot wount make them come back to life, instead they disappear.

Running setup with option "i" wount make them come back to life. But if i disconnect the 3.3v pin and connect it again they will come back.

This is in the log after a reboot, running setup with the option "i" and the disconnect and reconnect the 3.3v pin

@400000006512b44d223a90cc INFO:root:W1-temp:28-3de1045750fa temperature interface disconnected
@400000006512b4551efcea2c INFO:root:W1-temp:28-3de104572da1 temperature interface disconnected
@40000000651300573421aa3c *** CCGX booted (0) ***
@400000006513005b1633960c INFO:root:/data/VenusOS-TemperatureService/dbus-i2c.py is starting up - python 3
@400000006513005b1715725c INFO:root:Loglevel set to INFO
@400000006513005b198e4a2c INFO:root:registered ourselves on D-Bus as com.victronenergy.temperature.RPi_cpu_id01
@400000006513005b198e713c INFO:root:Add setting /Settings/Temperature/1/TemperatureType [0, 0, 3]
@400000006513005b198e84c4 INFO:root:Add setting /Settings/Temperature/1/CustomName ['', 0, 0]
@400000006513005b22437624 Traceback (most recent call last):
@400000006513005b22439564   File "/data/VenusOS-TemperatureService/dbus-i2c.py", line 403, in <module>
@400000006513005b2243a8ec     initSettings(newSettings)
@400000006513005b2243b0bc   File "/data/VenusOS-TemperatureService/dbus-i2c.py", line 263, in initSettings
@400000006513005b2243c444     settings = SettingsDevice(
@400000006513005b2243d7cc   File "/opt/victronenergy/dbus-modem/settingsdevice.py", line 51, in __init__
@400000006513005b2243f70c     raise Exception("The settings service com.victronenergy.settings does not exist!")
@400000006513005b2245cfb4 Exception: The settings service com.victronenergy.settings does not exist!
@400000006513005d19863f94 INFO:root:/data/VenusOS-TemperatureService/dbus-i2c.py is starting up - python 3
@400000006513005d1991305c INFO:root:Loglevel set to INFO
@400000006513005d1a1062dc INFO:root:registered ourselves on D-Bus as com.victronenergy.temperature.RPi_cpu_id01
@400000006513005d1a46b134 INFO:root:Add setting /Settings/Temperature/1/TemperatureType [0, 0, 3]
@400000006513005d1a51d8ac INFO:root:Add setting /Settings/Temperature/1/CustomName ['', 0, 0]
@400000006513005e30d895d4 INFO:root:Retreived setting /Settings/Temperature/1/TemperatureType /TemperatureType 2
@400000006513005e30ef65ac INFO:root:Retreived setting /Settings/Temperature/1/CustomName /CustomName CPU
@400000006513005e310533b4 INFO:root:cpu temperature interface connected
@400000006513005e315d3adc INFO:root:Connected to dbus, and switching over to GLib.MainLoop() (= event based)
@40000000651300c503555ee4 VenusOS-TemperatureService/setup: --- starting setup script v0.5
@40000000651300cb2ac57c5c VenusOS-TemperatureService/setup: ++ Installing VenusOS Temperature Service
@40000000651300cb2d0fd1ec VenusOS-TemperatureService/setup: restarting VenusOS-TemperatureService service
@40000000651300cb3159915c VenusOS-TemperatureService/setup: restarting VenusOS-TemperatureService logger
@40000000651300cb391405bc VenusOS-TemperatureService/setup: completed
@40000000651300cc2a8e5344 INFO:root:/data/VenusOS-TemperatureService/dbus-i2c.py is starting up - python 3
@40000000651300cc2a94891c INFO:root:Loglevel set to INFO
@40000000651300cc2bb14b8c INFO:root:registered ourselves on D-Bus as com.victronenergy.temperature.RPi_cpu_id01
@40000000651300cc2be6172c INFO:root:Add setting /Settings/Temperature/1/TemperatureType [0, 0, 3]
@40000000651300cc2bef4e8c INFO:root:Add setting /Settings/Temperature/1/CustomName ['', 0, 0]
@40000000651300cc2f869294 INFO:root:Retreived setting /Settings/Temperature/1/TemperatureType /TemperatureType 2
@40000000651300cc2f96bf34 INFO:root:Retreived setting /Settings/Temperature/1/CustomName /CustomName CPU
@40000000651300cc2fa7d24c INFO:root:cpu temperature interface connected
@40000000651300cc2ffde574 INFO:root:Connected to dbus, and switching over to GLib.MainLoop() (= event based)
@40000000651300fe310431e4 INFO:root:1Wire Sensor found with no Service -> Create:
@40000000651300fe31b7c2a4 INFO:root:registered ourselves on D-Bus as com.victronenergy.temperature.Wire_id02
@40000000651300fe31fa7cac INFO:root:Add setting /Settings/Temperature/3de1045750fa/TemperatureType [0, 0, 3]
@40000000651300fe323eb584 INFO:root:Add setting /Settings/Temperature/3de1045750fa/CustomName ['', 0, 0]
@40000000651300fe35fa3eb4 INFO:root:Retreived setting /Settings/Temperature/1/TemperatureType /TemperatureType 2
@40000000651300fe35fe8474 INFO:root:Retreived setting /Settings/Temperature/1/CustomName /CustomName CPU
@40000000651300fe3608c95c INFO:root:Retreived setting /Settings/Temperature/3de1045750fa/TemperatureType /TemperatureType 2
@40000000651300fe361bad4c INFO:root:Retreived setting /Settings/Temperature/3de1045750fa/CustomName /CustomName Probe1
@40000000651300fe364691c4 INFO:root:Created Service 1Wire ID: 2 Settings ID:2
@40000000651300ff311817a4 INFO:root:1Wire Sensor found with no Service -> Create:
@40000000651300ff31c0908c INFO:root:registered ourselves on D-Bus as com.victronenergy.temperature.Wire_id03
@40000000651300ff323562cc INFO:root:Add setting /Settings/Temperature/3de104572da1/TemperatureType [0, 0, 3]
@40000000651300ff323fab9c INFO:root:Add setting /Settings/Temperature/3de104572da1/CustomName ['', 0, 0]
@40000000651300ff37638ae4 INFO:root:Retreived setting /Settings/Temperature/1/TemperatureType /TemperatureType 2
@40000000651300ff376c492c INFO:root:Retreived setting /Settings/Temperature/1/CustomName /CustomName CPU
@40000000651300ff377526b4 INFO:root:Retreived setting /Settings/Temperature/3de1045750fa/TemperatureType /TemperatureType 2
@40000000651300ff377d873c INFO:root:Retreived setting /Settings/Temperature/3de1045750fa/CustomName /CustomName Probe1
@40000000651300ff3785f764 INFO:root:Retreived setting /Settings/Temperature/3de104572da1/TemperatureType /TemperatureType 2
@40000000651300ff37d27d3c INFO:root:Retreived setting /Settings/Temperature/3de104572da1/CustomName /CustomName Probe2
@40000000651300ff381d16e4 INFO:root:Created Service 1Wire ID: 3 Settings ID:3
@40000000651301002e740184 INFO:root:W1-temp:28-3de1045750fa temperature interface connected
@40000000651301002ecb261c INFO:root:W1-temp:28-3de104572da1 temperature interface connected
MM0RBZ commented 7 months ago

Thanks Sarah. :-) I think you maybe got lucky and a good batch of sensors was used to make your 5m ones. Would you mind posting their serial numbers please?

Sarah-1331 commented 7 months ago

Am unsure the SN but think it would be one of these numbers ???

TemperatureType /TemperatureType 1 @4000000065b843c429dc25fc INFO:root:Retreived setting /Settings/Temperature/022010ed82ae/CustomName /CustomName Fridge @4000000065b843c429e5cabc INFO:root:Retreived setting /Settings/Temperature/485e4c1f64ff/TemperatureType /TemperatureType 2 @4000000065b843c429edecc4 INFO:root:Retreived setting /Settings/Temperature/485e4c1f64ff/CustomName /CustomName External @4000000065b843c429f6e5a4 INFO:root:Retreived setting /Settings/Temperature/53754c1f64ff/TemperatureType /TemperatureType 2 @4000000065b843c42a0c658c INFO:root:Retreived setting /Settings/Temperature/53754c1f64ff/CustomName /CustomName Internal

MM0RBZ commented 7 months ago

Thanks Sarah. it looks like your serial numbers are 28-022010ed82ae, 28-485e4c1f64ff and 28-53754c1f64ff.

MM0RBZ commented 7 months ago

With reference to this- https://github.com/cpetrich/counterfeit_DS18B20 I think I have family B clones which have a wide swing of temperature conversion times that may result in a time greater than Maxim spec. I suspect that on occasion this exceeds the time the driver expects and this causes the crash. It could also cause a timing clash between sensors so the more sensors you have the higher the chance of timing issues. This is speculation on my part, not gospel, but would explain why the sensors can be fine for hours before they drop out. If your kernel and your clone will let you change the sensor resolution (mine doesn't) then a lower resolution should reduce the response time but without access to the raspberry pi kernel module I can't prove or improve this so my solution would be to use genuine Maxim chips and waterproof them yourself if needed. On the other hand you might get lucky and find clone sensors with low response times. Caveat emptor.

P.S. I've just found another suggestion that might help. it has pro's and con's though. once your system has found the connected sensors, run this in terminal- echo 0 > /sys/bus/w1/devices/w1_bus_master1/w1_master_search it turns off searching for more devices and reduces use of resources. turn it back on if you change the sensors- echo 1 > /sys/bus/w1/devices/w1_bus_master1/w1_master_search

MM0RBZ commented 7 months ago

Update- I've been running one genuine sensor and one 5m cabled clone sensor in parallel for 42 hours now and all looks good, no drop-outs. Strangely the 5m ones do seem to be the better option of the cloned ones. even if you just need a 1m cable buy the 5m and cut the cable. I'll add another genuine sensor tonight on a 16m screened twisted pair cable and see how that goes.

espenfj commented 2 months ago

Hi!

I am experimenting with some temp-sensors in my caravan. I tried to be clever and created an expandable/module based build using TP-cables and RJ45-connectors. The idea is to use wall-boxes or joint pieces for the connections, and custom lenght TP-cable.

If my professional drawing is understandable, you'll get the idea: temp

(1-wire = DS18B20). My problem right now is that one of the two DS18B20's in the first box, keeps failing after a short period of time. 30-60 minutes. Venus is reporting "open circuit" on the "disconnected" sensor. The other two seems to be ok.

My question for you is;

Sarah-1331 commented 2 months ago

In my experience it’s cheap sensors buddy

Rikkert-RS commented 2 months ago

Hello

In the 1Wire Bus, you should only use one pullup resistance on the data line near to the RPi

Best regards

espenfj commented 2 months ago

Thank you for quick answers, guys! I split my 2xtemp-device into two singles and put a pullup resistance on the connector nearest the RPi. It really made no difference, but I am now able to isolate the sensor that keeps failing. I guess I'll have to buy a new sensor and try again after the upcoming trip :)