English
Español
PCBWAY PCB service

PCBWAY PCB service

PCBONLINE PCB service






Gearbest Creality3D CR - 10 3D Desktop DIY Printer
Creality3D CR - 10 3D Desktop DIY Printer only $426.23


Gearbest Hubsan H501S X4 Brushless Drone - Advanced Version
Hubsan H501S X4 Brushless Drone - Advanced Version only $335.60


Gearbest HawKeye Firefly 8S 4K Sports Camera No Distortion Version
HawKeye Firefly 8S 4K Sports Camera No Distortion Version only $141.99

Arduino multimeter BASIC


Resistance meter with arduino
Capacitance meter with arduino
Current meter with arduino
Inductance meter with arduino


Inductance meter


Un vídeo publicado por ELECTRONOOBS (@electronoobs) el


You need to measure inductance but you don't have any multimeter to do that or not even an osciloscope to observe the signal. Well here we are going to build a very cheap and easy inductance meter using the Arduino microcontroller. This method is accurate with a scope from 80uH to 30,000uH, but it should work for inductors a bit smaller or much larger. First let's take a look at what we need to buy for this project:

One Arduino NANO or UNO
LM339 Comparator
Two 1uF non polar capacitors
One 150 ohms resistor
One 330 ohms resistor
One diode (1N4001)
One LCD with i2c


An inductor in parallel with a capacitor is called an LC circuit, and it will electronically "ring" like a bell. Well regardless of the frequency or how hard a bell is struck, it will ring at it’s resonating frequency. We will electronically strike the LC bell, wait a bit to let things resonate, then take a measurement. There is some internal resistance so this is really an RLC circuit, and I’ll talk about this more in the math.

Now micro controllers are terrible at analyzing analog signals. The ATMEGA328 ADC is capable of sampling analog signals at 9600hz or .1ms, which is fast but no where near what this project requires. Let’s go ahead and use a chip specially designed for turning real world signals into basic digital signals: The LM339 comparator which switches faster than a normal LM741 op amp, but there will be a schematic for the LM741 too.

As soon as the voltage on the LC circuit becomes positive, the LM339 will be floating, which can be pulled high with a pull up resistor. When the voltage on the LC circuit becomes negative, the LM339 will pull its output to ground. I’ve noticed that the LM339 has a high capacitance on it’s output, which is why I used a low resistance pull up.

So what we will do is applying a pulse signal to the LC circuit. In this case it will be 5 volts from the arduino. We charge the circuit for some time. Then we change the voltage from 5 volts directly to 0. That pulse will make the circuit to resonate creating a cushioned sinusoidal signal oscilating at the resonant frecuency. What we need to do is to measure that frecuency and later using the formulas obtain the inductance value. We will use the arduino to measure the frecuency and calculate the value. The resonant frecuency is related with the next ecuation:



So we could obtain the L value because we know the F frecuency that we've just measured and we also know the values f the C capacitor because it's a component that we've selected. All we need is to obtain L from this ecuation.



Since our wave is a true sinusoidal wave, it spends equal time above zero volts and below zero volts. This means that the comparator will turn it into a square wave with a duty of 50%, and pulseIn(pin, HIGH, 5000); will measure the time in microseconds elapsed from rising edge to falling edge. This measurement can then be doubled to get the period and the inverse of the period is the frequency. Since the circuit is resonating, this frequency is the resonating frequency.

Above are the equations where F is the resonating frequency, C is capacitance, and L is inductance. Solving for inductance will result in the seacond equation



Since this is an RLC circuit due to internal resistance, it won’t change any characteristics of the resonating frequency. The RLC will still resonate, but the amplitude will die out. With a low resistance the RLC will tend to latch onto the exact resonating frequency quicker. For you EE’s think of the frequency response of an RLC with low resistance versus high resistance.




The circuit





So we apply a pulse of 5 volts to the LC circuit with the Arduinp pin (D13) for a while. After that we stop the pulse and the circuit wil resonate. The comparator will give a square signal output with the same frecuency which the arduino will measure using the pulsein function measureing the time between each pulse of the square wave. We do the mathematics and print the obtained valeue to the LCD screen.



The next schematic is the one that we will use with the Arduino and the LCD with the i2c comunication. Build the next schematic and upload the code and start measureing inductance.



We have to supply the LM339 comparator with 5 volts. Connect GND to pin 12 of the LM339 and 5 volts to pin 3. We will use the comparator input 2. The negative input will be pin 6 of the LM339 and the positive pin 7. The output is pin 1 which is the pin marcked with a black dot. The pin number increase counterclockwise. Connect the comparator output to the pin D11 of the arduino. Connect the pin D13 from the microcontroller through a 150 ohms resistor and a diode to the LC circuit. Upload the next code and start measuring.


You can download the i2c Lyquid crystal library here
liquid crystal library
To install it we just go to Sketch -> Include library and we open the .zip file that we've just downloaded.







The code


Download the code here or copy it from below:
arduino inductance meter code


/*Thanks. Remember to visit my Youtube channel
  If you don't whant to Serial print the valeus just delete the serial. print lines
  and leave just the LCD print ones.
  I've used a i2c LCD screen module. 
*/
//LCD config
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3f,20,4);  //sometimes the adress is not 0x3f. Change to 0x27 if it dosn't work.

//13 is the input to the circuit (connects to 150ohm resistor), 11 is the comparator/op-amp output.
double pulse, frequency, capacitance, inductance;
void setup(){
  lcd.init();
  lcd.backlight();
  Serial.begin(115200);
  pinMode(11, INPUT);
  pinMode(13, OUTPUT);
  Serial.println("Why hello!");
  delay(200);
}
void loop(){
  digitalWrite(13, HIGH);
  delay(5);//give some time to charge inductor.
  digitalWrite(13,LOW);
  delayMicroseconds(100); //make sure resination is measured
  pulse = pulseIn(11,HIGH,5000);//returns 0 if timeout
  if(pulse > 0.1){ //if a timeout did not occur and it took a reading:
    
    
  #error insert your used capacitance value here. Currently using 2uF. Delete this line after that
  capacitance = 2.E-6; // - insert value here
  
  
  frequency = 1.E6/(2*pulse);
  inductance = 1./(capacitance*frequency*frequency*4.*3.14159*3.14159);//one of my profs told me just do squares like this
  inductance *= 1E6; //note that this is the same as saying inductance = inductance*1E6

  //Serial print
  Serial.print("High for uS:");
  Serial.print( pulse );
  Serial.print("\tfrequency Hz:");
  Serial.print( frequency );
  Serial.print("\tinductance uH:");
  Serial.println( inductance );
  delay(10);

  //LCD print
  lcd.clear();
  lcd.setCursor(0,0); 
  lcd.print("Inductance:");
  lcd.setCursor(0,1); 
  lcd.print(inductance);
  lcd.setCursor(14,1); 
  lcd.print("uH");          
  delay(10);
  }
}