Filling level of rain barrel in the garden


does anyone have a sensor or idea how to measure the water filling level of a rain barrel in the garden?

Most of my sensors are from vendor “Homematic” and I’m also aware of sensor HM-Sen-Wa-Od. I saw that the minimum height of the barrel needs to be at least 1.1 meter for this sensor to work. Mine is only 80 centimeter in height. So this sensor seems to be not the right one for my use case.

Are there any other solutions or ideas how to implement a wireless solution? Any hardware tip? Maybe via ultrasonic sound or some other technology? It should work with batteries if possible and send the data wireless to my raspberry / openhab.

Thanks for all your creative suggestions!

This fellow used an arduino to build a sensor for an oil tank. My suggestion would be to use a JSN-SR04T module which is waterproof and has a minimum distance of about 20cm. The HC-SR04 module will die after a few weeks from humidity.

I found problems with a number of different ultrasonic sensors and they all died. In the end I used a pressure sensor and this has been sitting in my water butt for 6 years without any problem. I have the pressure sensor at the top of the tank, and this is connected to a tube which is open ended and goes down to the bottom of the tank (I put the plastic tube into a aluminium tube to provide it some rigidity.

Works very well :slight_smile: .

Hey there,

there is a german company that brings out such a sensor :

Best regards

I have used 3 different systems (a pond and two reservoirs)

1-Ultrasonic, with an HC-SR04. As Russel said, that died.Not after a few weeks, took months but it died. Replaced it with I think indeed the JSN-SR04T and that works perfectly.

2-In a system where I just want to know “almost empty” , “half full” or “full”, I installed a pvc pipe going from bottom to top with 3 reed switches in it. I have a wooden ring with a magnet floating on the surface, around the pipe. It stores the last state in case the magnet is in between reed switches.

3-capacitive: I have two insulated plates in a reservoir that form the capacitor of an HC14 RC oscillator. I measure the pulsewidth/frequency which is an indication for the amount of water in the barrel. The plates are just aluminiumcovered with resin.

Mine are not battery operated, but i guess nr 3 would be the most suitable for battery operation.

If you want battery operation… the ESP8266 might not be the best choice, consider an attiny85 in deep sleep with a 433MHz Rf module. The esp8266 spends relatively much time and energy on connecting to network. If you insist on an ESP8266, dont get a wemos or lolin board, get a bare ESP8266-12 module: no led or ftdi chip to feed

I have an rf transmitter plus attiny sending me data 4 times a day, just with a supercap (3F) and a small solarpanel

Maybe a bit late, but:

I use (several) SR04 sensors connected to arduino with souliss and NewPing to meassure the distance to the water-surface.
The value is written to a T_51 typical. in openHAB I have two items to set the min and max “distance” and calculate the filling-level in %

caveats: the NewPing-lib returns cm-values without decimals. so %-steps are rather big when you have just a small difference between min and max

Sorry for bumping up an old question but I’m in the same boat of requirement.

And to my surprise there are quite a few new sensors in town:

This one has 2 transducers instead of 1 therefore has less minimum detection distance as compared to JSN SR04T. It is also completely sealed and waterproof.

Before finalizing on this I had bought another one which was a waterproof modified version of HC-SR04 from here

The 1st one is much more rugged and waterproof as compared to the latter one.

1 Like

@Ritesh_Talreja is a spam account. They have posted the same fake advice in multiple forums, including Cayenne MyDevices and MySensors.

Their products might not be bad, but they are masking matketing as advice.

I was looking at different solutions as well (mostly ESP-based ultrasound DIY-projects) but in the end decided for the above mentioned HM-Sen-Wa-Od from Homematic, since I didn’t want to go all-in on something 100% homemade.

Soldering the HM-Sen-Wa-Od together from the individual components was ok-ish. What was however really really (!) difficult was getting it to establish a radio connection with my CCU due to “being 50cm below the surface, trapped in a ferroconcrete dome with a steel manhole cover on top”). What did the trick in the end was replacing the antenna with an external antenna, connected via a 5 m cable, which was then long enough to place the antenna outside of the cistern.

So far it’s doing it’s job. Let’s see how it performs over time in this extreme environment (constantly cold and wet).

In the manufacturer’s forum someone recommended sealing the logic board with a PCB-protective coating, which I also did as an additional protection, since the idea sounded logical to me. So far so good.

