Arduino capacitance meter

I fancied trying the , 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 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);            



arduino capacitance output
arduino capacitance output

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.

We’ll play about with this in future articles

  • Facebook
  • Twitter
  • Linkedin
  • Pinterest
This div height required for enabling the sticky sidebar
Ad Clicks : Ad Views : Ad Clicks : Ad Views :