Capacitance Meter

A capacitance meter is a piece of electronic test equipment used to measure capacitance, mainly of discrete capacitors.

There are 2 different types of measuring the capacitors: First one is, plug in the capacitor to the tunnel  pin, Second one is, using two probes to measure the capacitor.
The overview of this project is that a resistor will charge a capacitor in TC seconds, where

  • TC = R * C
  • TC = time constant in seconds
  • R = resistance in ohms
  • C = capacitance in farads ( 1 microfarad [ufd] = 0.0000001farad = 10^-6 farads)
The voltage at 1 Time Constant equals to 63.2% of the charging voltage.

Setup For the input state and output sta
The microcontroller Atmega328’s pins can be in one of two states, ,which are electrically very different.
  • Input State (set with pinMode(pin,INPUT);)
    • High Impedance (resistance ) – Makes very little demand on the circuit that it is sampling
    • Good for reading sensors but not lighting LED’s
  • Output State (set with pinMode(pin,OUTPUT);)
    • Low Impedance – Can provide 40mA source (positive voltage), or sink (negative voltage)
    • Good for lighting LED’s, driving other circuits – useless for reading sensors.
Additionally the pins can be HIGH (+5 volts), to charge the capacitor; or LOW(ground) to discharge the capacitor

The microcontroller that is used in this Capacitance Meter is Atmega328. This microcontroller are frequently use in Arduino Duemilanove circuit board. In this microcontroller, it consist of 28 pins which include the analog pins and the digital pins. In this capacitance meter, we are using most of the digital pins and one of the analog pin. The digital pins are mostly use to connect the LCD.Two of the digital pins are represent charge pin and discharge pin and one of the analog pin represent the A/D input. Besides that, there is also a 5V regulator which need to supply a +5V to the microcontroller. The full schematic on how to develop a simple capacitance meter is at the attachment below.

Algorithm for capacitance meter sketch
  • Set discharge pin to INPUT (so it can’t discharge the capacitor)
  • Record the start time with millis()
  • Set charge pin to OUTPUT and make it HIGH
  • Check the voltage repeatedly in a loop until it gets to 63.2% of total voltage
  • After the capacitor is charged, subtract the current time from the start time to find out how long the capacitor took to charge
  • Divide the Time in seconds by the charging Resistance in ohms to find the Capacitance
  • Report the value with lcd.print
  • Discharge the capacitor
  • Set the charge pin to Input
  • Set the discharge pin to OUTPUT and make it LOW
  • Read the voltage to make sure the capacitor is fully discharged
  • Loop and do it again
Arduino Sketch

In the programming parts, you need to open the software “arduino.exe” , then copy the entire source code below into the software and run it.

[sourcecode language=”cpp”]
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
#define analogPin 1 // analog pin for measuring capacitor voltage
#define chargePin 3 // pin to charge the capacitor – connected to one end of the charging resistor
#define dischargePin 2 // pin to discharge the capacitor
#define resistorValue 10000.0F // change this to whatever resistor value you are using
// F formatter tells compliler it’s a floating point value

unsigned long startTime;
unsigned long elapsedTime;
float microFarads; // floating point variable to preserve precision, make calculations
float nanoFarads;

void setup(){
lcd.begin(16, 2);
pinMode(chargePin, OUTPUT); // set chargePin to output
digitalWrite(chargePin, LOW);
lcd.setCursor(0, 1);


void loop(){
digitalWrite(chargePin, HIGH); // set chargePin HIGH and capacitor charging
startTime = millis();

while(analogRead(analogPin) < 648){ // 647 is 63.2% of 1023, which corresponds to full-scale voltage } elapsedTime= millis() – startTime; // convert milliseconds to seconds ( 10^-3 ) and Farads to microFarads ( 10^6 ), net 10^3 (1000) microFarads = ((float)elapsedTime / resistorValue) * 1000; if (microFarads > 1){

lcd.setCursor(0, 0);
lcd.print(microFarads); // print the value to serial port
lcd.setCursor(6, 0);
lcd.print(" uF"); // print units and carriage return

// if value is smaller than one microFarad, convert to nanoFarads (10^-9 Farad).
// This is a workaround because Serial.print will not print floats

nanoFarads = microFarads * 1000.0; // multiply by 1000 to convert to nanoFarads (10^-9 Farads)

lcd.setCursor(0, 0);
lcd.print(nanoFarads); // print the value to serial port
lcd.setCursor(6, 0);
lcd.print(" nF "); // print units and carriage return

/* dicharge the capacitor */
digitalWrite(chargePin, LOW); // set charge pin to LOW
pinMode(dischargePin, OUTPUT); // set discharge pin to output
digitalWrite(dischargePin, LOW); // set discharge pin LOW
while(analogRead(analogPin) > 0){ // wait until capacitor is completely discharged

pinMode(dischargePin, INPUT); // set discharge pin back to input

Steps of Measuring
1. Plug in the Adapter. The LCD will show 0nF on the first row because there is nothing to measure yet and the range on second row.

2.Plug in the 100uF capacitor into the tunnel pin.

3. Pull out the 100uF capacitor, and use the probes to measure the 100nF.


1. Capacitance_Meter_Schematic.pdf

2. Capacitance Meter Source


, ,

Related Post

DIY FM Radio

Super Cool Watch?

Getting Started with MPLAB X IDE

New DIY Project is coming!

Leave a Reply

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