Wednesday, 8 January 2020

Measure capacitors with a $10 Arduino

Here is my simple Arduino-based Capacitor Meter which requires no additional components or even a breadboard - just add a display (though you can use the Arduino IDE Serial console if you don't have a display).

It uses an Arduino, some jumper wires, a cheap $3 OLED display and a 9V battery - that's it! You just stick the capacitor under test directly into the Arduino sockets.


It measures from about 20pF to 1000uF and is reasonably accurate. Each measurement is performed twice and an error difference between the two measurements is also displayed. However, once you go above 500uF is starts to get quite inaccurate (e.g. 10%). The ESR of the capacitor may be the cause of this. It is also not accurate when measuring caps around the range 0.8nF-3nF due to the two different measurement ranges (one technique is best for 20-800pF and the other for 10nF+).

I combined a number of measurement techniques to try to get the best accuracy (compared to my XJW01 LCR bridge). Some measurement ranges can be within 2% of the XJW01 value.

My OLED used a  128x32 7-wire SPI interface (which even worked without needing to connect the power wires!), but you can use a IIC 4-wire OLED 128x64 display if you change the script slightly.

Arduino:  UNO R3
OLED display  128x32 SSD 1306

I have used some tweaks to make it as accurate as possible but there seems to be some sort of inaccuracy in the ADC which I have not yet got to the bottom of. I suspect that driving the test pins directly from the Arduino may be the cause but I wanted to see if it would work without any external components at all (not even an additional resistor is required).

The script contains some 'fudge factors' which are tailored to my specific UNO R3 board. You may need to slightly tune these to your board for best accuracy. You may need to set the reference voltage of your particular board by measuring the ARef pin with an accurate DVM.

The Serial.print lines have been commented out.

Here is the script if you are interested (with various debug code and tweaks commented out).
Measure_capacitance_mk2.ino - good luck!

No comments:

Post a comment