Smart Energy Monitoring System Using ESP32 And SCT-013 Sensor

In this project, an open-source and modular smart energy monitoring system is designed and implemented. A Wi-Fi-based IoT network has been designed which has the capability of monitoring daily energy consumption in our homes through our smartphones. In the IoT network, the current and voltage values have been measured with the current sensor SCT-013 (upto 100A) connected to the ESP32 development board. Real power, apparent power and power factors can be calculated by using measured current, voltage values and phase angle.

These measured and calculated values have been sent to the ESP32 development board by software serial method. The ESP32 provides the cloud server-based user interface where we can see these calculations and actual values. It uses a Wi-Fi access point connection. The user interface is displayed via the web browser and mobile application with TCP/IP protocols. Experimental studies prove that this system could be used in general-purpose applications such as IoT energy monitoring systems for smart home automation systems.

The demand for electricity is one of the most important things in our daily life to develop technology. A grid loading is made for two types of people, residential and commercial both. So operators have to do load distribution keeping in mind the two types of consumers. Smart Homes are designed with this in mind and to reduce energy consumption. Nowadays, smart homes have doing an important role in smart grids. Therefore, we need to control the energy consumption in those houses. Today, the Internet of Things (IoT) has captured a wide range of areas such as the automotive industry, logistics, hospitals, smart grids, metro cities and smart homes.

We can classify the IoT into two categories i.e., the Internet of Industrial Things (IIoT) and the Internet of Consumer Things (CIoT). In this project, CIoT systems have been discussed in brief. In our home, energy consumption could be easily monitored by controlling the home appliances like water geysers, air conditioners, dishwashers and other systems by using IoT. Traditional measuring methods are known to be labour-intensive and complex for practical applications. Using CIoT systems with Wi-Fi-enabled devices cut out these problems with one click. Most of the homes have Wi-Fi networks, computers and smartphones in today’s innovative world. So it is also easier now.

Must Read Home Automation Projects

Principle Behind Smart Energy Monitoring System

In this project, the SCT-013 current (CT) sensor is used for single-phase current measurement, and a 9V AC step-down transformer is used to measure the RMS value of the voltage. These two sensors are connected to the ESP32 board. We can calculate power factor, real power and apparent power values using the measured current, RMS voltage values and phase angle in the Arduino IDE software.

The measured and calculated values have been sent to the ESP32 development board by using Arduino IDE software. The ESP32, cloud server and smartphone device communicate with each other with TCP/IP protocol via a Wi-Fi access point in the designed CIoT network.

Project

Smart Energy Monitoring System
Smart Energy Monitoring System

Circuit Diagram

Smart Energy Monitoring System Circuit Diagram
Smart Energy Monitoring System Circuit Diagram

Components Required

  • ESP32 Development Board
  • SCT-012 Current Sensor
  • ZMPT101B Voltage Sensor
  • 10uF/25V Capacitor
  • 10KΩ Resistor (x2)
  • 100Ω Resistor
  • 5 Volt Power Supply
  • Connecting Wires

About Parts of The Smart Energy Monitoring System

ESP32 Development Board

ESP32 Development Board
ESP32 Development Board

It is a low-cost, minimal-power system on a microcontroller with integrated Wi-Fi and Bluetooth facility. ESP32 is created and developed by Espressif Systems, a Shanghai-based Chinese company, and it is manufactured by TSMC using its 40nm chip technology. In this project, we can use ESP8266 NodeMCU but there is only one analog pin that comes with it. And ESP32 have so many analog pins. So according to our needs (Voltage and Current), we choose ESP32 in spite of ESP8266 NodeMCU.

Current Sensor (SCT-013)

SCT-013 100A Non-invasive AC Current Sensor
SCT-013 100A Non-invasive AC Current Sensor

This is a Non-Invasive current sensor that has been used to sense the accuracy of the current measurement. SCT-013 is a split core clamp-on current sensor. Because of this feature, the CT has been clamped onto the single phase of the wire. In the output section, an AC voltage is engaged in direct proportion to the AC current change in the single phase.

