Introduction: Arduino Inductance/Capacitance/Resistance Meter

Hello such friends, will show you how to create a measuring inductance, capacitance and resistance using Arduino most commonly the ATmega328P, all programming is thrown into Arduino and components commonly found in our laboratory and will also be very cheap to do so, this meter measures pF to nF and also measuring uH and mH, as well as use a 7805 regulator can be powered from 24V to 6V, I used a 9V battery

Step 1: Material

This is the material to be used.

Integrated:
IC ATMEGA 328P (Arduino UNO / Duemilanove)

LM741

LM393

Regulatory L7805CV

LCD 16X2

Crystal 16MHz

Capacitors:

0.33uF

100nF

2 x 22pF

Polyester 1uF

Resistances:

10K potentiometer

7 x 10K

2 x 220 Ohm

1 M

150 Ohm

330 Ohm

Diodes:

1N4004

Connectors:

Terminal Block 2 pin

4 x MOLEX 100 spent 2 pin

4 pin MOLEX spent 100

4 x Borne

2 x switch

2 x push button chasis

Step 2: Code and Performance

As three functions measuring bone capacitance, inductance and resistance, we must choose we want to do, to choose the function and use 2 bits can count 0-0,0-1,1-0,1-1.

So we use two switch to choose, making them function as a dip switch using them as pull down, to measure inductance is 0-0, 0-1 for capacitance, resistance to 1-0, that's how we choose to measure.

To measure inductance use the LM393 comparator to measure the capacitance the LM741, and to measure resistances easily use a 10k resistor and make a voltage divider.

Suppose we want to calculate R1. We know that R2 has a value of 10k, we know that Vin has a value of 5V (which we usually find in the Arduino environment) and that reading on an analog Vout pin of Arduino is 750.

1.- We know that the resolution of the ADC Arduino is 10 bits, which means that 1024 is possible divisions (2 raised to 10) for an input value between 0V and 5V. So if we put 5V on an analog pin, its value will be 1023 (1024 will not remember that starts counting at 0, not 1); if we put 0V on pin, its value will be 0 and if for example we 2.5V its value will be 511.

Therefore, if the value that gives the reading analog pin in its digital value is 750, we can calculate the Vout, the output voltage of the voltage divider.

>> 5V / 1024 divisions = 0,00488V / division

>> 0.00488 volts / division • 750 divisions = 3.66V

2.-We can already clear R1, that was the question:

>> Vout = (R2 / R1 + R2) • Vin

>> 3.66 V = (10k / R1 + 10k) • 5V

>> R1 + 10k = 10k • 5V / 3.66V

>> R1 = (10k • 5V / 3.66V) - 10k = 3.66KΩ

In general, we can calculate the value of R1 as:

>> R1 = (R2 • Vin / Vout) - R2

The same code is in Spanish documentation, so if you have any questions please say so:

#include LiquidCrystal lcd(13, 8, 7, 5, 4, 2);

#define R_1 A1
#define R_2 A2
#define IND_1 6
#define IND_2 12
#define fuente_pin 11
#define switch_pin 10
#define descarga_pin 9

#define PIN_1 A3
#define PIN_2 A4

//Variables leer pines
int pin_1;
int pin_2;

//Variables para inductometro
double pulso;
double frecuencia;
double capacitancia;
double inductancia;

//Capacimetro
float R = 1.0e6;
float C = 0;
float RC = 0;
long t_inicio = 0;
volatile long t_alto = 0;
long T = 0;
float VCC = 4.50;
float Vref = VCC / 2;
float V0 = 0;
float error_correccion = 40.;
int retardo_delay = 20;

//Variables resistometro
int vR_1 = 0;
int vR_2 = 0;
float Vin = 5;
float Vout = 0;
float Res_1 = 10000;
float Res_2 = 9000000;
float r_1 = 0;
float r_2 = 0;
float Resistor_1[8];
float Resistor_2[5];
float ResArreglo_1;
float ResArreglo_2;

void setup() {
lcd.begin(16, 2);

//Configuracion de pines
pinMode(PIN_1, INPUT);
pinMode(PIN_2, INPUT);
//Configuracion Inductometro
pinMode(IND_1, INPUT);
pinMode(IND_2, OUTPUT);
capacitancia = 0.000001021;
//delay(200);
//Configuracion de Resistometro
pinMode(R_1, INPUT);
pinMode(R_2, INPUT);

//Configuracion Capacimetro
attachInterrupt(1, stop, RISING);
Vref = VCC / 2;
pinMode(fuente_pin, OUTPUT);
digitalWrite(fuente_pin, LOW);
pinMode(switch_pin, INPUT);
pinMode(descarga_pin, INPUT);
}

