Smart Enery Meter (AC Current) on Proteus
by anandkirar24 in Circuits > Arduino
75 Views, 2 Favorites, 0 Comments
Smart Enery Meter (AC Current) on Proteus
Smart Energy Meter (AC Current)
This was a part of the minor project for my college.
Downloads
Supplies
1)Proteus 8 Professional
2)Arduino IDE
3)Arduino library for Proteus
4)EmonLib(Arduino library) energy monitoring library.
Components Required
Bring the following components to the simulator.
Components used:
1)LCD LM044L
2)Arduino UNO
3)ACS712ELCTR-05B-T(Current Sensor)
4)TRAN-2P2S(Transformer)
5) 5-Resistors
6) 2-Alternators
7) A Capacitor
Assemble the Components
Copy the circuit diagram and arrange the components accordingly.
In this project, we are working with AC mains voltage, which is typically 220V. These high voltage levels
are dangerous and far exceed the operating limits of the Arduino. Arduino boards are designed to
operate at low voltages, typically between 5V and 12V, and cannot directly handle high-voltage AC
signals. Therefore, it is crucial to step down the high AC voltage to a safe, low voltage before interfacing
it with the Arduino. This is achieved through a voltage transformer and voltage divider circuits:
The voltage transformer steps down the high-voltage AC signal to a much lower AC voltage. The
stepped-down voltage is then further conditioned using resistors and capacitors to bring it within the
safe operating range of the Arduino’s analog input pins.
Without this conversion, directly applying high voltage to the Arduino would result in severe damage to
the microcontroller and could potentially cause safety hazards. Additionally, Arduino’s analog inputs
are designed to measure low-voltage signals (in the 0-5V range), so proper voltage conversion ensures
that the system can safely read and process the voltage data for energy monitoring.
By stepping down the voltage, we ensure:
Safety for both the user and the components.
Accurate measurement of the voltage and current for calculating power consumption.
Calibration of Insrtruments
Change the properties of the transformer according to the image given(First Image)
Primary Inductance: 1H
Secondary Inductance: 1H
Coupling Factor: 0.059
Primary DC resistance: 1m
Secondary DC resistance: 1m
Similarly the properties of the Alternator for the transformer(second image)
Amplitude: 312V (Taken a little high just to check the step down transformers working can also use 220V)
Frequency: 50Hz
And the properties of the Alternator for the Current Sensor(third image)
Amplitude: 220V
Frequency: 50Hz
Upload the Sketch
// Smart Energy Meter Using Arduino
// Measures Voltage, Current, Power, and Energy using LCD display
#include <LiquidCrystal.h> // Library for LCD
#include "EmonLib.h" // Emon Library for voltage and current measurement
// LCD Pin Configuration
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
// Voltage Sensor Configuration
EnergyMonitor emon1; // Create EmonLib instance
// Current Sensor (ACS712) Configuration
const int Sensor_Pin = A1; // Connect current sensor to A1 pin
const int sensitivity = 185; // Sensitivity for 20A ACS712 module
const int offsetVoltage = 2542; // Sensor offset voltage (mV)
// Variables for Calculations
unsigned long previousMillis = 0; // Store previous time for energy calculation
float totalEnergy = 0; // Accumulated energy in Wh
void setup() {
// Initialize EmonLib
emon1.voltage(A0, 187, 1.7); // Voltage input pin, calibration, phase shift
// Initialize LCD
lcd.begin(20, 4);
lcd.setCursor(0, 0);
lcd.print(" SMART ENERGY METER ");
lcd.setCursor(0, 1);
lcd.print(" AC ENERGY MONITOR ");
delay(2000); // Allow some time for startup display
}
void loop() {
// Measure Voltage
emon1.calcVI(20, 2000); // Calculate Voltage and Current
int Voltage = emon1.Vrms;
// Measure Current
float maxPoint = 0;
for (int i = 0; i < 500; i++) {
int temp = analogRead(Sensor_Pin);
if (temp > maxPoint) maxPoint = temp;
}
float ADCvalue = maxPoint;
double eVoltage = (ADCvalue / 1024.0) * 5000; // Convert ADC to mV
double Current = (eVoltage - offsetVoltage) / sensitivity;
double AC_Current = Current / sqrt(2);
// Calculate Power
int Power = Voltage * AC_Current;
// Calculate Energy
unsigned long currentMillis = millis();
unsigned long elapsedTime = currentMillis - previousMillis;
if (elapsedTime >= 1000) {
previousMillis = currentMillis;
totalEnergy += (Power * (elapsedTime / 1000.0)) / 3600; // Add to total energy in Wh
}
// Display Measurements on LCD
displayMeasurements(Voltage, AC_Current, Power, totalEnergy);
delay(200);
}
// Function to Display Measurements
void displayMeasurements(int Voltage, double AC_Current, int Power, float Energy) {
lcd.setCursor(0, 2);
lcd.print("V = ");
lcd.print(Voltage);
lcd.print("V ");
lcd.print("I = ");
lcd.print(AC_Current, 2);
lcd.print("A ");
lcd.setCursor(0, 3);
lcd.print("P = ");
lcd.print(Power);
lcd.print("W ");
lcd.print("E = ");
lcd.print(Energy, 1);
lcd.print("Wh ");
}
Uploading the File Location of the Code
Click on the highlighted Arduino part and put the location for the .hex file of the code.
Run the Simulation
And the project is finished. Thank you. This project was inspired by
AC Energy Meter Using Arduino With Code and Circuit || Proteus Simulation
by The Bright Light. Significant modifications have been made to improve and adapt it.