Electronic – arduino – Using an Arduino to measure wire capacitance

arduinocapacitance

I wanted to use an Arduino as a capacitance measurement device for a coaxial wire. I started at measuring the wire capacitance using digital multi-meter UT58B. I turned the knob to 2 nF and then measured the capacitance depending on the wire length. These are the results:

Results for capacitance measurements

After the measurements I got the function (y = 0.0032x + 0.0268) on how the capacity changes depending on wire length. Now I wanted to use the Arduino to measure the capacitance and then calculate the wire length depending on the capacity. I tried following a guide to make the Arduino be able to measure the capacity.

Now the problem. I tried calculating the needed resistance using R = TC/C for one seond and got:

R = 1/(0.019*10^(-9)) = 52631578947.37 ohm

As you can see the resistance is too big. My questions:

  1. Should I decrease the time constant? And how small could it be so that arduino can still measure the time? What maximum resistance can you suggest?

  2. Maybe I wrongly read the multi-meter values? (the 2 nF scale)

  3. Maybe there are other solutions you can suggest to measuring capacity with Arduino?

Best Answer

In actuality, you can use an Arduino and you do not need to utilize an oscillator with the test capacitor in the tank. This will work quite well for capacitors of 10pF or more, and with care even below, though that is not something I would have believed until trying it. You do however need your PCB to be very clean without flux residue or remains of efforts to remove it.

The key is not to use the low impedance, slow ADC, but rather the comparator, and utilize the timer block to measure the charging time.

This is what the Arduino capacitance measurement example does, and also the ATmega based kits with LED digit display which you can buy for around $11. Source resistor is typically selected be a GPIO and in the 100K - 1M type of range. Stray capacitance is calibrated out by measuring the time constant with only the meter and test fixture, but no capacitor under test. Provided you don't move the fixture or get your hands into the field of measurement, adding even a tiny test capacitor then linearly increases the time constant.