Arduino UNO Based Hybrid Energy Management System with I2C LCD Display and Relay Control
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
The circuit is designed to manage a hybrid energy system that utilizes solar panels, a battery, and an AC power source to supply power to various loads. The system is controlled by an Arduino UNO microcontroller, which monitors the voltage levels from the solar panel, battery, and grid to determine the most efficient power source. The circuit includes voltage sensors for monitoring, a 20x4 LCD with an I2C module for display, and relay modules for switching power sources and loads. The Arduino UNO also controls the charging of the battery and manages emergency situations.
Component List
Microcontroller
- Arduino UNO: A microcontroller board based on the ATmega328P, with digital and analog I/O pins.
Sensors
- Voltage Sensors: Used to measure the voltage output from the solar panel, battery, and grid.
Display
- Lcd 20x4 i2c: A 20x4 character LCD display with an I2C communication interface for showing system statuses.
Modules
- I2C module: Provides an I2C interface for the LCD display to communicate with the Arduino UNO.
Relay Modules
- 4 channel relay modules: Used to switch between power sources and control power to the loads.
Power Sources
- Solar Panel: Provides renewable energy from sunlight.
- Battery: Stores electrical energy for later use.
- AC Source: Supplies alternating current from the grid.
- POWER SUPPLY 12V 5AMP: Converts AC to DC for use in the circuit.
Passive Components
- Resistor: Limits current flow and drops voltage.
- LEDs: Indicate the status of the relays and power sources.
Wiring Details
Arduino UNO
- GND: Connected to the ground of the circuit.
- Vin: Connected to the positive voltage supply.
- 5V: Powers the I2C module.
- A0, A1, A2: Analog inputs connected to the voltage sensors.
- D2: Connected to a resistor.
- D3-D7, D11-D13: Digital outputs controlling the relay modules.
- SCL, SDA: I2C communication lines connected to the I2C module.
Voltage Sensors
- Vcc: Connected to the positive voltage supply.
- Gnd: Connected to the ground of the circuit.
- Phase: Connected to the respective power source for voltage sensing.
- Out: Output connected to the Arduino analog inputs.
Lcd 20x4 i2c
- GND: Connected to the ground of the circuit.
- 5v: Powered by the 5V output from the Arduino UNO.
- SCA, SCL: I2C communication lines connected to the Arduino UNO.
I2C Module
- VCC: Powered by the 5V output from the Arduino UNO.
- GND: Connected to the ground of the circuit.
- SDA, SCL: I2C communication lines connected to the Arduino UNO.
4 Channel Relay Modules
- VCC+: Connected to the positive voltage supply.
- VCC- (GND): Connected to the ground of the circuit.
- IN 1-4: Control inputs from the Arduino digital outputs.
- COM 1-4: Common terminals connected to the positive voltage supply.
- N.O. 1-4: Normally open contacts connected to the LEDs.
LEDs
- Cathode (-): Connected to the ground of the circuit.
- Anode (+): Connected to the normally open contacts of the relay modules.
Power Supply
- 220V Positive Pole (AC): Connected to the positive terminal of the AC source.
- 220V Negative Pole (AC): Connected to the negative terminal of the AC source.
- GND (DC): Connected to the ground of the circuit.
- 12V-24V Output (DC): Connected to the voltage sensors.
Documented Code
Arduino UNO Code (sketch.ino)
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
const int solarPin = A0;
const int batteryPin = A1;
const int gridPin = A2;
const int relaySolar = 13;
const int relayBattery = 12;
const int relayGrid = 11;
const int relayHighLoad = 7;
const int relayNormalLoad = 6;
const int relayLowLoad = 5;
const int Gcharge = 4;
const int Scharge = 3;
const int Emer = 1;
float solarVoltage, batteryVoltage, gridVoltage;
void setup() {
Serial.begin(9600);
lcd.backlight();
lcd.begin(20, 4);
lcd.init();
lcd.setCursor(0, 1);
lcd.print("HYBRID ENERGY SMART");
lcd.setCursor(5, 2);
lcd.print("MANAGEMENT");
delay(2000);
pinMode(relaySolar, OUTPUT);
pinMode(relayBattery, OUTPUT);
pinMode(relayGrid, OUTPUT);
pinMode(relayHighLoad, OUTPUT);
pinMode(relayNormalLoad, OUTPUT);
pinMode(relayLowLoad, OUTPUT);
pinMode(Gcharge, OUTPUT);
pinMode(Scharge, OUTPUT);
pinMode(Emer, OUTPUT);
digitalWrite(relaySolar, HIGH);
digitalWrite(relayBattery, HIGH);
digitalWrite(relayGrid, HIGH);
digitalWrite(relayHighLoad, HIGH);
digitalWrite(relayNormalLoad, HIGH);
digitalWrite(relayLowLoad, HIGH);
digitalWrite(Gcharge, HIGH);
digitalWrite(Scharge, HIGH);
digitalWrite(Emer, HIGH);
}
void loop() {
solarVoltage = analogRead(solarPin) * (5.0 / 1023.0) * (26.0 / 5.0);
batteryVoltage = analogRead(batteryPin) * (5.0 / 1023.0) * (23.5 / 5.0);
gridVoltage = analogRead(gridPin) * (5.0 / 1023.0) * (23.5 / 5.0);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Solar: ");
lcd.print(solarVoltage, 2);
lcd.print("V");
lcd.setCursor(0, 1);
lcd.print("Battery: ");
lcd.print(batteryVoltage, 2);
lcd.print("V");
lcd.setCursor(0, 2);
lcd.print("Grid: ");
lcd.print(gridVoltage, 2);
lcd.print("V");
// Logic to determine the power source and control relays
// (Omitted for brevity, see full code for details)
delay(1000);
}
Additional Code Files
- documentation.txt: Contains additional notes and documentation related to the microcontroller and power supply.
(Note: The actual logic for controlling the relays based on voltage readings is included in the full code but omitted here for brevity.)