In this project, I will show you an Arduino-based capacitance meter which can measure specific values of capacitors. A capacitor is an electrical component that stores electric charge and this capacity of the capacitor to store the electric charge is known as its capacitance. With the assistance of a capacitance meter, we can measure the rate of the charge stored in the capacitor, we can get the capacitance of the capacitor.
Basic Digital Multimeters can’t measure the capacitance and so to discover the capacitance, you either need to go for a progressed, costly digital multimeter or locate a devoted capacitance module.
The committed capacitance meters frequently accompany a wide scope of estimations of various boundaries like capacitance, inductance, resistance, hFE of a transistor, and so on.
In this project, we will attempt to build a simple Arduino-based capacitance meter for two distinct scopes of capacitances. One circuit will be utilized to measure capacitance in the scope of 1µF to 4700µF. The other circuit will be utilized to measure lower capacitance for example in the scope of 20pF to 1000nF.
Must Read Top Arduino Projects
Note In the event that you need to measure the capacitance from an old circuit or board, be cautious as a capacitor in working condition may store charge regardless of whether the supply is removed. Release the capacitor appropriately before contacting it.
Project
Capacitance Meter (1µF to 4700µF)
Circuit Diagram
Components Required
- Arduino Nano
- 16×2 LCD Display
- I2C Module (Optional)
- Resistor (220Ω, 10KΩ)
- 10KΩ Variable Resistor
- 5V Power Supply
Working Principle of Capacitance Meter (1uF to 4700uF)
So as to measure the capacitance in the scope of 1 µF to 4700 µF, we need to utilize the above circuit. Before clarifying the work of the project, we will initially observe the principle behind this technique for capacitance measurement.
The principle behind this capacitance meter lies in one of the essential properties of the capacitor: The Time Constant. Time Constant (τ) is characterized as the time taken to charge a capacitor (C) through a resistor (R) to arrive at 63.2 % of the most extreme supply voltage.
On the other hand, the Time Constant (τ) of a capacitor can also be characterized as the time taken by a fully charged capacitor C to discharge to 36.8 % of its extreme voltage through a resistor R.
Smaller capacitors will have less time constant as they set aside less time to charge. Correspondingly, higher capacitors will have higher time constants.
Time Constant τ = R x C (τ = RC)
Here, τ is the time constant of the capacitor in second (s), C is the capacitance of the capacitor in farads (F) and R is the resistance of the resistor in ohms (Ω).
The above circuit and diagram will show you the time constant curvature for a capacitor C, charging to supply voltage V through a resistor R.
We utilize a similar idea in our Arduino-based Capacitance Meter. we will charge an unknown capacitor through a known resistance utilizing Arduino and compute the time that it takes to arrive at 63.2 % of the supply voltage (3.1V roughly). In view of the time, I can compute the capacitance from the formula-
C=τ/R
We will utilize a 10 KΩ resistor to charge the capacitor and a 220 Ω resistor to discharge. The charging and discharging pins of the Arduino are pin 8 and pin 9 individually. The voltage over the capacitor is estimated utilizing the Analog input pin A0.
At first, we will discharge the capacitor using digital pin 9 to ensure that the capacitor has no charge. we will at that point start the clock and charge the capacitor using charging pin 8.
Presently, we need to screen the voltage over the capacitor at the Analog pin and once it arrives at 63.2% of 5V (roughly 648 from the Analog pin), we need to stop the clock and figure out the capacitance.
This circuit is reasonable for nearly higher capacitance as we can plainly measure the time constant. For smaller capacitance, this circuit probably won’t be appropriate.
Arduino Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | #include <LiquidCrystal.h> //#include <Wire.h> //for LCD I2C Module //#include <LiquidCrystal_I2C.h> //LiquidCrystal_I2C lcd(0x27, 16, 2); LiquidCrystal lcd(7, 6, 5, 4, 3, 2); //for LCD without I2C Module int charge = 8; int discharge = 9; int analogPin = A0; unsigned long start_timer=0; unsigned long stop_timer=0; unsigned long duration=0; float voltage=3; float answer=0.0; int measure (void); void setup() { Serial.begin(9600); // lcd.init(); //for LCD with I2C Module // lcd.backlight(); lcd.begin(16, 2); //for LCD without I2C Module lcd.print("1uF to 4700uF"); lcd.setCursor(0,1); lcd.print("Place Capacitor "); pinMode(discharge,INPUT); pinMode(charge,OUTPUT); digitalWrite(charge,HIGH); } void loop() { while(measure()>=1010 && measure()<=1030) { lcd.setCursor(0,1); lcd.print("Place Capacitor "); delay(200); lcd.setCursor(0,1); lcd.print(" "); delay(200); } delay(2000); lcd.setCursor(0,1); lcd.print(" "); while(1) { pinMode(charge,INPUT); pinMode(discharge,OUTPUT); digitalWrite(discharge,LOW); lcd.setCursor(0,1); lcd.print("Discharging"); while(voltage>2.0) { voltage=measure(); delay(100); lcd.setCursor(12,1); answer=voltage * (99.0 / 1023.0); lcd.print((99-answer),0); lcd.setCursor(14,1); lcd.print("%"); } lcd.setCursor(0,1); lcd.print(" "); delay(1000); lcd.setCursor(0,1); lcd.print("Charging"); lcd.setCursor(13,1); lcd.print("%"); pinMode(discharge,INPUT); pinMode(charge,OUTPUT); digitalWrite(charge,HIGH); start_timer=micros(); while(measure()<648) { lcd.setCursor(9,1); lcd.print(measure()*(100.0/1023.0),1); } stop_timer=micros(); duration=stop_timer-start_timer; answer=duration/10000; lcd.clear(); // lcd.setCursor(0,1); // lcd.print(" "); lcd.setCursor(0,0); lcd.print("Value = "); lcd.print(answer); lcd.print("uF"); delay(3000); while(1) { lcd.setCursor(0,1); lcd.print("Press Reset"); delay(200); lcd.setCursor(0,1); lcd.print(" "); delay(200); } } } int measure (void) { int value; value=analogRead(analogPin); return value; } |
Capacitance Meter (20pF to 1000nF)
Project
Circuit Diagram
Components Required
- Arduino Nano
- 16×2 LCD Display
- I2C Module (Optional)
- 10KΩ Variable Resistor
- 5V Power Supply
Working Principle of Capacitance Meter (20pF to 1000nF)
For estimating smaller capacitances, we will utilize an alternate idea. For this, we have to study the inner structure of the ATmega328P chip.
All the I/O ports in the ATmega328P microcontroller have an internal pull-up resistance and an internal capacitance associated between the pin and ground.
Here, Ct is the capacitor under test, and Ci is the internal capacitance of the Arduino. We need not stress over the internal capacitor and its range can be between 20 pF to 30 pF. The unknown capacitor is associated with Analog pin A2 and pin A0. Here, A2 goes about as the charging pin, and A0 goes about as the discharging pin.
At first, we will charge the unknown capacitor by setting A2 as HIGH and measure the voltage at A0 from the following equation.
Voltage V(A0) = (VA2 X Ct)/(Ct+Ci)
Yet, we definitely know the voltage at A0 with the assistance of the Analog read function. Subsequently, utilizing that value in the above condition, we can get the unknown capacitance as follows
Ct = (Ci X VA0)/(VA2-VA0)
Arduino Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | #include <LiquidCrystal.h> //#include <Wire.h> //for LCD I2C Module //#include <LiquidCrystal_I2C.h> //LiquidCrystal_I2C lcd(0x27, 16, 2); LiquidCrystal lcd(7, 6, 5, 4, 3, 2); //for LCD without I2C Module const int analog_charge = A2; const int analogPin = A0; float ck=24.42; int voltage; float cu; void setup() { Serial.begin(9600); // lcd.init(); //for LCD with I2C Module // lcd.backlight(); lcd.begin(16, 2); //for LCD with I2C Module lcd.print(" 20pF to 1000nF "); lcd.setCursor(0,1); lcd.print("Place Capacitor "); pinMode(analogPin,OUTPUT); pinMode(analog_charge,OUTPUT); } void loop() { abc: pinMode(analogPin,INPUT); digitalWrite(analog_charge,HIGH); voltage=analogRead(analogPin); digitalWrite(analog_charge,LOW); //analog_charge = 998 || 999 || 1000 || 1001 and ! 1024 pinMode(analogPin,OUTPUT); if(voltage<1000) { cu=((ck*voltage)/(1024.0-voltage)); if(cu>20.0) { lcd.setCursor(0,1); lcd.print(" "); lcd.setCursor(0,1); lcd.print(cu,2); lcd.print("pF"); } else { lcd.setCursor(0,1); lcd.print("Place Capacitor "); delay(200); lcd.setCursor(0,1); lcd.print(" "); delay(200); goto abc; } } else { voltage=0; pinMode(analogPin,OUTPUT); delay(1); pinMode(analog_charge,INPUT_PULLUP); unsigned long start_time = micros(); unsigned long final_time=0; while((voltage < 1) && (final_time < 400000L)) { voltage = digitalRead(analog_charge); unsigned long stop_time = micros(); final_time = stop_time > start_time ? stop_time - start_time : start_time - stop_time; } pinMode(analog_charge, INPUT); voltage = analogRead(analog_charge); digitalWrite(analogPin, HIGH); int delay_T = (int)(final_time / 1000L) * 5; delay(delay_T); pinMode(analog_charge, OUTPUT); digitalWrite(analog_charge, LOW); digitalWrite(analogPin, LOW); cu = -(float)final_time / 34.8 ; cu /= log(1.0 - (float)voltage / (float)1023); if(cu < 1000.0) { lcd.setCursor(0,1); lcd.print(" "); lcd.setCursor(0,1); lcd.print(cu,2); lcd.print("nF"); } else { lcd.setCursor(0,1); lcd.print(" "); lcd.setCursor(0,1); lcd.print("Error"); } } delay(1000); } |
Advantage
- It is a basic Arduino-based Capacitance Meter with extremely fewer equipment necessities.
- The task can be utilized to measure any capacitance inside the scope of 20 pF to 4700 µF.
Disadvantage
- The results probably won’t be exact.
Application of Capacitance Meter
- A capacitance meter can be utilized to calculate the capacitance of unknown capacitors.
- Utilizing Arduino for Capacitance Meter makes it simple to actualize the project and with slight adjustments, the circuit can be made for a wide scope of capacitors.
Extremely sorry for that issue in that schematic and pcb Gerber. There should be connected with A0 pin. I will update it soon. Thank you for informing me
Dear Designer, a question to the 1st circuit (range 1u…). The charge and discharge method is clear via the digital pins D8 and D9. But what do you measure with the analog pin A0? It is not connected, neither in the schematic, nor in the gerbers.