Artikel ini merupakan artikel sementara sebelum dijelaskan secara detail, karena videonya telah diluncurkan jadi perlu adanya kode program untuk yang ingin mencobanya.
Skema tambahan inductance meter |
Inilah kode programnya
/*Thanks. Remember to visit my Youtube channel
If you don't whant to Serial print the valeus just delete the serial. print lines
and leave just the LCD print ones.
I've used a i2c LCD screen module.
*/
//LCD config
#include
#include
LiquidCrystal_I2C lcd(0x27, 16, 2); //sometimes the adress is not 0x3f. Change to 0x27 if it dosn't work.
//13 is the input to the circuit (connects to 150ohm resistor), 11 is the comparator/op-amp output.
double pulse, frequency, capacitance, inductance, inductance_mH;
void setup() {
pinMode(11, INPUT);//output through a 150 ohm resistor to thr LC circuit
pinMode(13, OUTPUT);//Input from the comparator output//Use any other pin you select
lcd.begin();
lcd.backlight();
Serial.begin(115200);
lcd.setCursor( 1, 0);
lcd.print("-= WELCOME =-");
lcd.setCursor( 0, 1);
lcd.print("> FAREED READ <");
delay(2000);
}
void loop() {
digitalWrite(13, HIGH);
delay(5);//give some time to charge inductor.
digitalWrite(13, LOW);
delayMicroseconds(100); //make sure resination is measured
pulse = pulseIn(11, HIGH, 5000); //returns 0 if timeout
if (pulse > 0.1) { //if a timeout did not occur and it took a reading:
// insert your used capacitance value here. Currently using 2uF. Delete this line after that
capacitance = 2.E-6; // <- 1000="" 1e6="" 3.14159="" 4.="" as="" capacitance="" delay="" do="" erial="" for="" frequency="" here="" hz:="" if="" igh="" inductance="" inductance_mh="inductance" insert="" is="" just="" lcd.clear="" like="" me="" my="" note="" of="" one="" print="" profs="" pulse="" same="" saying="" serial.print="" serial.println="" squares="" tfrequency="" that="" the="" this="" tinductance="" told="" uh:="" us:="" value="">= 1000 && frequency >= 1000) {
frequency /= 1000;
lcd.setCursor(0, 0);
lcd.print("L < ");
lcd.print(inductance_mH);
lcd.print(" mH >");
lcd.setCursor(0, 1);
lcd.print("F < ");
lcd.print(frequency);
lcd.print(" KHz >");
}
else if (inductance < 1000 && frequency >= 1000) {
frequency /= 1000;
lcd.setCursor(0, 0);
lcd.print("L < ");
lcd.print(inductance);
lcd.print(" uH >");
lcd.setCursor(0, 1);
lcd.print("F < ");
lcd.print(frequency);
lcd.print(" KHz >");
}
else if (frequency < 1000 && inductance >= 1000) {
lcd.setCursor(0, 0);
lcd.print("L < ");
lcd.print(inductance_mH);
lcd.print(" mH >");
lcd.setCursor(0, 1);
lcd.print("F <");
lcd.print(frequency);
lcd.print(" Hz >");
}
delay(10);
}
}
->