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 pinesint pin_1;int pin_2;//Variables para inductometrodouble pulso;double frecuencia;double capacitancia;double inductancia;//Capacimetrofloat 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 resistometroint 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.

<p>Saludos Misael</p><p>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.</p><p>I'm sorry to bother you but i have not been able to solve this problem, i <br>decided to make your wonderful project but i only read resistance,don't appears <br>capacitance or inductance, i checked point by point, but I do not find anything <br>PLEASE HELP URGENT</p>
<p>Hello,</p><p>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.</p>
<p>Connects to A1</p>
Thanks :)
<p>Hi, I just want to say thanks for this great instructable. I just finished building it. It is working very good.</p><p>In Arduino code <strong>#define IND_2 12</strong> is not in concordance with the schematic diagram. I modified it to<strong> #define IND_2 14</strong> and it is working great.</p><p>Thanks again.</p>
<p>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 ?<br>Thank you so much :) </p>
<p>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</p>
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 ).
<p>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.</p>
<p>What is the problem you have ?, everything is in the post, the files are at the end of this</p>
<p>Everything is in the post at the end are the files</p>
<p>Hi,</p><p>I dont have Eagle software and unable to open the schema/circuit of the LCR meter. Can you upload a pdf</p>
<p><a href="https://cdn.instructables.com/FNE/RSK7/ICD7FALO/FNERSK7ICD7FALO.LARGE.jpg" rel="nofollow">https://cdn.instructables.com/FNE/RSK7/ICD7FALO/FN...</a></p><p>Here's a picture found in this instructable as well..</p>
<p>Same picture with higher resolution.</p>
<p><a href="https://cadsoft.io/" rel="nofollow">https://cadsoft.io/</a></p><p>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).</p>
<p>very nice instructable, i&acute;ll try to make it soon. </p><p>A few questions though: why do you assign 4.5V to VCC, for what i understood the voltage is 5V (is the &quot;factor de correci&oacute;n&quot; for that?).</p><p>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.</p><p>I would thank if you could please explain how to operate this meter, i don't quite understand the function of the &quot;pulsador&quot; (hablo espa&ntilde;ol, no me refiero a la traducci&oacute;n sino a para que se utiliza)</p><p>El LM393 puede ser reemplazado por el LM358?</p><p>Muy buen proyecto.</p><p>Saludos</p>
<p>@lean04 </p><p>how you solved those questions?</p><p>finally, did you make the LC meter?</p>
<p>not yet, i didn't have time. I'll try to do it in the next few months </p>
Hola amigo que bueno que hablas espa&ntilde;ol, lo del voltaje si fue como correcci&oacute;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&iacute;sticas, este sirve para medir la inductancia, haciendo los c&aacute;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
<p>hola, gracias por la respuesta. Si utilizo el LM311, hay que cambiar alg&uacute;n valor en el c&oacute;digo?</p>
<p>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</p>
<p>Hola, vi que hablas espa&ntilde;ol asi que te hablare en espa&ntilde;ol, es posible medir mayores capacidades? o menores inductancias? gracias</p>
<p>what is the use of crystal oscillator, diode 1N4004 in the lcr meter?</p><p>and also the use of 4-5 capacitors as well as resistors?</p>
The use of crystal is to function arduino off the plate and the diode is for polarity reversal protection
Hello <br>U have not mentioned about how to measure capacitance and inductance please guide us. We are really interested in your fantastic project