Coil or Inductor Meter With Arduino and OLED Display

by CarlosVoltT in Circuits > Arduino

88 Views, 2 Favorites, 0 Comments

Coil or Inductor Meter With Arduino and OLED Display

IMG_20220626_210520790-820x461.jpg

In this tutorial we will see how to create an inductor meter with an Arduino Nano, an OLED display and other electronic components.

More info and updates in https://rogerbit.com/wprb/2022/06/medidor-inductores/

In this tutorial we will see how to create an inductor meter with an Arduino Nano, an OLED display and other electronic components. We will build the circuit which includes the printed circuit, we will analyze the source code, and finally we will test its operation, coils or inductors from Wurth Electronics.

In this circuit whose main component is an Arduino nano, to control the OLED display, measure and calculate the value of a coil or inductor, whose value is unknown, this is an economical meter with quite good precision, as we could see in the video shown above.

The coil or inductor is a passive component made of an insulated wire that, due to its shape (coiled wire coils), stores energy in the form of a magnetic field, by a phenomenon called self-induction. The inductor is different from the capacitor, which stores energy in the form of an electric field.

Many times when disassembling a board, to extract its components, or repair them, we find inductors that do not have a reference on the component's silkscreen that allows us to identify it, this is why this device can become a great ally when repairing or extracting this type of electronic components.

Inductors or coils are measured in a unit called Henri, whose symbol is represented by the letter H. For our meter we will show on the display two sub-multiples of this unit with the mH (milli Henri) and the uH (micro Henri).

The device is based on the measurement of an LC (Inductor/Capacitor) oscillator circuit. These two components are connected in parallel, and a voltage pulse is applied to this LC circuit for a certain time. It will begin to oscillate at a frequency determined by the value of these two components, this is known as resonance frequency.

We are going to apply a 5 volt voltage pulse to the LC circuit. We charge the LC circuit for a while and then return to 0 volts. The pulse will cause the circuit to resonate creating a sinusoidal signal, which will attenuate over time, due to the internal resistance of the circuit itself, it will oscillate at the resonance frequency depending on the values ​​of the inductor and capacitor. We are going to use the arduino to obtain the frequency and with the following formula applied in the arduino source code, it will allow us to know the value of the inductor whose value is unknown.

This meter has a range of approximately 80 uH to 3oooo uH


Electronic components

A 1 Kohm resistor

A 1N4007 Diode


A 2.2 uF polyester capacitor


A 14 pin socket


A 150 Ohm resistor


A 330 Ohm resistor


Arduino Nano


The Arduino Nano is a small, full-featured, breadboard-compatible board based on the ATmega328 (Arduino Nano 3.x). It has more or less the same functionality as the Arduino Duemilanove, but in a different package. It only lacks a DC power connector and is powered by a Mini-B USB cable instead of a standard one.

OLED display sh1106

This is a 128x64 dot monochrome OLED display module with I2C interface. It has several advantages over LCD displays, such as high brightness, very good contrast, a wider viewing angle, and low power consumption. It is compatible with Arduino Rasberry Pi and PIC microcontrollers among others. It works with logic levels from 3.3V to 5V and has a viewing angle greater than 160 degrees. The screen size is 1.3 inches. It is powered by a voltage of 3.3V to 5V. It can be used in applications such as smart watches, MP3, thermometers, instruments, and various projects, etc.

Bookshop

U8glib

Characteristics

  • Interface: I2C (3.3V / 5V logic level)
  • Resolution: 128 x 64
  • Angle of view: >160 degrees
  • Display color: Blue
  • Display size: 1.3 inch
  • Driver IC: SH1106
  • Power supply: DC 3.3V~5V
  • Operating temperature: -20~70'C
  • Application: smart watch, MP3, thermometer, instruments, DIY projects, etc.

A 5mm LED diode

An LM339 integrated circuit


LM339 comparator details

The LM339N is widely used in signal generation, signal modulation, signal detection, and other applications and is an essential analog block in many circuits. This comparator is designed for use in level detection, low level detection, and memory applications, industrial and consumer automotive electronics applications.

The LM339N has a very simple operation, for example, this circuit internally integrates four operational amplifiers, depending on the application and the arrangement you want to apply with the LM339N will be the function you will have, some of the applications are:

1 - Instrumentation amplifier.2 - Voltage follower for impedance coupling.3 - Comparator.4 - Current to voltage converter.5 - Differential amplifier.

Characteristics

  • Wide range of supply voltages: 2v – 36v, or ±1V – ±18V
  • Low consumption, only 800 uA, independent of the power supply
  • Input voltage range is equal to the supply voltage
  • Output compatible with TTL, DTL, ETC, MOS and CMOS technologies

Applications of the LM339 comparator

• Digital multimeters.• Motor control.• Transducer interfaces.• Data acquisition systems.• Industrial control processes.• Televisions and home theaters.

Female pins

A socket for the arduino nano


A PCB


Download free gerber file —> coil gauge


Circuit




Source Code

#include "U8glib.h"//Librería para el control del display oled

U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);// I2C / TWI // Se habilita esta linea según el display a usar en este caso el driver SH1106

double IPulso, frequency, capacitor, valormH, valoruH, inductance;

int muestras = 250;

const int pulsoEntrada = 11;

const int pulsoSalida = 12;

void setup()

{

Serial.begin(9600);

pinMode(pulsoEntrada, INPUT);// Lectura del pulso de entrada

pinMode(pulsoSalida, OUTPUT);// Carga de la circuito resonante LC

delay(2000);

}

void loop()

{

valoruH = lectura();

valormH = valoruH / 1000;

//Muestra el valor en mH en el terminal serial

Serial.print("Valor: ");

Serial.print(valormH);

Serial.println(" mH");

//Muestra el valor en uH en el terminal serial

Serial.print("Valor: ");

Serial.print(valoruH);

Serial.println(" uH");

delay(1);

//Display

u8g.firstPage();

do {

draw();//Llama a la función draw

} while( u8g.nextPage() );



}

//Funcion

double lectura()

{

double sumaInductancia = 0;

for (int contador = 0; contador < muestras ; contador++)

{

digitalWrite(pulsoSalida, HIGH);

delay(5);// Tiempo para cargar la bobina.

digitalWrite(pulsoSalida, LOW);

delayMicroseconds(100);// verificar que mide la resonancia.

IPulso = pulseIn(pulsoEntrada, HIGH, 5000);//Transcurrido este tiempo pulsein devuelve un varlor 0

if (IPulso > 0.1)

{

capacitor = 2.12E-6;// Medir la capacidad del capacitor para mayor presición y cambiar ese valor obtenido

frequency = 1.E6 / (2 * IPulso);

inductance = 1. / (capacitor * frequency * frequency * 4.*3.14159 * 3.14159);

inductance = inductance*1E6;

sumaInductancia += inductance;

}

}

return (sumaInductancia / muestras);

}

//Función para mostrar los datos en el display

void draw(void) {

//Imprimimos en pantalla el valor de la inductancia en henrios obtenida en unidad en mH y uH

u8g.setFont(u8g_font_unifont);

u8g.setPrintPos(0, 20);

u8g.print("Valor Inductor");//

//Muestra el valor mH

u8g.setPrintPos(0, 40);

u8g.print("mH: ");//

u8g.setPrintPos(25, 40);

u8g.print(valormH);

//Muestra el valor uH

u8g.setPrintPos(0, 60);

u8g.print("uH: ");

u8g.setPrintPos(25, 60);

u8g.print(valoruH, 0);

}