You can upload instructions on how to make this nifty, simple, and accurate capacitance meter right here! I used an Arduino Nano board, and an OLED display. You can adapt it if need be!

Have a look through the pdf. If you have any questions or comments, contact me here. (PS: To copy the code that’s in the pdf, it’s best to actually download the file, rather than view it in your browser and trying to copy the code that way).

Here’s the PDF link on this site …..Enjoy.

Capacitance Meter Arduino Code UPDATED on 5th February 2021 … download the updated version below.

OR

Select and Copy the Arduino code only, if you already have the schematic in the pdf above. It also includes the code below.

// Autoranging Capacitance Meter … adapted from:
// https://create.arduino.cc/projecthub/mircemk/diy-simple-autorange-capacitance-meter-10pf-10000microf-e6e797
// I’m not using the same display, so display code changed up….. Also added other stuff such as screen
// printing of nF readings into mfd readings, cleaned up variables, and try to make this meter a bit more
// user friendly on-screen! ……… Durhamwilly. This project’s code and schematic resides as a pdf for download at:
// https://durhamwilly.ca/capacitance-meter-autoranging/

//////////////////////////////////////////Usage Notes: //////////////////////////////////////////////
// 1.) Each time the meter is turned on, a calibration occurs, so it’s important that you do not
// have a capacitor connected to the test leads when turning the unit on.
// This calibration only needs to take place once, so if you are testing a few capacitors,
// you are fine after allowing the initial calibration on start-up.
// 2.) You must also discharge capacitors before testing.
// 3.) When testing, smaller value capacitors readings happen quickly.
// Large capacity ones make the top part of the OLED appear to go blank, until the capacitor has
// charged sufficiently to give you a reading.
// 4.) When making your circuit, use the most accurate tolerance resistors you have! I used Gold – 5%
// 5.) Your power supply can be anything from 5V to 9V, and the accuracy seems to be just fine..
// 6.) Meter is NOT polarity sensitive when testing capacitors
/////////////////////////////////////////////////////////////////////////////////////////////////////

// Wiring of “test lead” Pins (but see schematic!): //////////
// A0 to capacitor probe 1 via a 10K resistor.
// D7 to capacitor probe 1 via a 1K resistor.
// D8 to capacitor probe 1 via a 1Meg resistor.
// GRN to capacitor probe 2

// Display Pins SSD1306: ///////////////
// Arduino A4 to SDA on SSD1306
// Arduino A5 to SCK on SSD1306
// Arduino GND Pin to GND on SSD1306
// Arduino 5V Pin to VCC on SSD1306

// Arduino Board Power: //////////////
// Arduino GND pin to – 9VDC
// Arduino VIN pin to + 9VDC …. I used a standard 9V battery for power.
// You can also power this with the Mini USB cable,
// which you obviously will need to do in order to upload this code!

#include <Arduino.h>
#include <U8g2lib.h>
#include <SPI.h>
#include <Wire.h>

U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0); // set up the SSD1306 OLED display

void setup(){
pinMode(A0,INPUT);
Serial.begin(9600);
u8g2.begin();
}

unsigned long time0,time1,time2;
float capacitance;
byte kn,mk,i;

void loop(){

if(mk==0){
pinMode(8,OUTPUT);
pinMode(7,INPUT);
digitalWrite(8,HIGH);
}

if(mk==1){
pinMode(7,OUTPUT);
pinMode(8,INPUT);
digitalWrite(7,HIGH);
}

time0=micros();
while(analogRead(A0)<644){
time2=micros()-time0;
if(time2>=1000000 && mk==0){
mk=1;
time0=100000000;
break;
}
}

time1=micros()-time0;

while(analogRead(A0)>0){
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
}

if(mk==1&&time1<1000){
mk=0;
}

capacitance=time1;
capacitance=capacitance/1000;

if(time1>=10000000){

u8g2.setFont(u8g2_font_6x12_tf); // set font
// cursor position (L to R, Row)
u8g2.setCursor(3,30);
u8g2.print(“~ CAPACITOR READING ~”); // write to the internal memory
u8g2.sendBuffer(); // transfer internal memory to the display
}
else{

/////////// screen printout //////////////////
u8g2.setFont(u8g2_font_6x12_tf); // set font
u8g2.setCursor(3,30);
u8g2.print(“~ CAPACITOR READING ~”); // write to the internal memory
u8g2.sendBuffer(); // transfer internal memory to the display
///////////////////////////////////////////////////////////

if(mk==0){

u8g2.setFont(u8g2_font_ncenB10_tr); // set font
// cursor position (L to R, Row)
u8g2.setCursor(0,15); // set cursor position
if(capacitance>.5){ // only display if capacitor is under test.
u8g2.print(capacitance); // print value with decimal places, as capacitance variable is a float, not an int.
u8g2.print(” nF / “);
}
else{
u8g2.setFont(u8g2_font_ncenB10_tr); // set font
u8g2.print(“Insert Capacitor “);
}

u8g2.setFont(u8g2_font_ncenB10_tr); // set font
// now also display the nF reading in mfd’s for us old guys
u8g2.print(capacitance/1000); // ( microfarads = nanofarads ÷ 1,000 )
u8g2.print(” uF”);
u8g2.sendBuffer(); // transfer internal memory to the display
delay(2000);
u8g2.clearBuffer(); // clear the internal memory
}
if(mk==1){
u8g2.setFont(u8g2_font_ncenB10_tr); // set font
u8g2.setCursor(30,15); // set cursor position
u8g2.print(capacitance); // print capacitance value
u8g2.print(” uF “);
u8g2.sendBuffer(); // transfer internal memory to the display
delay(2000);
u8g2.clearBuffer(); // clear the internal memory

}
}
}