0% found this document useful (0 votes)
14 views3 pages

Smart Energy Meter with Load Monitoring

This document summarizes a smart energy meter project that monitors energy usage using an Arduino board and LCD display. It includes code to: 1) Read voltage and current sensors and calculate RMS power consumption over time. 2) Display real-time power, voltage, current and accumulated energy usage on the LCD screen. 3) Allow toggling a transistor switch using a button to control a load. 4) Log sensor readings and calculations to the serial monitor.

Uploaded by

khalid
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

Smart Energy Meter with Load Monitoring

This document summarizes a smart energy meter project that monitors energy usage using an Arduino board and LCD display. It includes code to: 1) Read voltage and current sensors and calculate RMS power consumption over time. 2) Display real-time power, voltage, current and accumulated energy usage on the LCD screen. 3) Allow toggling a transistor switch using a button to control a load. 4) Log sensor readings and calculations to the serial monitor.

Uploaded by

khalid
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

/*

Smart Energy Meter and Monitoring using ElectroSaving App


Khalid Akram (17EL12)
Ansar Bilal (17EL32)
Muhammad Fahad (16/17EL34)
*/
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
const int sensorIn = A0;
const int buttonPin = 12;
const int transistorPin = 8;

int buttonState = 0;
int mVperAmp = 78;

double Voltage = 0;
double VRMS = 0;
double AmpsRMS = 0;
double kilos = 0;
int peakPower = 0;

void setup()
{

pinMode(buttonPin, INPUT_PULLUP);
pinMode(transistorPin, OUTPUT);

[Link](9600);
[Link](20, 4);
[Link]();
[Link](6,1);
[Link](" WELCOME");
[Link](5,2);
[Link]("Energy Meter");

delay(1000);
[Link]();

void loop()
{
int sensorValue = analogRead(A1);
float volt = sensorValue * (241.0 / 1023.0);

Voltage = getVPP();
VRMS = (Voltage/2.0) *0.707; //root 2 is 0.707
AmpsRMS = (VRMS * 1000)/mVperAmp;

int RMSPower = volt * AmpsRMS; //Calculates RMS Power Assuming Voltage 220VAC,
change to 110VAC accordingly
if (RMSPower > peakPower)
{
peakPower = RMSPower;
}
kilos = kilos + (RMSPower * (2.05/60/60/1000)); //Calculate kilowatt hours
used
delay (2000);
buttonState = digitalRead(buttonPin);

if (buttonState == LOW)
{

digitalWrite (transistorPin, HIGH);

else
{

digitalWrite (transistorPin, LOW);

[Link]("\t AC Voltage = ");


[Link](volt);
[Link](" Volt");
[Link]("\t \t AC Current = ");
[Link](AmpsRMS);
[Link](" Amps");
[Link]("\t \t \t Power = ");
[Link](RMSPower);
[Link](" Watt");
[Link]("\t \t \t \t Energy = ");
[Link](kilos);
[Link](" Kwh");

[Link](0, 0);
[Link]("V="); [Link](volt);
[Link](0, 1);
[Link]("I=");[Link](AmpsRMS);
[Link](0, 2);
[Link]("P="); [Link](RMSPower);
[Link](0, 3);
[Link]("Kwh=");[Link](kilos);

delay(1000);
}

float getVPP()
{
float result;
int readValue; //value read from the sensor
int maxValue = 0; // store max value here
int minValue = 1023; // store min value here

uint32_t start_time = millis();


while((millis()-start_time) < 1000) //sample for 1 Sec
{
readValue = analogRead(sensorIn);
// see if you have a new maxValue
if (readValue > maxValue)
{
/*record the maximum sensor value*/
maxValue = readValue;
}
if (readValue < minValue)
{
/*record the minimum sensor value*/
minValue = readValue;
}
}

// Subtract min from max


result = ((maxValue - minValue) * 5.0)/1023.0;

return result;
}

You might also like