In the second episode of my µC adventures I’m not losing any time and directly approach the thing that I started tinkering with electronics in the first place.

The device I’m going to build is supposed to measure the water level in out rain water tank. And of course the measured level needs to be submitted to a server on the Internet via WiFi which is the main reason why I’m using the ESP8266.

After browsing the Internet for a few minutes I figured the best way to go would be with using capacitance to measure the water level. I wanted to have high resolution so any solution that would involve using conductivity of the water (which I found used in quite a few project write-ups online) is out of the equation.

Measuring conductivity can be done with an NE555 timer chip. The NE555 can be setup as an astable alternator which means it constantly flips the output pin between high and low:

440px-555_Astable_Diagram.svg

The capacitance can the be calculated from the duration the pin is set to high and the known value of R1:

As capacitor I was using an aluminum tube with an insulated wire running along the inside. I performed some tests with an aluminum tube of about 50cm length and 1.5cm diameter and 2×0,75mm^2 insulated wire. The capacitance turned out to be around 0.2nF in air which is almost next to nothing. This is also why my tests turned out to be a complete failure. The whole setup was more sensitive to my hands coming close to the aluminum tube than to the water level inside the tube.

The code I used for reading the output of the NE555 and calculating the capacitance can be found below:

But this is not the end. In the meantime I did some calculations with the formula for coaxial capacitors (which I should have done before trying to build the thing) and I will definitely come back to this type of sensor. So this is to be continued…

Leave a Reply

Your email address will not be published. Required fields are marked *