In This project I am going to make a Digital Voltmeter using an Arduino nano and a HD44780 Compatible 16*2 LCD we apply the analog voltage that we want to measure to one of the analog input pins of the Arduino. We can measure maximum 5V Dc voltage with this digital Voltmeter. I shall try to increase its rage further in my future projects.
Hardware List:- 1. Arduino Nano
- 2. HD44780 LCD Display ( 16*2)
- 3. 10K potentiometer
- 4. Bread Board
- 5. 10K trimmer potentiometer
- 6. Jumper wire
- 7. 100 ohm resistor
- 8. Mini B USB Cable
Step1 – Insert the Arduino nano and HD44780 LCD display carefully in the bread board. After inserting these two further insert a 10ktrimmer, 10K potentiometer and a 100 ohm resistor as shown in the following figure.
Step2- Connect all the pins of the hardware to one another according to the given schematic diagram. When your hardware wiring is done then please make sure to check all the connections twice so that there will be no possibility of any king of wiring error. After wiring your setup will be something like this
Step3- Adjust the contrast of the characters shown on the lcd screen to any level that you like by rotating the knob of the 10k Trimmer clockwise or anticlockwise with the help of a screw driver.
Step4- Write an sketch to read the analog voltage from one of the analog pins of the Arduino and print this voltage value on the LCD Display.
To calculate the input analog voltage of any of the analog input pins we use a basic formula of DAC or ADC Convertor and that is
Vout = (digital input * Vref)/Resolution of the ADC
Atemega328P microcontroller of Arduino nano has a 10 Bit Successive approximation type ADC that converts the analog value into 10 bits binary equivalent.
Step5- After calculating the voltage on the analog pin of the Arduino we print this voltage value on a 16*2 LCD.
Step6- After writing the sketch verify the sketch and when verification is done then you should upload this sketch on your hardware the Latest Arduino Software.
Sketch (C/C++ Code)#include <LiquidCrystal.h>
LiquidCrystal lcd(5,6,7,8,9,10);
float voltage;
float val;
const int Vref = 5.0;
const int resolution = 1024.0;
void setup() {
// put your setup code here, to run once:
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("Voltage:");
}
void loop() {
// put your main code here, to run repeatedly:
val = analogRead(A3);
voltage = (val*Vref)/resolution;
lcd.setCursor(0,1);
lcd.print(voltage);
delay(90);
}
Schematicdiagram-
Comments