Page 1 of 1

graphing rainwater tank level

Posted: Sun 24 Oct 2021 12:09 am
by hills
Hi all

I have always been interested in how the amount of rain affects the level of my rainwater tanks, so I have added that info to my rainfall and dailyrain graphs as below or you can view it on my graphs tab at http://members.iinet.net.au/~storerfami ... trends.htm
rainfall.JPG
dailyrain.JPG
To get the rainwater level I purchased one of these from ebay. It transmits the distance between the sensor and the water surface in mm on the 433Mhz range. Just be aware it needs to be at least 50cm above the high water mark so I installed it in an upturned bucket on the top of the tank.
watermetre.JPG
I run my weather station on a Raspberry pi so I can receive the 433mHz signal (plus that from my weather station) using one of these and the free software 433_rtl. You might need to google powershell if you want to do it on a windows PC, unfortunately I can't help there. :)
433.JPG
With a couple of small bash scripts I constantly log all data on the 433Mhz range to a daily file, then convert it to metres from the tank bottom and append it to the dailyrain and rainfall json files.

I'll attach the scripts on the next post if anyone is interested as I've just realised I can't access my pi from this computer :( Feel free to use them if you are running on raspbian or any other linux.

Re: graphing rainwater tank level

Posted: Sun 24 Oct 2021 12:43 am
by hills
This will probably require some Linux and json knowledge, but feel free to give it a shot :) This was more to point out the hardware I found that does the job for those who already know a bit about this, but I'm happy to provide any further info. ALWAYS SAVE PREVIOUS COPIES OF ANY FILES YOU EDIT SO YOU CAN BACK OUT WHEN YOU BREAK THEM... like I often do ;)

This is the script to update water level. I run it from crontab every 5 minutes with 04,09,14,19,24,29,34,39,44,49,54,59 * * * * /home/pi/get_water_level.bash
waterlevel-bash-script.txt
You will also have to add the following lines to your cumuluscharts.js file under the doRain series section and change the url from raindata.json to rain1data.json. note your old raindata.json file will be unaffected so you can always swap back to that one as this sends up a second .js file with a different name.

}, {
name: 'Tank Capacity',
type: 'area',
color: 'rgb(20,20,20,.15)',
yAxis: 1,
tooltip: {valueSuffix: config.rain.units}
}, {
name: 'Water Level',
type: 'line',
yAxis: 1,
tooltip: {valueSuffix: config.rain.units}


and this to the $.ajax section under doRain

chart.series[2].setData(resp.rfull);
chart.series[3].setData(resp.wlevel);



then either create a script containing the 2 lines below and run it at boot time or create a service and enable it.

#!/bin/bash
/usr/local/bin/rtl_433 > /var/tmp/433.out 2>&1


I think that's about it for the level part.

Re: graphing rainwater tank level

Posted: Sun 24 Oct 2021 12:48 am
by hills
also just for interest this is the format that 433_rlt displays the 433mHz signal for both the weather station and the water sensor.

time : 2021-10-24 11:03:12
model : Fineoffset-WHx080
Msg type : 0
Station ID: 217
Battery : 1
Temperature: 13.6 C
Humidity : 68 %
Wind Direction: 68
Wind avg speed: 3.67
Wind gust : 8.57
Total rainfall: 395.7
Integrity : CRC
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

time : 2021-10-24 11:03:13
model : Fineoffset-WHx080
Msg type : 0
Station ID: 217
Battery : 1
Temperature: 13.6 C
Humidity : 68 %
Wind Direction: 68
Wind avg speed: 3.67
Wind gust : 8.57
Total rainfall: 395.7
Integrity : CRC
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

time : 2021-10-24 11:03:46
model : TS-FT002
Id : 141
Depth : 102
Temperature: 17.3 C
Transmit Interval: 180
Battery Flag?: 0
Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

time : 2021-10-24 11:03:47
model : TS-FT002
Id : 141
Depth : 102
Temperature: 17.3 C
Transmit Interval: 180
Battery Flag?: 0
Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Re: graphing rainwater tank level

Posted: Mon 25 Oct 2021 7:25 am
by HansR
That's a nice exercise Phil.
If there were an API interface to Cumulus to input data for homebuilt sensors in the extrasensorslog a whole new world would open up ( :idea: ).

One difficulty I see with what you did is that you modify the existing cumuluscharts you will have to repeat this at updates. But OK, it is not a whole lot, true.