SIMULASI RANGKAIAN DC VOLTMETER 0-50 V MENGGUNAKAN LCD 16X2 BERBASIS ARDUINO

 Skematik Rangkaian


Komponen yang digunakan:

-        Arduino UNO

-        LCD 16x2 (LM016L)

-        Potensio 5k (POT-HG)

-        Resistor 100k (RES)

-        Resistor 10k (RES)

Sketch Arduino

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

float vin=0.0;

float temp=0.0;

float r1=100000.0;

float r2=10000.0;

void setup() {

  Serial.begin(9600);

  lcd.begin(16, 2);

  lcd.print("DC VOLTMETER");

  delay(1000);

  lcd.clear();

  lcd.print("DC VoltMeter");

}

void loop() {

  int analog_val=analogRead(A0);

  temp = (analog_val * 5.0)/1024.0;  

  vin = temp/(r2/(r1+r2));

  if(vin<0.1)

  {

    vin=0.0;

  }

  lcd.setCursor(0, 1);

  lcd.print("Voltage = ");

  lcd.println(vin);

  delay(300);

}

Video Simulasi



Komentar

Postingan Populer