In 2013 we moved from the city to a smaller rural township, which means our water supply is now on onsite 22,500 litre water tank. After spending our first summer here up and down the ladder checking the water level in the tank, and having actually no idea how much water we would use in any given week, I thought, there must be a better way. I found some wireless water level meters on the internet, but the prices were pushing $150NZD or more, and only gave a realtime view of what the current level was – no historical tracking at all. After doing some research, an ultrasonic measuring sensor on an Arduino seemed the way to go. But I figured hey, let’s take it a step further and log the data into a database as well, so we can see what the usage is and how things like doing five loads of laundry or filling the spa pool, or a light shower vs a heavy downpour affected the supply. And heck, let’s chuck a temperature sensor in there as well for good measure. Version One was an Arduino Nano with a HC-SR04 ultrasonic sensor, and a OneWire DS18B20 temperature sensor. This called a webservice which logged water level and temperature into a SQL server database. I dropped some basic charting over the top to give a hourly/daily/weekly view of temp and water level. This worked fine, but I wanted to make the web site a bit more presentable and easier to reuse – which brings me to Version Two – same hardware, but logging into a Azure Web App (running in the free tier) with a SQLite database sitting behind it. And, while I’m at it, let’s just opensource the whole thing.
Initially I thought a ultrasonic sensor wouldn’t last too long being put inside a watertank. It’s not IN the water, but the inside of the tank is quite a humid place with lots of condensation, and isn’t an overly forgiving environment for delicate electronic devices. However, the sensor itself has been sitting happily in place for 12 months now, with no signs of deterioration. And at $2.50 each, ¯\_(ツ)_/¯. I have the Arduino itself inside the house (easier to power, and easier to connect to the LAN, easier to keep dry), and the ultrasonic and temperature sensors are connected via a 30m CAT5 cable that runs under the house and out to the water tank. There seems to be no issue running the 5v power supply out and data back in again at that length. The sensor itself is mounted inside a piece of 65mm downpipe which is then put into the watertank above the highest water level. Ensure the sensor is level with the water. Mine is about 120mm above the high water level.
|Arduino Uno Board||$10.67|
|DS18B20 Temperature Probe||$3.99|
|HC-SR04 Ultrasonic Sensor||$2.26|
Now the fun part.