0% found this document useful (0 votes)
15 views3 pages

Arduino LC Meter Implementation

Uploaded by

kuetecedric0
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

Arduino LC Meter Implementation

Uploaded by

kuetecedric0
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

#include<LiquidCrystal.

h>
LiquidCrystal lcd(A5, A4, A3, A2, A1, A0);
#define serial
#define charge 3
#define freqIn 2
#define mode 10
#define Delay 15
double frequency, capacitance, inductance;
typedef struct
{
int flag: 1;
}Flag;
Flag Bit;
void setup()
{
#ifdef serial
[Link](9600);
#endif
[Link](16, 2);
pinMode(freqIn, INPUT);
pinMode(charge, OUTPUT);
pinMode(mode, INPUT_PULLUP);
[Link](" LC Meter Using ");
[Link](0, 1);
[Link](" Arduino ");
delay(2000);
[Link]();
[Link]("Circuit Digest");
delay(2000);
}
void loop()
{
for(int i=0;i<Delay;i++)
{
digitalWrite(charge, HIGH);
delayMicroseconds(100);
digitalWrite(charge, LOW);
delayMicroseconds(50);
double Pulse = pulseIn(freqIn, HIGH, 10000);
if (Pulse > 0.1)
frequency+= 1.E6 / (2 * Pulse);
delay(20);
}
frequency/=Delay;
#ifdef serial
[Link]("frequency:");
[Link]( frequency );
[Link](" Hz ");
#endif
[Link](0, 0);
[Link]("freq:");
[Link]( frequency );
[Link](" Hz ");
if ([Link])
{
inductance = 1.E-3;
capacitance = ((1. / (inductance * frequency * frequency * 4.*3.14159 * 3.
14159)) * 1.E9);
if((int)capacitance < 0)
capacitance=0;
#ifdef serial
[Link]("Capacitance:");
[Link]( capacitance,6);
[Link](" uF ");
#endif
[Link](0, 1);
[Link]("Cap: ");
if(capacitance > 47)
{
[Link]( (capacitance/1000));
[Link](" uF ");
}
else
{
[Link](capacitance);
[Link](" nF ");
}
}

else
{
capacitance = 0.1E-6;
inductance = (1. / (capacitance * frequency * frequency * 4.*3.14159 * 3.
14159)) * 1.E6;
#ifdef serial
[Link]("Ind:");
if(inductance>=1000)
{
[Link]( inductance/1000 );
[Link](" mH");
}
else
{
[Link]( inductance );
[Link](" uH");
}
#endif
[Link](0, 1);
[Link]("Ind:");
if(inductance>=1000)
{
[Link]( inductance/1000 );
[Link](" mH ");
}
else
{
[Link]( inductance );
[Link](" uH ");
}
}
if (digitalRead(mode) == LOW)
{
[Link] = ![Link];
delay(1000);
while (digitalRead(mode) == LOW);
}
delay(50);
}

You might also like