## Introduction: Arduino Capacitance Meter

We have a cost-effective capacitance meter to measure capacitance using Arduino.

## Supplies

**Hardware Components**

Arduino Uno

555 timer IC

IC 74HC14 Schmitt trigger gate

Resistor 1k ohm

Resistor 10k ohm

Capacitor 100 nF

Capacitor 1000 µF

LCD - 16x2

## Step 1: About Project

**555 Timer IC**

The output signal frequency relies on R1, R2 resistors, and capacitor C1. The equation is given as,

Frequency (F) = 1/ (Time period) = 1.44/ ((R1+R2*2)*C1). By placing the resistance and capacitance values in the equation we will see the frequency of output square wave.

Frequency (F) = 1/ (Time period) = 1.44/ (21000*C). From the above formula, we can find out the capacitance Capacitance C = 1.44/ (21000*F)

The Uno has a specific function pulseIn, which allows us to ascertain the positive state duration or negative state duration of a precise rectangular wave. After connecting the unknown capacitor to the 555 timer circuit which generates a square wave output and whose frequency is instantly associated with the capacitance of the capacitor.

This signal is provided to UNO through the Schmitt Trigger gate. The UNO estimates the frequency. Using this frequency we program the UNO to estimate the capacitance with the above formula.

Learn more about **IoT Course** which will helps to build **IoT projects**.

## Step 2: Run a Program

#include

LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

int32_t Htime; int32_t Ltime; float Ttime; float frequency; float capacitance;

void setup() { pinMode(8,INPUT); //pin 8 as signal input lcd.begin(16, 2); lcd.setCursor(0,0); lcd.print("capacitance ="); } void loop() { for (int i=0;i<5;i++) //measure time duration five times { Ltime=(pulseIn(8,HIGH)+Ltime)/2; //get average for each cycle Htime=(pulseIn(8,LOW)+Htime)/2; }

Ttime = Htime+Ltime; frequency=1000000/Ttime; capacitance = (1.44*1000000000)/(20800*frequency); //calculating the Capacitance in nF lcd.setCursor(0,1); lcd.print(capacitance); lcd.print(" nF "); delay(500); }

## Comments