IoT Based Energy Consumption Cost Calculator Using ESP8266

In this project, an open-source and modular IoT based energy consumption cost calculator 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 voltage values will be constant and the current will be varying according to the current sensor SCT-013 (upto 30A) connected to the ESP8266 NodeMCU board. Real-time power, current and total kilowatt can be calculated by using measured current, voltage values and phase angle.

These measured and calculated values have been sent to the ESP8266 NodeMCU board by software serial method. The ESP8266 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 mobile application with TCP/IP protocols. This system shows the actual energy consumption as well as total costs per month. Experimental studies prove that this system could be used in general-purpose applications such as IoT energy monitoring systems for smart home automation systems.

Must Read Smart Energy Monitoring System Using ESP32

Principle Behind Energy Consumption Cost Calculator

In this project, the SCT-013 current (CT) sensor is used for single-phase current measurement. We can calculate the total power, current and apparent power values using the measured current, RMS predefined voltage values and phase angle in the Arduino IDE software.

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

Project

Energy Consumption Cost Calculator

Circuit Diagram

Energy Consumption Cost Calculator Circuit Diagram
Energy Consumption Cost Calculator Circuit Diagram

Components Required

  • ESP8266 NodeMCU
  • SCT-013 Current Sensor (Upto 30A) [ Buy Now ]
  • 5 Volt Hi-Link AC-DC Converter
  • 10KΩ Resistor (x2)
  • 100Ω Resistor
  • Veroboard
  • Wires

Circuit Connection Energy Consumption Cost Calculator

Now let me discuss the circuit diagram of the IoT based energy consumption cost calculator system using the ESP8266 board. The circuit has been designed using EasyEDA software.

The connections are so simple. The ground pin of the sensor is connected with the ground pin of the ESP8266. The output analog pin of the voltage sensor is connected to the A0 pin of the ESP8266. After that two 10KΩ resistors and a single 100Ω resistor are connected along with a 10uF/25V electrolyte capacitor.

Apart from that, we need to measure the real-time AC current that is connected to the AC phase wire. 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 Energy Consumption Cost Calculator Gerber.

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

PCB View

Energy Consumption Cost Calculator 2D View
2D View
Energy Consumption Cost Calculator 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 Energy Consumption Cost Calculator

For this project, we use the Ubidots application that runs over Android and IOS devices as well as a web browser to control any IoT devices using smartphones and computer dashboards. It allows you to create your graphical user interface for IoT applications.

  • First download and install the Ubidots 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.
  • Now click on Devices→Devices→click on the Add New Device button→select Blank Device→type device name→finally click on create button which is symbolized with green tick. So you succesfully create your own device.
  • Go inside your device and now here add variables. Select Add Variables→select Raw→name the variable as “Current”. After successfully create a variable, click on the Ubidots logo from the upper left hand side which will open the home page
  • Here click on Add New Widget→select Gauge→click on Add Variables→now go inside nodemcu→select Current. Now here we need to name the variable as Current and define the range as 0 to 30.
  • Now we need to enter the token in the code and for that click on Profile→Api Credentials→click on blank space of the default token section→when the token visible copy this.
  • For adding rupees in amount, we just need a synthetic variable. For that go to Devices→Devices again→enter into the “nodemcu”→Add Variables→select Synthetic. We can add different types of modified calculations for our needs. For now first select “nodemcu”→then Current.
Ubidots Synthetic Variable

These two sections i.e., “voltage = 235” and “amount in rupees = 6” will change according to different locations.

The formula for rate of current in rupees ((235*(current (nodemcu))*6)/60000).

  • Do the same process as adding current variable into the dashboard.
Ubidots Dashboard

NodeMCU Code

For compiling the code we also need the ESP8266 board manager. Just click on File→Preferences→Paste the link in Additional Board Manager URLs→OK. Link: http://arduino.esp8266.com/stable/package_esp8266com_index.json. Next click on Tools→Boards→Boards Manager→Search ESP32→Install→OK.

Also, we need additional library files i.e., Ubidots-MQTT-ESP, PubSubClient.h to compile the code.

Leave a Comment