Voltage Sensor

ZMPT101B One-Phase Voltage Sensor
ZMPT101B Voltage Sensor

The 9V AC step-down transformer has been used here as a voltage sensor. But we could use ZMPT101B One-Phase Voltage Sensor for accurate sensing. It removes messy wire connections. But for reducing cost we use this method. The transformer provides insulation between high AC voltage and low AC voltage. The 9V transformer output terminal has been connected to the voltage divider circuit to bring this voltage to 0-5V. Thus voltage measurement can be made without requiring any high voltage operation.

Circuit Connection for Smart Energy Monitoring System

Now let me discuss the circuit diagram of the CIoT Based Smart Energy Monitoring System using the ESP32 IoT board. The circuit has been designed using EasyEDA software.

The connections are so simple. The ground pins of both the modules are connected with the ground pin of the ESP32. The output analog pin of the voltage sensor is connected to the GPIO35 of the ESP32. Similarly, the output analog pin of the SCT-013 current sensor is connected to the GPIO34 of the ESP32. After that two 10KΩ resistors and a single 100Ω resistor are connected along with a 10uF/25V electrolyte capacitor.

The 16×2 LCD display is used in this project for looking more professional and good look. But since we are working on an IoT device, it will work even if we don’t have an LCD display. Here we also use a 16×2 I2C LCD module for ease to use. Connect SDA and SCL terminals of the I2C module with D21 and D22 pins of the ESP32 respectively.

Note: In case you want to connect the LCD display, just connect the pin numbers 4, 6, 11, 12, 13, 14 of the LCD display to the ESP32 development board pins D13, D12, D14, D27, D26, D25 pins. Finally connect the 1, 5, 16 pins of the LCD display to the ground and 2 and 15 pin to 5V VCC. You can use a 10K variable resistor at pin 3 of the LCD to adjust the contrast.

Apart from that, we need to measure the real-time AC voltage that is connected to the input AC terminal of the voltage sensor. Similarly, the current sensor clip doesn’t have any connections, just clip a phase or neutral wire and lock it. Don’t clip both phase and neutral wires otherwise the reading will go wrong.

PCB Design

For removing messy wiring and give a clean look, I designed a PCB prototype for this project. It is also helpful for troubleshooting that runs great without any errors. To design this PCB board, I used EasyEDA as it is too easy to use. For ordering PCB for this, I prefer PCBWay.

Gerber file for Smart Energy Monitoring System Gerber.

You can view the Gerber file from here Gerber File Viewer.

PCB View

Smart Energy Monitoring System 2D View
2D View
Smart Energy Monitoring System 3D View
3D View

Order PCB From PCBWay

There are so many forums or communities for electronics online in today’s technical world, and one of the famous ones for PCB manufacturing is the PCBWay. PCBWay is a place that brings manufacturers and customers together. They have more than a decade of experience in this field of fabrication, prototyping and assembling PCBs. PCBWay have proved their focus to their customers’ needs in terms of cost-effectiveness, delivery, and quality.

How PCB Manufacturing Process Done in PCBWay

Standard quality for any product needs to be maintained using some parameters. PCBWay gives that opportunity by quality control in designing and manufacturing. At first, they ensure accuracy, clarity, validity of the PCB files that we sent to them.

Then all the boards will go through the most stringent tests other than the basic visual check. They adopt most of the testing and inspecting equipment used in the industry, such as Flying Probe Tester, X-Ray Inspection Machine, Automated Optical Inspection (AOI) Machine. PCBWay are having 50+ new engineers on the daily basis around the world using PCBs for their work, who trust for their reliable quality. They produce high-quality pink, orange, grey, even transparent solder mask. Moreover, according to people’s needs, they can also provide Black core PCB. Check it out for a High-Quality PCB solder mask. There are some pictures below of the new colours of solder musks.

Features of PCBWay

