How to measure small capacitance

Discussion in 'General Electronics Chat' started by NomadAU, Mar 23, 2013.

  1. NomadAU

    Thread Starter Member

    Jul 21, 2012
    32
    0
    Hi,

    For some months now I have been working on a setup which will allow me to measure the quantity of liquid in one of several tanks (water and diesel). I have tried a variety of techniques, including ultrasound, moving float, thermisters...and now, capacitance. The latter seems most promising due to its relatively simple construction, i.e. no moving parts, all I have is 2 aluminium strips held together by double sided adhesive pads (non conductive) and the whole lot slid into a waterproof plastic tube.
    Placing the sensor in a large bin, and filling it with water, I can measure the capacitance across the aluminium strips as the water fills up, and the attached chart shows a linear relationship between depth and C.

    The capacitance is 97 pF when empty, rising to 128 pF when depth is 700mm. The readings in between, for each 100mm rise, result in a straight line when graphed.

    So, the simple capacitance sensor is working.

    What I now need to do, is measure this without my Capacitor Meter, using my Arduino, so that I can use the C value to perform a lookup (I have already got a conversion table which gives me the liquid volume for a given liquid level in a specific tank) and then drive the needle on an analog liquid gauge to display the tank contents.

    I've been experimenting with generating a constant frequency signal, and then seeing how it gets affected by the capacitor - the resultant frequency I can measure using my Arduino by counting transitions within a given time period. I've tried various frequencies (2MHz, 4MHz, 8MHz, 12MHz and 20MHz) which and while all have provided some degree of correlation to the changing capacitance, they have definitely NOT given me anything like a straight line graph. The attached file (FrequencyReadings.jpg) shows what I mean. Here, it is easy to see the initial filling of the container, but then between 22 and 29, the frequency starts to drop (even though the container is still filling, and the capacitance is still rising), and then around 36 it starts to rise again...
    The frequency graph actually shows both a fill, and an empty of the container...the empty phase begins around 71.

    Interesting to note that the 'empty container' reading at the start of the fill is different to that at the end of the empty...

    Anyhow, the reason for this post is to see if anyone can shed some light on why I might be getting this apparent mismatch between the capacitance value and the resulting frequency - I was expecting both to be linear with high correlation.

    BTW, the container is a regular green waste garbage bin, so effectively a rectangular container on wheels which means that the volume of water is linearly related to the height of the water, i.e. if 100mm on my sensor indicates 20Litres, then 200mm will be 40L and so on.

    Thanks for any insights...
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,446
    3,362
    I have worked on capacitive sensors that measure %RH (relative humidity) in the same capacitance range. I will see what I can find.
     
  3. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I did a high resolution capacitance meter here;
    http://www.romanblack.com/onesec/CapMeter.htm
    which simply uses a comparator as an RC oscillator, (so C is linear to the oscillator period) then uses the microcontroller to measure the output frequency with very high resolution.

    In your case with 97pF to 128pF you have a pretty good range and that technique should work fine. You may need to mount the oscillator at the tank, so the capacitance and movement of the external wiring won't affect the frequency.
     
    NomadAU likes this.
Loading...