I recently found myself wanting to wind my own toroidal inductor. Unfortunately I had no datasheet on the toroid cores I had purchased from Amazon: uxcell 22mm x 14mm x 8mm Power Transformer Ferrite Toroid Cores Green 10 Pcs
A while back I had tried to measure an air conditioner capacitor and ended up doing it with an Arduino, so I thought maybe a similar trick might work for inductors. It turns out it is slightly more complicated with an inductor. I based my work off of this blog post: https://reibot.org/2011/07/19/measuring-inductance/
The comments stated that it may work with the built in comparator of the Arduino instead of the LM339. My variant is as follows:
R1 is 150 ohms, but the value isn’t necessarily critical.
Powered over USB and outputs to the serial terminal. It only takes a few minutes to put together and the only parts required are a resistor, a diode, and a 2.2 uF cap. You can use another value if you want and the range of measurement will change. You will also have to edit the source code to match.
//this is based on a measurement technique from
//reibot.org, the parts count has been reduced by using the avr internal comparator
double pulse, frequency, capacitance, inductance;
bool detected = false;
int sample = 0;
ADCSRB = 0; // (Disable) ACME: Analog Comparator Multiplexer Enable
ACSR = bit (ACI) // (Clear) Analog Comparator Interrupt Flag
| bit (ACIE) // Analog Comparator Interrupt Enable
| bit (ACIS1); // ACIS1, ACIS0: Analog Comparator Interrupt Mode Select (trigger on falling edge) AIN0 is D6 AIN1 is D7
timeStamp[sample] = micros();
if(sample < 3)
delay(5);//give some time to charge inductor.
///comparator stuff here
pulse = 0;
sample = 0;
if(sample < 2)
pulse = (timeStamp-timeStamp);
//end comparator stuff
capacitance = 2.2E-6*.92; //insert capacitance here im calibrating to a known inductor, the .95 is my fudge factor.
frequency = 1.E6/(pulse);
inductance = 1./(capacitance*frequency*frequency*4.*3.14159*3.14159);
inductance *= 1E6; //note that this is the same as saying inductance = inductance*1E6
Serial.print(“High for uS:”);
Serial.print( pulse );
Serial.print( frequency );
Serial.println( inductance );
The capacitor and the inductor in parallel form a resonant circuit. When a pulse of current goes through this, part of the energy goes into making the circuit oscillate or “ring”. I took a photo of what this looks like on my low cost oscilloscope:
The code sends a pulse through the resonant circuit. Using the comparator interrupt, it gets a time stamp with micros() on the next 3 falling edges. The time difference between the first 2 falling edges is one period, or 1/f. Using the formula for resonance of a harmonic oscillator it calculates the inductance.
The blog post I used as a reference for this incorrectly states that the frequency stays the same regardless of the resistance of the inductor. Unfortunately, a damped harmonic oscillator does not resonate at the same frequency as a perfect one. If there is any interest I might make a version of this circuit that measures resistance first and corrects for this. Otherwise this is close enough for most purposes, especially if you have a good, low resistance, inductor.