Sensing water level with capacitance

 

Capacitive water sensor test

Needed to check the water level in a glass container.

Made this test set-up to measure if it would be possible to detect change of capacitance as the water level reached the copper foil on the outside of the container:

A square wave signal was emitted from pin 8 and sensed by analog 0. By sampling the analog pin in synchronization with the square wave the received signal could be distinguished from background noise using the lock in amplifier principle.

I was able to get a decent result but the output was greatly affected by touching the jar below the water line.  I found that this was due to the Arduino being grounded by the USB cable. Touching the jar would capacitively bleed off some of the signal coupled to the water and  change the output signal. I figured that having a floating (not connected to any ground) signal generator and detector might work better. Also using a square wave as input turned out to be tricky. The resulting output signal was small needle like pulses and sampling had to take place at just the right time to detect them.

To solve these problems i made another circuit that would A) not be referenced to ground (a.k.a. battery powered) and B) use a sine wave as the input signal.

The circuit uses a ATTINY85 micro controller powered by a single 3.6V LiPo cell. An inductor and capacitor transform a 5KHz square wave into a roughly 40V p.p.  sine wave used as input to the jar. This makes sampling at the right times much less critical. The measurements was then transmitted as 1200 BAUD serial data  using a simple 433MHz transmitter/receiver pair. Video of the output.

Encouraged by the results I wanted to see if I could, not only sense the presence of water but the level as well. Made this set-up:

Filled up the jar and inserted a siphon to gradually empty the water over time. The result looks promising:

Signal level is constant until siphon is inserted (ignore the step at the beginning of graph).  After the water level reaches the end of the siphon, the vacuum breaks and some of the the water in the hose flows back into the jar thus raising the level a bit. The spikes in the data are radio communication errors.

Link to project source (as-is , no support!)

 

Leave a Reply

Your email address will not be published.