Introduction: Dam Lvel Sensor
A water level monitor was made to monitor a farm dam level, it seems we may be moving into another drought.
Supplies
the major items include
6V 1W solar panel + charge controller, from AliExpress
18650 LiPo battery + socket
Moteino + 915Mhz RFM95 radio, from http://lowpowerlabs.com Its a 324p arduino with a radio on the bottom. Doesn't need extra flash.
bmp280 temperature sensor breakout board, from ebay
waterproof US sensor from https://core-electronics.com.au/a01nyub-waterproof-ultrasonic-sensor.html
450 mm long inch and a quarter Poly riser from your friendly local rural irrigation supply shop, with 2 end caps. Although 300mm would be better if in was in stock at the time. A white pipe might be better for thermal reasons, though all the carbon in black risers make them last seemingly forever in the sun.
Step 1: Schematic
Here is the schematic I drew. Its reasonably simple.
For power reasons the arduino spends most of its time asleep, makes a height measurement and phones home every couple of hours. The Ultrasonic sensor is switched off when not in use, as it draws about 15mA when active. A couple of IO pins are used to initally precharge a supply filter capacitor, then power the US sensor directly. This limits switching supply glitches to the arduino.
As the motino only has one hardware Uart, which is used for programming and debug, I used a software serial library to listen to the ultrasonic sensor at 9600 baud. That seems to work well.
Since the speed of sound in air depends on temperature, I added a temperature sensor to the unit to allow compensation. I suspect the US sensor used may already perform temperature compendation so I'm not currently doing that in software. This may change when I see what happens in summer.
Attachments
Step 2: Construction, Electrical
The unit was assembled on a piece of fibreglass perf board cut to fit inside the Poly riser and allow it to turn freely when the end cap was screwed on. Sockets were used to mount the moteino and the temp sensor to the perf board. Wires soldered on the back.
The electronics was sprayed with a clear protective laquer for water protection.
Step 3: Construction, Mechanical
The US sensor was mounted into a 30mm hole drilled into one of the end caps. I used an old lathe, a hole saw would also work for those without a 30mm twist bit.
The cable on the US sensor was shortened and a 0.1 inch 4 pin plug fitted.
2 wires to the solar panel were passed through a small hole drilled next to the US sensor in the end cap. The hole was not sealed to allow drainage of any water that gets in. I figured thermal cycling would suck in some humidity.
I soldered a pair of wires to the solar panel, then put globs of epoxy glue over the various soldered joints to waterproof them. I also glued some strips of PCB to the back of the solar panel to allow me to screw it to a wooden mounting block.
I glued and screwed a couple of short pieces of 45×90 treated pine timber together to get something wide enough to attach the solar panel. A groove was routed down one side to locate the poly pipe, and I made a clamp bracket from another short piece of treated pine with the aid of a bandsaw. The solar panel was screwed to the side, with the wires passed through a drilled hole.
Poke the electronics into the poly pipe and screw on the bottom end cap, with the US sensor. Then screw on the top end cap. Put the pipe into the clamp and nip it up gently. Solder the solar panel wires from the panel to those from the pipe and seal with small heatshrink.
Step 4: Mounting
I made a bracket by welding up some 25mm square steel tube, priming the welds with zinc paint, then painting with a couple of coats of yellow epoxy enamel that was to hand. The unit is mounted to a jetty in my dam as shown, I'm sure other mounting methods will differ.
Its about 1m from the end of the jetty, and 0.5m above highest expected watel levels.
The solar panel is vertical, facing east, as that gives the best view of the sun year round given surrounding trees. The jetty is on the western side of the dam, with some big trees to the north. I'm in the southern hemisphere. The panel is on the far side in most photos.
There are a few bits of fencing wire sticking up on the wood block, and the top pipe cap, as bird spikes. Trying to keep waterfowl off this.
Step 5: Local Data Environment
The structure I live in is timber with corrugated iron for roof and wall sheeting. Thats not good for radios. So there is a radio relay on the roof relaying both RFM69 and RFM95 radio links into the office. This also provides some lightning protection.
The dam is about 0.5km from the house, LoRa can do that easily even from inside the slightly conductive black poly pipe.
Another USB motino with a radio link presents data to a linux computer, which logs the serial data and stores it in an influx database. Grafana on an internal http server then presents data to the user nicely. I don't currently use MQTT or LoRaWan.
So every 2 and a bit hours I get a message like this in my log
[230819143018] 88 V= 3.94 T=11.50°C D=797mm
where
the timestamp is added by the logging software
message comes from a device with address 0x88
0x88 current battery voltage is 3.94V
0x88 current temperature down on the dam is 11 Celcius
0x88 current distance from sensor to water is 797mm.
The logging software will soon know the hight above max water level, after I measure the distance from current to the overflow pipes. And grafana will present that information more conveniently.
Step 6: Code
is here https://github.com/galah-x/DamLevelSensor in the master branch