Surprised I'm not bald will all the hair pulling and failed attempts to get there but after a year it is finally working...
The task was simple enough, to measure fluid depth in two tanks, one a sewage holding tank, the other a bulk water tank. Just figuring out which method worked with which board was an exercise in frustration, but the JSN-SR04-2.0 turned out the only one of the two I could get to reliably work.
Despite the industrial look, these waterproof light switch enclosures proved ideal, as the batteries in holders fitted beneath the clear plastic. A little hacking out of the switch 'fingers' with a Dremel gives plenty of space in the base area.
Battery holders are held in plastic conduit which are hot glued to the back of the box poking through the front section aperture.
The top case is a 3v3 WhisperNode with onboard RTC and RFM69, and tucked under the spaghetti in the top left back corner is a level converter. The RTC wakens the Node every hour to initiate readings, and despite a few hiccups seems to be reliable. The WhisperNode is allegedly capable of draining the 2 AA cells down to 0.9v, time will tell...
The lower box holds the 5v ProMini, a small latching relay, and the ultrasonic board, the button type ultrasonic (like parking sensor) is mounted on the end of a 3/4" collar to 1/2" galvanised steel tube drilled centrally through the roof of the 1.34m x 1.67m tank area.
Connection between the cases is via Cat5e in 16mm conduit, 2 cores for I2C, 3 cores for relay control and 3.3v power, 2 cores for 5v and ground to the level converter.
Despite worries over echoes in the resulting space, the tank was emptied last night, and the reading is coming in with the occasional glitch at 1620mm depth from the head, which I believe has a cone angle of 45 degrees.
The Node control of a Relay by On/Off pins to Mosfets may seem wasteful, but I had them anyway. The 5ms on/off of this small latching signal relay boots up the ProMini and seems reliable.
Still to incorporate a WDT/Reset on the 5v as it periodically hangs, and a time limiter on the Node to complete the task, but glad it is all all working semi-reliably, even if some of the programming side I still don't understand...
The 5v tests for 2 consecutive identical readings, the 3.3v tests that it fits within acceptable range, and if not calls for a further reading.
Once delivery of a second identical board from China is done, the water tank should be a lot easier. This one is the more important, as ran out of water previously due to corrosion of the level probes in the tank (3 core cable and short bolts) which stopped the borehole pump topping up the tank, and the hidrofor hit it's cut-off electrode. The level monitoring will give early warning to go investigate long before the bulk tank is 'empty'...
Postscript 12/7/18 - Water tank worked flawlessly from first deployment, but led to concerns over dropping battery voltage.. The problem appeared to lie with the Master sinking power through the I2C lines, but a routine to null the SDA/SCL lines prior to sleeping seems to have halted the decay.
One of the unexpected results of the Sewage Tank deployment was detecting a dramatic rise in level during a heavy storm (85mm in 24 hours) initially thought to be ground water intrusion.
Excavation to the incoming pipe connection to the tank found a round pipe in a square hole (not exactly an unexpected building practice here, now packed out and sealed.
Losing 30% of storage capacity would otherwise never have been detected, so it the deployment has already paid for itself handsomely...