IoT Based Energy Monitoring System – Smart Energy System

smart energy monitoring system using IoT

IoT Based Energy Monitoring System

 

The electricity demand is growing daily and is expected to increase rapidly in the coming years. Electricity is an important component in our daily life and must be used responsibly. People usually tend to leave the fans, lights, air conditioners, freezers, heaters, etc. on when they are not used. This contributes to the wastage of electricity and power and is a very irresponsible act.

This behaviour leads to excessive power consumption and wastage of electrical energy. This can also lead to short circuits in households.

Sockets in the switchboards generally receive a limited supply of electric current. We need to monitor the real-time power usage for each socket to identify the devices that consume more power and then accordingly use electricity. This can help in preventing short circuits and also managing electricity bills.

 

 

In this project, we will make an IoT based energy monitoring system which detects current overdraw and accordingly turns off the circuit if the current crossed the limit, hence preventing short circuit. It can also give real-time data regarding power usage over a Wi-Fi module. We use Arduino Nano, ZMTC 103C Sensor, which helps in detecting the current and ESP8266 Wi-fi module.

For the programming part, we use the libraries EmonLib for measuring the current from the ZMTC103C current sensor and ESPDash that helps in showing the graph/data for electric current and power usage. The Arduino circuit and ESP8266 module are used together to get the current reading and display this information over Wi-Fi.

The connections between the Arduino board and the relay module are as follows:

 

                     Relay                               Arduino
                        VCC                                 5V DC
                        GND                                 GND
                          IN1                                 PIN 9

 

One pin of the ZMTC sensor is connected to the GND pin of Arduino and another is connected to the analogue pin A1 of Arduino.

Once the connection is done and the code is uploaded, the project is complete. To test this, power supply is provided to the circuit and an appliance is connected to the system which consumes more power than the threshold value. Once this is detected by the sensor, the relay module automatically breaks the circuit. Hence, this prevents a short circuit.

 

Components required

 

 

Circuit Diagram

 

circuit diagram for iot based energy management system
Smart energy monitoring system using Arduino

Image 1 : credit / source details mentioned below

 

Code

#include “EmonLib.h”                   // Include Emon Library

EnergyMonitor emon1;                   // Create an instance

int Currprotection=9;

int thres=2.3;

 

void setup()

{

Serial.begin(115200);

Serial1.begin(115200);

u8g2.begin();

pinMode(Currprotection,1);

emon1.current(1, 111.1);             // Current: input pin, calibration.

}

 

void loop()

{

double Irms = emon1.calcIrms(1480);  // Calculate Irms only

Serial.println(Irms);

Serial1.println(Irms);

if (Irms > thres ){

digitalWrite(Currprotection,0);

}

else{

digitalWrite(Currprotection,1);

}

}

#include <Arduino.h>

#if defined(ESP8266)

/* ESP8266 Dependencies */

#include <ESP8266WiFi.h>

#include <ESPAsyncTCP.h>

#include <ESPAsyncWebServer.h>

#elif defined(ESP32)

/* ESP32 Dependencies */

#include <WiFi.h>

#include <AsyncTCP.h>

#include <ESPAsyncWebServer.h>

#endif

#include <ESPDash.h>

 

 

/* Your WiFi Credentials */

const char* ssid = “IRONMAN”; // SSID

const char* password = “1234567890”; // Password

float  Irms1=0.0;

/* Start Webserver */

AsyncWebServer server(80);

 

/* Attach ESP-DASH to AsyncWebServer */

ESPDash dashboard(&server);

 

/*

Dashboard Charts

Format – (Dashboard Instance, Chart Type, Chart Name )

*/

// Bar Chart Data

String XAxis[] = {“Sun”, “Mon”, “Tue”, “Wed”, “Thu”, “Fri”, “Sat”};

int YAxis[] = {0, 0, 0, 0, 0, 0, 0};

 

// Bar Chart Instance

Chart power(&dashboard, BAR_CHART, “Power Usage (kWh)”);

 

Card Power(&dashboard, TEMPERATURE_CARD, “Apparent Power”, “W”);

Card Current(&dashboard, HUMIDITY_CARD, “Current”, “A”);

 

void setup() {

Serial.begin(115200);

 

/* Connect WiFi */

WiFi.mode(WIFI_STA);

WiFi.begin(ssid, password);

if (WiFi.waitForConnectResult() != WL_CONNECTED) {

Serial.printf(“WiFi Failed!\n”);

return;

}

Serial.print(“IP Address: “);

Serial.println(WiFi.localIP());

 

/*

Update Chart X Axis (xaxis_array, array_size)

——————-

We need to update X Axis once only as it will not be changing in this example

*/

power.updateX(XAxis, 7);

 

/* Start AsyncWebServer */

server.begin();

}

 

void loop() {

Irms1=Serial.parseFloat();

Serial.println(Irms1);

// Randomize YAxis Values ( for demonstration purposes only )

for(int i=0; i < 7; i++){

YAxis[i] =  Irms1;

}

 

/* Update Chart Y Axis (yaxis_array, array_size) */

power.updateY(YAxis, 7);

 

/* Send Updates to our Dashboard (realtime) */

dashboard.sendUpdates();

 

Current.update(Irms1);

Power.update(Irms1*230);

 

/*

Delay is just for demonstration purposes in this example,

Replace this code with ‘millis interval’ in your final project.

*/

delay(1000);

}

 

Output Images

 

output for iot based energy management system
Smart energy monitoring system using IoT

Image 2: credit / source details mentioned below

 

See alsoSmart Meter – New way of measuring uses of Electricity, Water and Gas

 

Advantages of smart energy monitoring

  • Saves electricity and energy
  • Completely automated system
  • Prevents short circuit
  • Helps in reducing electricity bill

 

 

Disadvantages

  • Initial set up can be a little expensive

 

 

Applications

  • Houses
  • Offices
  • Schools
  • Markets
  • Hospitals
  • Complex
  • Any place with electricity consumption

 

See alsoEnergy Management Using IoT

 

Let us know your comment on “IoT based energy monitoring system” in the section below.

If you like this post subscribe our YouTube Channel for IoT video Tutorials. You can also find us on Twitter, Facebook, and Instagram for more updates.

Start your IoT journey with IoT Basics from IoTDunia.

 

 

 

References and Image 1 and 2 credit & source

electronicsforu

IoTDunia
IoTDunia is working towards a vision of empowering the youth by providing them with great professional opportunities with Internet of Things to build world class ecosystem.