PCB Prototyping & Manufacturing: PCBWay produces FR-4 and Aluminum boards and advanced PCBs like Rogers, HDI, Flexible and Rigid-Flex boards, at a very reasonable price. Just check this Instant Quote to order premium PCBs for your hobby projects.

PCB Assembly: It not only offers PCB Prototyping but also offers PCB Assembly service. You can order a full PCB board with attached components by uploading your file. SMT & THT assembly starts from only 30$ including free stencil and worldwide shipping. The components can be sourced and provided by PCBWay, or by clients themselves.

Open Source Community: It not only offers PCB Prototype & Assembly service but also gives opportunities to students for sponsorships. I think this is so great. They feature their projects on the website also.

3D Printing & CNC: It also produces Rapid Prototyping like 3D printing, CNC Machining, Sheet Metal Fabrication, and Injection Molding. The quality of the product is too premium and reliable. And also the best part is that you will receive your order within a minimum of 3 days.

PCBWay Store: More boutique gift modules are waiting for you to discover, giving your creativity wings. You can order all types of electronic equipment, components and many more with exciting offers. Go with the link and buy your needs, PCBWay Store.

Services: PCBWay offers great servicing of their products. It takes only 3 to 15 days according to courier service to deliver your products. Also, it has a live support facility. Whenever you have any problems, you can always reach a live customer service person to respond to your emails or messages. They have the “Return and Refund” principle, for every unusable board caused by PCBWay, they will rebuild and refund the order soon.

Guide for Ordering PCB From PCBWay

Cloud Server Creation for Smart Energy Monitoring System

For this project, we use the Blynk application that runs over Android and IOS devices both to control any IoT devices using smartphone and computer dashboard. It allows you to create your graphical user interface for IoT applications. The values of RMS voltage, current, power factor and wattage are those which we want to display in our smartphone, Blynk does this work.

  • First download and install the Blynk application from Google Play Store. Also IOS users can download it from the IOS App Store. Once the process is done, start the app and sign-up using your email id and password.
  • After then create a new project from the dashboard and select ESP32 from drop-down and setup it as Wi-Fi mode.
  • Then drag and drop or add four widgets by clicking on top right corner tab and assign the variable as your desire.

For Blynk 2.0 Software

  • In the new Blynk 2.0 application, we need to just assign the template id, device id and password. It will be found in the template section. Just copy and paste it in the right section of your ESP32 programing code.

For Old Blynk Legecy Software

Some Library for Compiling the ESP32 Code

EmonLib

EmonLib library is used for monitoring electric energy, current and voltage continuously. So we use this library for our Smart Energy Monitoring System.

Blynk Library

Blynk is the popular IoT cloud server for connecting any hardware via the cloud. Using Blynk Library you can connect over 400 hardware models including Arduino, ESP8266 & ESP32 to the cloud server.

ESP32 Code

For compiling the code we also need the ESP32 board manager. Just click on File→Preferences→Paste the link in Additional Board Manager URLs→OK.

Link: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json.

Next click on Tools→Boards→Boards Manager→Search ESP32→Install→OK.

Video Output

8 thoughts on “Smart Energy Monitoring System Using ESP32 And SCT-013 Sensor”

  1. does i need to create data stream for this?? and also widgets??? Please help me. If yes, then how to do that????

    Reply
  2. Can it be used to create a prepaid meter . Does it will measure current and give output as kWh after calculations

    Reply
    • Yes it can measure current and voltage both and will give the calculations in kWh through lcd and smartphone. But for prepaid system you need to change some codes.

      Reply
    • You can connect only +5V supply to the Vin pin of the ESP32 board or if you use 5V Hi-Link AC DC converter module then it will be going easy. Just connect AC supply at AC part and DC output to Vin pin

      Reply
    • No you can’t replace with ESP8266 as it has only one analog pin. In case if you want to replace it, you need PZEM-004T voltage calm current sensor which is too costly.

      Reply

Leave a Comment