Project Overview
Build a digital voltmeter that can measure DC voltages from 0V to 25V and display them on a 16×2 LCD screen. Great for your electronics workbench!
Components Required
| Component | Value |
|---|---|
| Arduino Uno | - |
| 16×2 LCD Display | HD44780 |
| Resistor R1 | 30KΩ |
| Resistor R2 | 7.5KΩ |
| Potentiometer | 10KΩ (for LCD contrast) |
| 9V Battery | - |
| Breadboard + Wires | - |
How the Voltage Divider Works
Since the Arduino can only read up to 5V, we use a voltage divider to scale down the input:
Vout = Vin × R2 / (R1 + R2)
Vout = Vin × 7.5K / (30K + 7.5K)
Vout = Vin × 0.2
So a 25V input becomes 5V — within the safe range.
Wiring
- Connect LCD pins (RS, EN, D4-D7) to Arduino digital pins 7, 6, 5, 4, 3, 2
- LCD VCC to 5V, GND to GND
- Potentiometer middle pin to LCD V0 (contrast)
- Voltage divider output to Arduino A0
- GND of voltage divider to Arduino GND
Arduino Code
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
float vout = 0.0;
float vin = 0.0;
float R1 = 30000.0;
float R2 = 7500.0;
int value = 0;
void setup() {
lcd.begin(16, 2);
lcd.print("Digital Voltmeter");
delay(1500);
lcd.clear();
}
void loop() {
value = analogRead(A0);
vout = (value * 5.0) / 1024.0;
vin = vout * (R1 + R2) / R2;
lcd.setCursor(0, 0);
lcd.print("Input Voltage:");
lcd.setCursor(0, 1);
lcd.print(vin, 2);
lcd.print(" V");
delay(500);
}
Calibration
- Apply a known voltage (e.g., 5.00V from a regulated supply)
- Measure with a reference multimeter
- Adjust the
R1andR2values in code if reading differs
Safety Tips
Never measure AC mains voltage with this circuit! It's designed for DC only, up to 25V maximum.
Share this article