Skip to content

Instantly share code, notes, and snippets.

@cibomahto
Created April 7, 2021 17:20
Show Gist options
  • Save cibomahto/db7c47a13cbbe6e611df4e0b2b436f99 to your computer and use it in GitHub Desktop.
Save cibomahto/db7c47a13cbbe6e611df4e0b2b436f99 to your computer and use it in GitHub Desktop.
Measure an inductor using a function generator and oscilloscope
# Measure an inductor using a function generator and oscilloscope.
#
# Based on:
# https://www.tek.com/document/application-note/capacitance-and-inductance-measurements-using-oscilloscope-and-function-ge
import math
import quantiphy
def calc_inductance(f,Rref,Va1,Va2,phase):
Z = (Va2*Rref)/math.sqrt(Va1*Va1-(2*Va1*Va2*math.cos(phase))+Va2*Va2)
a = phase - math.atan((-Va2*math.sin(phase))/(Va1-Va2*math.cos(phase)))
#print(Z,math.degrees(a))
Resr = Z*math.cos(a)
L = (Z*math.sin(a))/(2*math.pi*f)
print("F:{}Hz: Inductance={}H ESR:{}Ohm".format(quantiphy.Quantity(f),quantiphy.Quantity(L),quantiphy.Quantity(Resr)))
return(Resr,L)
# Reference numbers:
f = 10000
Rref = 1000
Va1 = 1.832
Va2 = 0.952
phase = math.radians(56.03)
[Resr, L] = calc_inductance(f,Rref,Va1,Va2,phase)
assert(math.isclose(Resr, 29.48, rel_tol=1e-04))
assert(math.isclose(L, 9.95e-3, rel_tol=1e-04))
# Measuring a CJIANG FNR201610S4R7MT
print("CJIANG FNR201610S4R7MT")
# Spec: 4.7uH +-20%, .479ohm max resistance, .7A saturation current
f = 1e6 # test frequency
Rref = 1e3 # reference resistor
Va1 = 18.3
Va2 = 0.478
phase = math.radians(86.5)
[Resr, L] = calc_inductance(f,Rref,Va1,Va2,phase)
f = 1e3 # test frequency
Rref = 1e3 # reference resistor
Va1 = 18.28
Va2 = 8.02e-3
phase = math.radians(2.8)
[Resr, L] = calc_inductance(f,Rref,Va1,Va2,phase)
# Measuring a CJIANG FNR201610R68MT
print("CJIANG FNR201610R68MT")
f = 1e6 # test frequency
Rref = 1e3 # reference resistor
Va1 = 19.79
Va2 = 78.4e-3
phase = math.radians(88.45)
[Resr, L] = calc_inductance(f,Rref,Va1,Va2,phase)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment