Home Misc Projects Arduino capacitance meter

Arduino capacitance meter

by shedboy71

This was a simple project which appeared on the ARduino website – https://www.arduino.cc/en/Tutorial/CapacitanceMeter , to look at the theory visit that page. I was wanting to see how accurate this is and also wanted to test this on other variants such as the Chipkit and the MSP_EXP430G2 to compare performance between these development boards

I selected an Arduino Uno for this.

You will need a Breadboard, 10k Resistor, 220 ohm resistor and some hookup wire

arduino capacitance

arduino capacitance


[codesyntax lang=”cpp”]

#define analogPin      0          
#define chargePin      13         
#define dischargePin   11        
#define resistorValue  10000.0F   

unsigned long startTime;
unsigned long elapsedTime;
float microFarads;                
float nanoFarads;

void setup()
  pinMode(chargePin, OUTPUT);     
  digitalWrite(chargePin, LOW);  

void loop()
  digitalWrite(chargePin, HIGH);  
  startTime = millis();
  while(analogRead(analogPin) < 648){       

  elapsedTime= millis() - startTime;
  microFarads = ((float)elapsedTime / resistorValue) * 1000;          

  if (microFarads > 1)
    Serial.println(" microFarads");         

    nanoFarads = microFarads * 1000.0;      
    Serial.println(" nanoFarads");          

  digitalWrite(chargePin, LOW);            
  pinMode(dischargePin, OUTPUT);            
  digitalWrite(dischargePin, LOW);          
  while(analogRead(analogPin) > 0){         

  pinMode(dischargePin, INPUT);            




I tested this with several capacitors, one thing I noticed was with a 470uF capacitor the first reading was off, 402uF reported. After that all the readings were about the 470uF mark. In the screen capture above you can see a 226uF reading

I also tested 10uF,  22uf and 47uF capacitors as well and the readings were pretty accurate. You have to factor in that all capacitiors have a level of tolerance


You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More