alaudet / raspi-sump

A sump pump monitoring system using Python and Raspberry Pi
https://www.linuxnorth.org/raspi-sump/
MIT License
92 stars 36 forks source link

Redundant Sensors #70

Closed dorrsr closed 2 years ago

dorrsr commented 3 years ago

Hi, I'm getting my first Raspi-Sump built and setup at my cabin. Great software! I am typically up at my cabin from April through October, for 8-10 weeks during this time. So the sump is operational most of the time without anyone being there. I too geeked out about the temperature sensor add-on as the sump is in a small unheated crawl space under my cabin so I'm integrating a DHT22 temp sensor. I got the DHT22 working on the PI and I'm fiddling with the code to add the real-time temperature into the distance formula.

My main concern is actually the distance sensor. I am using the JSN-SR402T. I don't really need the waterproof capability, but I like having just a single sensor for monitoring. I want to add a second JSN-SR402T and use both for monitoring from a single PI. My thought is, what happens if the primary sensor fails, or something blocks the primary sensor. With 2 sensors, you can verify that they are producing similar distance values. If one fails or starts producing strange numbers I could remotely connect to the PI and disable the faulty sensor. Much easier than driving the distance up to the cabin and fixing/replacing the only sensor.

alaudet commented 3 years ago

Hi, as of now there is no easy way to run two sensors simultaneously in software. If you have internet at the cabin I don't see why you could not connect a second sensor and if your first sensor fails simply login to the unit and change the gpio assignments to your secondary sensor. The pi has enough gpio pins.

You can always test your two sensors periodically, I have included a utility called hcsr04.py to allow you to do this. Log into your unit via ssh and run the following commands. Let's assume you have the first sensor trig and echo installed on 17 and 27 and the second sensor installed on trig and echo 23 and 24.

pi@BasementPump:~ $ hcsr04.py -t 17 -e 27
trig pin = gpio 17
echo pin = gpio 27
speed = 0.1
samples = 11

The imperial distance is 13.1 inches.
The metric distance is 33.2 centimetres.

Then simply run the command hcsr04.py -t 23 -e 24 and compare your results.

I have never actually installed two sensors so i am only assuming this would work fine as the second sensor would not be getting any inputs. You will have to test it.