i try to mesure inductance with RL circuit i use this schema :
it works fine with a capacitor (RC circuit), i only changed the capacitor to an inductor and changed the formula from elapsedTime/Resitance to elapsedTime*Resistance but it only shows the value 280.00 even when i change the inductor.
here is the code :
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(32, 16, 2);
#define analogPin A0
#define chargePin 13
#define dischargePin 11
#define resistorValue 10.0F // Lower resistor value for faster charging
unsigned long startTime;
unsigned long elapsedTime;
float milliHenrys;
float Henrys;
void setup() {
lcd.init();
lcd.backlight();
pinMode(chargePin, OUTPUT);
digitalWrite(chargePin, LOW);
}
void loop() {
digitalWrite(chargePin, HIGH);
startTime = micros();
// Wait for the analog reading to reach a certain threshold or timeout after a duration
while (analogRead(analogPin) < 648 ) {
}
elapsedTime = micros() - startTime;
// Calculate inductance using the formula: L = (R * T)
Henrys = (float)elapsedTime * resistorValue ;
lcd.clear();
if (Henrys > 1.0) {
lcd.setCursor(0, 0);
lcd.print("Inductance (H):");
lcd.setCursor(0, 1);
lcd.print(Henrys);
delay(500);
} else {
milliHenrys = Henrys * 1000.0;
lcd.setCursor(0, 0);
lcd.print("Inductance (mH):");
lcd.setCursor(0, 1);
lcd.print(milliHenrys);
delay(500);
}
digitalWrite(chargePin, LOW);
pinMode(dischargePin, OUTPUT);
digitalWrite(dischargePin, LOW); //decharge de condensateur.
while(analogRead(analogPin) > 0){
}
pinMode(dischargePin, INPUT); //this sets the pin to high impedance
lcd.clear();
lcd.setCursor(0,0);
lcd.print("DISCHARGING.....");
lcd.setCursor(0,1);
}
at this point i suspect that the concept of measuring inductance with RL circuit is not possible, because i never found a tutorial talking about it .
can you help me guys ?
