Digital voltmeter for dc power bench

0

example code




#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2CL lcd(0x3F,2,1,0,4,5,6,7);

void setup()
{
  lcd.begin (16,2); 
  lcd.setBacklightPin(3,POSITIVE);
  lcd.setBacklight(HIGH);
  
  lcd.print("this is really  ");  
  lcd.setCursor ( 0, 2 );
  lcd.print ("simple!! right ?"); 

}

void loop()
{
}




Digital voltmeter code



#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7); 

int analogInput = 2;
float vout = 0.0;
float vin = 0.0;
float R1 = 100000.2; // resistance of R1 (100K) -see text!
float R2 = 10000.2; // resistance of R2 (10K) - see text!
int value = 0;
void setup(){
   lcd.begin (16,2); // for 16 x 2 LCD module
  lcd.setBacklightPin(3,POSITIVE);
  lcd.setBacklight(HIGH);
   pinMode(analogInput, INPUT);
   lcd.begin(16, 2);
   lcd.print("NOW VOLT");
}
void loop(){
   // read the value at analog input
   value = analogRead(analogInput);
   vout = (value * 5.0) / 1024.0; // see text
   vin = vout / (R2/(R1+R2)); 
   if (vin<0.09) {
   vin=0.0;//statement to quash undesired reading !
lcd.setCursor(0, 1);
lcd.print("INPUT V= ");
lcd.print(vin);
delay(500);
}



Diagram





















video link




Post a Comment

0 Comments

please do not enter any spam link in comment box

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top