void loop() {
leerpines();

if (pin_1 == LOW && pin_2 == LOW) {
digitalWrite(IND_2, HIGH);
delay(5);
digitalWrite(IND_2, LOW);

delayMicroseconds(100);

pulso = pulseIn(IND_1, HIGH, 5000);
lcd.clear();
if (pulso > 0.1) {
frecuencia = 1.E6 / (2 * pulso);
inductancia = 1. / (capacitancia * frecuencia * frecuencia * 4.*3.1459 * 3.14159);
inductancia *= 1E6;

lcd.setCursor(2, 0);
lcd.print("INDUCTANCIA:");
//delay(200);
if (inductancia >= 1000) {
lcd.setCursor(0, 1);
int valor = (inductancia / 1000) - 0.5;
lcd.print(valor);
lcd.setCursor(6, 1);
lcd.print("mH");
} else {
lcd.setCursor(0, 1);
int valor_2 = inductancia + 10;
lcd.print(valor_2);
lcd.setCursor(6, 1);
lcd.print("uH");
}
} else if (pulso < 0.1) {
lcd.setCursor(2, 0);
lcd.print("INSERTAR IND");
}
delay(300); } if (pin_1 == LOW && pin_2 == HIGH) {
lcd.clear();
for (int i = 0 ; i <= 7; i++) {
Resistor_1[i] = analogRead(R_1);
ResArreglo_1 = ResArreglo_1 + Resistor_1[i];
}
vR_1 = (ResArreglo_1 / 8.0);
Vout = (Vin * vR_1) / 1023;
r_1 = Res_1 * (1 / ((Vin / Vout) - 1));
lcd.setCursor(2, 0);
lcd.print("RESISTENCIA:");
if (r_1 <= 999) {
lcd.setCursor(0, 1);
lcd.print(r_1);
lcd.setCursor(9, 1);
lcd.print("Omhs");
} else if (r_1 >= 1000) {
r_1 = r_1 / 1000;
lcd.setCursor(0, 1);
lcd.print(r_1);
lcd.setCursor(9, 1);
lcd.print("KOmhs");
}
delay(500);
ResArreglo_1 = 0;
} if (pin_1 == HIGH && pin_2 == LOW) {
lcd.clear();
if (debounce(switch_pin) == LOW)
{
pinMode(descarga_pin, OUTPUT);
digitalWrite(descarga_pin, LOW);
delay(100);
pinMode(descarga_pin, INPUT);
digitalWrite(fuente_pin, HIGH);
t_inicio = micros(); } if (t_alto > 0 && t_inicio > 0 && (t_alto - t_inicio) > 0 )
{
T = (t_alto - t_inicio);
RC = -T / log((Vref - VCC) / (V0 - VCC));
//Vref = VCC/2
//V0 = 0V
C = RC / R; //Valor en uF

lcd.setCursor(0, 0);
lcd.print("C:");
lcd.setCursor(3, 0);
lcd.print(C * 1000, 1);
lcd.setCursor(13, 0);
lcd.print("nF");
lcd.setCursor(0, 1);
lcd.print("C:");
lcd.setCursor(3, 1);
lcd.print(C * 1000000 - error_correccion , 0);
lcd.setCursor(13, 1);
lcd.print("pF"); t_inicio = 0;
t_alto = 0; digitalWrite(fuente_pin, LOW);
delay(2000);
}
}
}void leerpines() {
pin_1 = digitalRead(PIN_1);
pin_2 = digitalRead(PIN_2);
}void stop()
{
t_alto = micros();
}int debounce(int pin)
{
int estado;
int previo_estado;
previo_estado = digitalRead(pin);
for (int i = 0; i < retardo_delay; i++)
{
delay(1);
estado = digitalRead(pin);
if ( estado != previo_estado)
{
i = 0;
previo_estado = estado;
}
}
return estado;
}

Step 3: Circuit, Schematic and Pcb

Here you can see how everything is connected in the schematic, I upload files made with EAGLE.

Hope you find it helpful, any questions or comments let him know, greetings.

Comments

author
WilyC1 (author)2017-08-02

amigo la programación me manda muchos errores me puedes ayudara resolverlo porfa

author
jolealca (author)2017-07-18

Thanks Misael

for this great instructable the tester works perfectly

author
jolealca made it! (author)2017-06-09

Saludos Misael

Me da pena molestarte pero definitivamente no he podido resolver este problemita, me le medi a realizar tu maravilloso proyecto pero solo me lee resistencias,no me aparece capacitancia ni inductancia, he revisado punto por punto pero no encuentro nada POR FAVOR AYUDA URGENTE.

I'm sorry to bother you but i have not been able to solve this problem, i
decided to make your wonderful project but i only read resistance,don't appears
capacitance or inductance, i checked point by point, but I do not find anything
PLEASE HELP URGENT

MideResistencia.jpg
author

Te falta seleccionar para que puedas medir capacitores e inductores

author
MauriceN6 (author)2017-04-20

Hello,

Where should the resistor socket be connected to please ? The code uses A1 and A2 but A1 is already used and A2 isn't mentioned in the schematics.

author

Connects to A1

author

Thanks :)

author
RazvanD made it! (author)2017-01-27

Hi, I just want to say thanks for this great instructable. I just finished building it. It is working very good.

In Arduino code #define IND_2 12 is not in concordance with the schematic diagram. I modified it to #define IND_2 14 and it is working great.

