Temperature sensor functionality

Hello. I have 20 DS18B20 temperature sensors connected to my Pi.
Every minute the values will be refreshed. Sometimes the value from any sensor does not show the right temperature e.g. 20°C. but 85°C.
For this wrong value I have a switch. All values under 82°C are OK. If the value is other for more than 5 seconds, then there is a message with sensor FAIL.

What I miss: If the sensor is broken and does not continue to send a plausible value, a message should also appear: SensorFAIL. For this, a permanent update of the sensor value would have to be queried. How can I do that?
The temperature sensors are for a battery pack. It is necessary to check the values permanently
and reliable for a safety battery. This is the background for he permanent sensor check.

Here my nodes from one sensor:

[{"id":"e958ebcc85e2d1a6","type":"trigger","z":"c3f1bf5d5aa9131b","name":"","op1":"","op2":"SensorOK","op1type":"nul","op2type":"str","duration":"2","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":760,"y":1940,"wires":[["f8498cbdc4c54a46","2a92649be426b61d"]]},{"id":"2a92649be426b61d","type":"debug","z":"c3f1bf5d5aa9131b","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1010,"y":1900,"wires":[]},{"id":"f8498cbdc4c54a46","type":"trigger","z":"c3f1bf5d5aa9131b","name":"","op1":"","op2":"SensorFAIL","op1type":"nul","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"SensorOK","bytopic":"all","topic":"topic","outputs":1,"x":800,"y":1880,"wires":[["2a92649be426b61d"]]},{"id":"8ae24cb28683d449","type":"inject","z":"c3f1bf5d5aa9131b","name":"","props":[{"p":"payload"},{"p":"topic","v":"","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"20","payloadType":"num","x":130,"y":1860,"wires":[["c265575fae74d697"]]},{"id":"9159e0cfa6187611","type":"inject","z":"c3f1bf5d5aa9131b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"2","crontab":"","once":true,"onceDelay":"0.1","topic":"","payload":"","payloadType":"date","x":130,"y":1720,"wires":[["9f36c32e060f88df"]]},{"id":"3cd72f99b8d4cb4b","type":"change","z":"c3f1bf5d5aa9131b","name":"Welche Zelle & Wert","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"ZelleTemp1:\"& payload","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":1720,"wires":[["c66ab942bc80c938"]]},{"id":"c265575fae74d697","type":"switch","z":"c3f1bf5d5aa9131b","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"82","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":630,"y":1720,"wires":[["3cd72f99b8d4cb4b"],["f8498cbdc4c54a46","e958ebcc85e2d1a6"]]},{"id":"b3153aa2f0dda4e4","type":"debug","z":"c3f1bf5d5aa9131b","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":490,"y":1660,"wires":[]},{"id":"c66ab942bc80c938","type":"debug","z":"c3f1bf5d5aa9131b","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1030,"y":1720,"wires":[]},{"id":"9f36c32e060f88df","type":"sensor-ds18b20","z":"c3f1bf5d5aa9131b","d":true,"name":"","topic":"","sensorid":"28-1217b20164ff","timer":"1","repeat":false,"x":330,"y":1720,"wires":[["c265575fae74d697","b3153aa2f0dda4e4"]]},{"id":"9f8e39bdf7494ad3","type":"inject","z":"c3f1bf5d5aa9131b","name":"","props":[{"p":"payload"},{"p":"topic","v":"","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"85","payloadType":"num","x":130,"y":1820,"wires":[["c265575fae74d697"]]},{"id":"21d0eefe2af1069c","type":"comment","z":"c3f1bf5d5aa9131b","name":"Real sensor value","info":"","x":510,"y":1620,"wires":[]},{"id":"8cc5f724a493eb8b","type":"comment","z":"c3f1bf5d5aa9131b","name":"If sensor value more than 5 seconds fail","info":"","x":890,"y":1840,"wires":[]},{"id":"e8eba61633ea14fc","type":"comment","z":"c3f1bf5d5aa9131b","name":"Value up to 80°C","info":"","x":860,"y":1680,"wires":[]},{"id":"36df3c7e318d59d7","type":"comment","z":"c3f1bf5d5aa9131b","name":"Test: Click, click, click.....","info":"","x":150,"y":1780,"wires":[]}]


flows (18).json (3.5 KB)
Thanks for help.

Just had a very quick look at your flow and spotted you are triggering the DS18B20 once every 2-seconds.
You will need to look-up the maximum rate you can re-trigger the sensor - I seem to remember it should be a lot higher than that - maybe once every 30-seconds (??).

Try changing the 'inject' node to once every 60-secs, as per your 'spec', and see if that improves things.

Hello,

thats correct. I have only for the forum the re-trigger in 2 seconds.
In real situation the re-trigger is every 70 seconds

image

If you have a numbers of sensors connected to the same pin on the RPi - you might find it useful to have a look at this thread...

I've never had more than 2 or 3 sensors connected to the same pin, so may not be able to help you.

What do you see from the sensor node in that case?

Hi Colin,

I don´t know, which signal or how ever I receive in Nodered, of the sensor is broken. This is the issue, why I want to analyse the cycling signal from the sensor.
If over 3 minute no signal is coming, then alarm. If over 3 minutes the sensor send 85°C, then alarm. Maybe, there is any possibility in Nodered to see the cycle from signal?

To run a watchdog that triggers after three minutes of no good data you can use a Switch and a Trigger node, something like this

[{"id":"15315cd0a375dfd4","type":"comment","z":"e672d6322ed2b137","name":"From sensor","info":"","x":110,"y":520,"wires":[]},{"id":"f807c4395ad35617","type":"switch","z":"e672d6322ed2b137","name":"Good data?","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"85","vt":"num"}],"checkall":"false","repair":false,"outputs":1,"x":290,"y":520,"wires":[["ec3e07b0837ad439"]]},{"id":"ec3e07b0837ad439","type":"trigger","z":"e672d6322ed2b137","name":"","op1":"","op2":"Error","op1type":"nul","op2type":"str","duration":"3","extend":true,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":450,"y":520,"wires":[[]]},{"id":"e415d5f7a6dd635e","type":"comment","z":"e672d6322ed2b137","name":"Error message comes out here","info":"","x":670,"y":520,"wires":[]}]
1 Like