Introduction: How to Measure Capacitance by Using Arduino UNO
Introduction:
Hi everyone, In this tutorial we 'll learn how to measure capacitance of a capacitor by using Arduino UNO.
Capacitance is an object's capability to store an electric charge. Practically,this object is referred to as a capacitor. A capacitor that stores this charge in an electric field between two conductive plates is known as a parallel plate capacitor. The non-conductive material that is between these two plates is known as a dielectric. Dielectrics alter the amount of charge a capacitor can hold and, in practice, what the particular capacitor would be used for (e.g., high-frequency circuits, high voltage circuits, etc.). The calculation for the capacitance of a parallel plate capacitor is: C = ( ε A) / d
Where ε is the permittivity of free space or dielectric, A is the surface area of overlap between the plates, and d is the distance between the plates. An RC (Resistor-Capacitor) circuit has a property known as an "RC Time Constant" or T (Tau). The equation for which is given below: T = RC
Step 1:
Schematic Explanation:
we have two resistors and one capacitor whose value is being measured. two End terminal of Resistance (220and 10k) one is used for changing pin and second pin is used for discharging. the common terminal of resistors is connected to Pin# A0 A/D configuration. as shown in figure.
Step 2:
Components Required:
1) Resistance (220, 10k)
2) capacitor
3) Arduino uno
4) breadboard
Software:
1) Fritzing
2) Arduino IDE
Step 3: Arduino CODE:
Coding:
int analogPin = 0;
int chargePin = 13;
int dischargePin = 11;
int resistorValue = 10000;
unsigned long startTime;
unsigned long elapsedTime;
float microFarads;
float nanoFarads;
void setup() {
pinMode(chargePin, OUTPUT);
digitalWrite(chargePin, LOW);
Serial.begin(9600); }
void loop() {
digitalWrite(chargePin, HIGH);
startTime = millis();
while(analogRead(analogPin) < 648)
{ // Does nothing until capacitor reaches 63.2% of total voltage
}
elapsedTime= millis() - startTime;
microFarads = ((float)elapsedTime / resistorValue) * 1000;
Serial.print(elapsedTime);
Serial.print(" mS ");
if (microFarads > 1) {
Serial.print((long)microFarads);
Serial.println(" microFarads"); }
else {
nanoFarads = microFarads * 1000.0; Serial.print((long)nanoFarads);
Serial.println(" nanoFarads");
delay(500); }
digitalWrite(chargePin, LOW);
pinMode(dischargePin, OUTPUT);
digitalWrite(dischargePin, LOW);
while(analogRead(analogPin) > 0)
{ // Do nothing until capacitor is discharged } pinMode(dischargePin, INPUT); }