Thanks again.

IMG_20170127_195626.jpgIMG_20170127_200120.jpgIMG_20170127_200134.jpgIMG_20170127_200258.jpgIMG_20170127_200347.jpgIMG_20170127_200353.jpgIMG_20170127_200548.jpgIMG_20170127_200939.jpgIMG_20170127_201106.jpgIMG_20170127_201111.jpgIMG_20170127_201215.jpgIMG_20170127_201244.jpgIMG_20170127_201402.jpgIMG_20170127_201444.jpgIMG_20170127_202032.jpgIMG_20170127_202032_2.jpgIMG_20170127_202044_1.jpgIMG_20170127_203857.jpgIMG_20170127_204008.jpgIMG_20170127_204028.jpgThumbs.db3d-1.png3d-2.png
author
QuốcC1 (author)RazvanD2017-02-03

Hi RazvanD !!! Can you tell me, how many H is the maximum that can be measured, and with a coil impedance about 3Kohm, can it measure ?
Thank you so much :)

author

It's great, but I'll say the code is correct, but in the diagram if I'm wrong and do not connect pin 12, the PCB you can see that if it's connected, in the diagram it's like A0 but it's actually pin 12

author

Hi, in my case I used optiloader as a bootloader and made my chip like Arduino Uno, where A0 is pin 14 (in software ) and actualy hardware pin 23 on the chip ( atmega 328P ).

author
manishag14 (author)2017-01-17

I am making LCR meter as college project and I am getting difficulty in interpreting connections. do you have proper circuit diagram of showing all connections. I'll be glad to know your reply which would help me alot.

author

What is the problem you have ?, everything is in the post, the files are at the end of this

author
manjunatharas (author)2016-11-03

How to download the full details of lcr meter

author

Everything is in the post at the end are the files

author
AshokB18 (author)2016-09-22

Hi,

I dont have Eagle software and unable to open the schema/circuit of the LCR meter. Can you upload a pdf

author
gustavio101 (author)AshokB182016-12-04

https://cdn.instructables.com/FNE/RSK7/ICD7FALO/FN...

Here's a picture found in this instructable as well..

author
gustavio101 (author)gustavio1012016-12-04

Same picture with higher resolution.

lc meter hq.png
author
gustavio101 (author)AshokB182016-12-04

https://cadsoft.io/

Here's a link to Eagle, it's free to download and use. The most limitation you will have is the board size. In the free version you will be limited to a certain PCB size (80x100 mm i think).

author
lean04 (author)2015-07-21

very nice instructable, i´ll try to make it soon.

A few questions though: why do you assign 4.5V to VCC, for what i understood the voltage is 5V (is the "factor de correción" for that?).

Another is that you define R_2 with pin A2 but i don't see it connected in the schematic.., similar thing with A0 in the inductance part of the schematic.

I would thank if you could please explain how to operate this meter, i don't quite understand the function of the "pulsador" (hablo español, no me refiero a la traducción sino a para que se utiliza)

El LM393 puede ser reemplazado por el LM358?

Muy buen proyecto.

Saludos

author
Lucman67 (author)lean042016-10-27

@lean04

how you solved those questions?

finally, did you make the LC meter?

author
lean04 (author)Lucman672016-10-30

not yet, i didn't have time. I'll try to do it in the next few months

author

Hola amigo que bueno que hablas español, lo del voltaje si fue como corrección pero puedes cambiarlo a 5V, pero a mi parecer da mejor los valores el LM393 es un comparador de voltaje puedes usar otro pero de las mismas características, este sirve para medir la inductancia, haciendo los cálculos con la frecuencia, y lo de la resistencia como explique para medir la otra resistencia tenemos que hacer un divisor de voltaje, y el pulsador sirve para mostrar y calcular la capacitancia

author

hola, gracias por la respuesta. Si utilizo el LM311, hay que cambiar algún valor en el código?

author

Puedes probar, como solo se usa el comparador derecho del lm393, y el lm311 solo tiene uno, puedes probar y ver que resultados te arroja, y no hay que cambiar nada

author
jtome (author)2016-09-28

Hola, vi que hablas español asi que te hablare en español, es posible medir mayores capacidades? o menores inductancias? gracias

author
Sonal More (author)2016-08-28

what is the use of crystal oscillator, diode 1N4004 in the lcr meter?

and also the use of 4-5 capacitors as well as resistors?

author

The use of crystal is to function arduino off the plate and the diode is for polarity reversal protection

author
Sonal More (author)2016-08-28

Hello
U have not mentioned about how to measure capacitance and inductance please guide us. We are really interested in your fantastic project

About This Instructable

38,109views

71favorites

License:

Bio: Student of Computer Science, Faculty of Sciences, National Autonomous University of Mexico, I like mechatronics and robotics and programming course, my favorite food is pizza ... More »
More by Misael Saenz Flores:Arduino Inductance/Capacitance/Resistance MeterPic Programmer USB[Tutorial]Controlar Brazo Mecanico K-680 con el MSP430G2 y L293D
Add instructable to: