7 July 2024

How full is the rain barrel?

By Bolukan

I made a setup with an AJ-SR04M Waterproof Ultrasonic Sensor to measure how full the rain barrel is. The measurement data are distributed via mqtt and shown on the home monitor.

The sensor dangles down from the center of the lid. There was no crack to run the wire in because I put the green house together properly. The wire enters via the roof truss through the upper window. Inside is the PCB that controls the speaker and processes the signal. A four-wire telephone wire helps bridge the last meters to a Raspberry PI Zero Wifi that is connected to the fixed internet.

A Python script runs on the Pi as a service to periodically start a measurement and send the result to the MQTT server. A first application with the received data is to display the information – how much space is left in the water barrel – on the home monitor.

The script is published on github: Python script to transfer AJ-SR04M Waterproof Ultrasonic Sensor to MQTT