Hi Guys, I had a similar challenge for our system. Would you believe that you can solve the problem with a 3 foot long piece of wire and a $2.00 micro controller?

I needed something that was cost effective that could give me very refined measurement changes of how water levels were changing in the tank. I plan to sell thousands of these RainAmp systems so I needed something highly reliable, highly accurate, very low cost and very low power. I have quite a lot of expertise in capacitive sensors for electronics so that is where I turned.

Many modern Micro controllers include what they call touch-sense or Cap-sense technology. The topic area get’s insanely complex quick but it is actually pretty easy to use. I built my tank level sensors using an ESP32 S2 which cost me $2.00 plus a single 36" long insulated wire that went from the top of the barrel to the bottom.

I wrote code to call their Cap-Sense feature I found there was a continuous increase in the cap-sense readings as the barrel filled from empty to full. In addition there was a huge jump in readings as soon as the water touched the bottom of the wire.

My first attempt had a minor issue of the wire not hanging straight so I switched to 24 gauge silicone wire which is hangs nice and straight. I Tied a stainless steel nut on the end and suspended it in the barrel. I seal the end of the wire with some glue to try and avoid having it eat the copper of the wire. It is important to understand that this is non-contact sensing the water is only supposed to touch the silicone of the wire. There is never supposed to be any contact between the water and the copper of the wire. We are sensing capacitance not resistance.

I calibrated the system by recording the readings every 2 inches as I filled the barrel with water. I had the micro-controller remember these readings and then use interpolation to compute the values between each 2 inch Mark. This Micro-controller includes quite a lot of storage which I use to data log the levels as they change.

The sensor works just hanging through the threaded opening but I wanted something permanent so I drilled a hole large enough for the wire about 1/8" in the center of the barrel so it is undisturbed by other wires and tubes. I also 3D printed a case to hold the electronics, battery, lcd display and small solar panel. I screw the entire assembly to the top of the barrel with stainless screws. I seal it all with a TPU gasket.

I am still refining the total RainAmp system but I can currently tell within about 1/8" what the water level is in the system and can detect changes smaller than 1/8". I think that with some further refinement I can get it down to a granularity of about 1/64" change in water level. I use additional wires that are long enough to reach to 3/4, 1/2, 1/4 level so I can use the huge jumps in readings as the water touches to tipple check the primary wire readings.

A single inch of water in a standard 55 gallon drum is 1.528 gallons so at 1/8" I have a resolution of 0.191 gallons or 24.5 ounces. For RainAmp we want to allow users to control watering resolution down to 8 ounces so I to I need to improve our resolution down to 1/24" if I want to measure water dispensed by measuring water change in the barrel. I have other options but they all require extra parts so trying to avoid them.

This CPU also gives me WiFi and Bluetooth so I can broadcast the readings when in WiFi range. I use BLE to offer the feature to download the data logged to mobile phones for remote barrels. One

The cap-sense readings are initially erratic and are impacted by people standing near or touching the barrel. They can also be affected by strong electromagnetic fields so they would probably not be reliable below high voltage transmission lines. To overcome the jumpy readings which we also see from many ADC circuits I use a technique called oversampling which is essentially taking the average of a 1000 readings then taking the average of the last 10 average readings. This burns a bit more power since it requires keeping the CPU awake for few extra milliseconds but it helps smooth out the readings so we can use them reliably in control logic.

These kinds of capacitive sensors can be very finicky when the wires run further than absolutely essential or when they run next to other wires carrying any kind of power. The key design rule is to keep any wires between the sensor and the micro-controller as short as possible. Since I use capacitive sensors in several parts of the RainAmp system I use several cheap micro controllers right next to what they are sensing. I deliver the data between the micro-controllers using OneWire, RS422 or BLE. This takes a lot of the variability out of the system at the cost of several smaller circuit boards and the complexity of coordinating data exchange between the different micro-controllers. Short wires are so important that I take this to the extreme where we have buried soil moisture sensors and actually encapsulate the micro-controller so it get’s buried with those sensors.

T.I. has chips that appear to provide superior cap-sense technology and which consume far less power but the ESP32 S2 chips are so powerful at such a low cost that the T.I. chips are hard to justify until we can buy them at 10,000 unit quantities where the T.I chips become cost competitive.