RL circuit problem

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 ?

Hello @samadox
In the french speaking forum, please speak in french or ask a moderator to move your post to the general English section by flagging it (the small flag at the bottom right).

Either you speak in French and you modify your initial post to put it in French (the pencil icon at the bottom right), or you move it to the English part.

Thanks,
Pandaroux007
(Sorry, I can't help you with your problem.)

move done here
https://forum.arduino.cc/t/rl-circuit-problem/1219771

@samadox,

Your other topic on the same subject deleted.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

It is very well possible to measure inductors.
You need to find a good combination of R, L and frequency.
What value inductor do you have?
Is it an ideal inductor? With zero ohmic sesistance?
The inductor will produce a negatve voltage when you stop the current. That may damage your arduino. Add a diode.

Can you make a decent schematic?
What is the 10 ohm resistor for?

Well, if a capacitor stores voltage, what does an inductor store? When you can answer that question, you will know why your scheme failed.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.