Arduino UNO Based Battery Voltage and Current Monitoring System with LCD Display
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to measure the voltage and current of a 12V battery and display the measured values on a 20x4 I2C LCD screen. The core of the circuit is an Arduino UNO microcontroller, which reads the analog signals from a voltage sensor and a current sensor (5A range), processes these signals, and then outputs the data to the LCD display. The sensors are powered by the 5V output from the Arduino, and the battery's voltage and current are monitored in real-time.
Component List
Arduino UNO
- Microcontroller board based on the ATmega328P
- It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.
Voltage Sensor
- A module capable of measuring the voltage of an external battery.
- It typically has a voltage divider circuit to step down the voltage to a range that can be read by the Arduino's analog input.
Current Sensor 5A
- A sensor that measures up to 5A of current through a low-resistance shunt.
- It outputs an analog voltage proportional to the current flowing through the sensor.
Battery 12V
- A 12-volt battery that is the power source being monitored.
- It provides the input voltage and current for the sensors.
LCD Display 20x4 I2C
- An alphanumeric liquid crystal display with 20 characters per line and 4 lines.
- It uses the I2C communication protocol for interfacing with the Arduino.
Wiring Details
Arduino UNO
- 5V pin is connected to the Vcc of the Voltage Sensor, VCC of the Current Sensor, and VCC of the LCD Display.
- GND pin is connected to the Ground of the Voltage Sensor, GND of the Current Sensor, and GND of the LCD Display.
- A0 pin is connected to the Out pin of the Voltage Sensor.
- A1 pin is connected to the OUT pin of the Current Sensor.
- A4 (SDA) pin is connected to the SDA pin of the LCD Display.
- A5 (SCL) pin is connected to the SCL pin of the LCD Display.
Voltage Sensor
- Vcc pin is connected to the 5V output from the Arduino UNO.
- Ground and Gnd pins are connected to the negative terminal of the battery and GND on the Arduino UNO.
- Out pin is connected to the A0 pin on the Arduino UNO.
- Phase pin is connected to the positive terminal of the battery.
Current Sensor 5A
- VCC pin is connected to the 5V output from the Arduino UNO.
- GND pin is connected to the GND on the Arduino UNO.
- OUT pin is connected to the A1 pin on the Arduino UNO.
- 1 pin is connected to the positive terminal of the battery.
- 2 pin is connected to the negative terminal of the battery.
Battery 12V
- + terminal is connected to the Phase pin of the Voltage Sensor and pin 1 of the Current Sensor.
- - terminal is connected to the Ground pin of the Voltage Sensor and pin 2 of the Current Sensor.
LCD Display 20x4 I2C
- VCC pin is connected to the 5V output from the Arduino UNO.
- GND pin is connected to the GND on the Arduino UNO.
- SDA pin is connected to the A4 pin on the Arduino UNO.
- SCL pin is connected to the A5 pin on the Arduino UNO.
Documented Code
/*
* This Arduino sketch measures the voltage and current of a battery using
* a voltage sensor and a current sensor. The measured values are displayed
* on a 20x4 I2C LCD screen.
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Initialize the LCD with the I2C address 0x27
LiquidCrystal_I2C lcd(0x27, 20, 4);
// Pin definitions
const int voltageSensorPin = A0;
const int currentSensorPin = A1;
void setup() {
// Initialize the LCD
lcd.begin();
lcd.backlight();
// Initialize serial communication
Serial.begin(9600);
}
void loop() {
// Read voltage sensor value
int voltageValue = analogRead(voltageSensorPin);
float voltage = (voltageValue / 1023.0) * 5.0 * (12.0 / 5.0); // Adjust for sensor
// Read current sensor value
int currentValue = analogRead(currentSensorPin);
float current = (currentValue / 1023.0) * 5.0 / 0.185; // Adjust for sensor
// Print values to serial monitor
Serial.print("Voltage: ");
Serial.print(voltage);
Serial.print(" V");
Serial.print("\tCurrent: ");
Serial.print(current);
Serial.println(" A");
// Display values on LCD
lcd.setCursor(0, 0);
lcd.print("Voltage: ");
lcd.print(voltage);
lcd.print(" V");
lcd.setCursor(0, 1);
lcd.print("Current: ");
lcd.print(current);
lcd.print(" A");
// Wait for a second before next reading
delay(1000);
}
This code is designed to run on the Arduino UNO microcontroller. It initializes the LCD display, reads the analog values from the voltage and current sensors, calculates the actual voltage and current based on the sensor characteristics, and then displays the results on the LCD as well as outputs them to the serial monitor. The loop function repeats this process every second.