Last active
February 6, 2016 10:21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
PROJECTSDUNIA | |
" DC Votmeter using ARDUINO " | |
Designed By Sachin Jaiswal | |
In this we measure the input voltage and display it on the 16 * 2 LCD Module | |
For Full Description Visit http://projectsdunia.blogspot.com | |
*/ | |
#include <LiquidCrystal.h> | |
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // initialize the library with the numbers of the interface pins | |
float vin=0.0; | |
float temp=0.0; | |
float r1=100000.0; // Set the value of resister R1 | |
float r2=10000.0; // Set the value of resister R2 | |
void setup() { | |
Serial.begin(9600); | |
lcd.begin(16, 2); // set up the LCD's number of columns and rows: | |
lcd.print("PROJECTSDUNIA"); // Print a message to the LCD. | |
delay(1000); | |
lcd.clear(); | |
lcd.print("DC VoltMeter"); | |
} | |
void loop() { | |
int analog_val=analogRead(A0); // read the value of analog pin A0 and store it in the variable analog_val | |
temp = (analog_val * 5.0)/1024.0; | |
vin = temp/(r2/(r1+r2)); | |
if(vin<0.1) | |
{ | |
vin=0.0; | |
} | |
lcd.setCursor(0, 1); // set the cursor to column 0 line 1 | |
lcd.print("Voltage = "); // print the voltage | |
lcd.println(vin); | |
delay(300); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment