Arduino voltmeter

Description of the Arduino Voltmeter Code
This Arduino code creates a simple voltmeter capable of measuring voltages from 0 to 5 volts using an LCD 1602 display with I2C communication. The program utilizes the Wire library for I2C communication and the LiquidCrystal_I2C library to manage the LCD display. The positive side of the voltage is connected to analog input A3, where the Arduino reads the voltage value.
In the setup() function, serial communication is initialized at 9600 baud, the LCD display is set up, and the backlight is turned on. The loop() function continuously reads the analog voltage from pin A3, calculates the corresponding voltage (with 1023 representing 5 volts), and displays this value on both the Serial Monitor and the LCD. The readings are updated every half second, with the LCD cleared between updates to ensure clarity.
This project is an excellent introduction to using Arduino for voltage measurement and LCD display interfacing, making it a valuable resource for electronics enthusiasts and beginners.
SCHEMATIC:

CODE:
/*
In this example, weโll use an Arduino to create
a simple voltmeter with a range of 0 to 5 volts.
*/
#include <Wire.h> // library for controlling devices via I2C
#include <LiquidCrystal_I2C.h> // library for using an LCD 1602 display
LiquidCrystal_I2C lcd(0x27,16,2); // define lcd variable for a 16x2 display
int Vpin = A3; // connect the positive side of the voltage to analog input A3
float voltage; // variable to hold raw analog value
float volts; // variable to hold calculated voltage value
void setup() // setup procedure runs once when the program starts
{
Serial.begin(9600); // initialize serial communication at 9600 baud rate
lcd.init(); // initialize the LCD display
lcd.backlight(); // turn on the LCD backlight
}
void loop() // loop procedure runs continuously
{
voltage = analogRead(Vpin); // read the voltage at pin A3
// calculate voltage based on the analog read (1023 corresponds to 5V)
volts = voltage / 1023 * 5.0;
Serial.println(volts); // print the voltage value to the Serial Monitor
lcd.print("Voltage = "); // display label for voltage reading
lcd.print(volts); // display calculated voltage on LCD
delay(500); // delay for half a second to stabilize the reading
lcd.clear(); // clear LCD display for the next reading
}
- Arduino projects
- Voltmeter tutorial
- Voltage measurement with Arduino
- LCD 1602 display
- I2C communication
- DIY electronics projects
- Arduino programming for beginners
- Analog input reading
- LiquidCrystal_I2C library
- Electronics projects for beginners
You may also like
EmbedLab Team
Embedded systems engineer and educator. Writes weekly tutorials at EmbedLab to help beginners ship real hardware.
Related projects
Arduino and shift register
Project Description This Arduino project with code is a smart parking status display system designed to monitor and show the availability of parking spots in real-time. It leverages a 74HC165 s
Arduino traffic lights
This project implements a traffic light system with a countdown timer , designed using an Arduino microcontroller. It controls a sequence of traffic lights (red, yellow, and green) and a 7-segme
Arduino and Multiplexer
Hello In this article we will see how you can increase the output of the Arduino UNO board by using the 74HC4051 Multiplixer , we wil controll 8 LEDS! This Project is simulated using Proteu
Arduino UNO and EEPROM
Project Description: EEPROM SPI Communication with Arduino In this quick tutorial, we'll explore how to communicate with an EEPROM (Electrically Erasable Programmable Read-Only Memory) using SPI (Seri
Arduino buzzer + 4511 bcd + 7SEG
This Arduino code implements a countdown timer with a 7-segment display driven by a 4511 IC, a buzzer for an alarm, and an optional start/reset button. Here's a brief explanation: Components and



