1. Introduction
Electricity consumption monitoring is an important aspect of modern homes and industries. With the advancement of IoT (Internet of Things), it is now possible to monitor energy usage in real time from anywhere in the world.
In this project, we will build a Smart Energy Meter using ESP8266 (NodeMCU) and sensors to measure voltage and current. The measured data is sent to the cloud using WiFi and displayed as live graphs using ThingSpeak.
This system helps users monitor power consumption, reduce electricity wastage, and improve energy efficiency.
2. Components Required
- NodeMCU ESP8266
- ACS712 Current Sensor
- Voltage Sensor Module
- Breadboard
- Jumper Wires
- Resistors
- Load (Bulb/Fan for testing)
3. Circuit Diagram / Connections
🔌 Connections:
⚡ ACS712 Current Sensor:
- VCC → 5V
- GND → GND
- OUT → A0 (NodeMCU via voltage divider if needed)
🔌 Voltage Sensor:
- VCC → 5V
- GND → GND
- OUT → A0 (through divider)
How to CONFIRM (Practical Method)
✔ Method 1: Using Multimeter
- Power the circuit
- Measure voltage at OUT pin of ACS712
- Check value:
- If ≤ 3.3V → Safe (no divider needed)
- If > 3.3V → MUST use divider ⚠️
- Powered via USB
- WiFi used for cloud communication
4. Circuit Working
- The ACS712 sensor measures current flowing through the load
- The voltage sensor measures supply voltage
- NodeMCU reads analog values
- Calculates:
- Current (A)
- Voltage (V)
- Power (W = V × I)
- Data is sent to ThingSpeak cloud via WiFi
- User can monitor readings from anywhere
5. Code
#include <ESP8266WiFi.h>
#include "ThingSpeak.h"
const char* ssid = "YOUR_WIFI_NAME";
const char* password = "YOUR_WIFI_PASSWORD";
WiFiClient client;
unsigned long channelID = YOUR_CHANNEL_ID;
const char* apiKey = "YOUR_API_KEY";
int sensorPin = A0;
void setup() {
Serial.begin(9600);
WiFi.begin(ssid, password);
ThingSpeak.begin(client);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting...");
}
}
void loop() {
int sensorValue = analogRead(sensorPin);
float voltage = sensorValue * (3.3 / 1023.0);
float current = voltage * 10; // calibration required
float power = voltage * current;
ThingSpeak.setField(1, voltage);
ThingSpeak.setField(2, current);
ThingSpeak.setField(3, power);
ThingSpeak.writeFields(channelID, apiKey);
Serial.println("Data Sent");
delay(15000);
}
6. Code Explanation
WiFi.begin()→ Connects to WiFianalogRead(A0)→ Reads sensor data- Voltage calculated from ADC value
- Current derived from sensor output
- Power calculated using formula:
👉 Power = Voltage × Current ThingSpeak.setField()→ Sends datawriteFields()→ Uploads to cloud
7. ThingSpeak Setup (VERY IMPORTANT)
📱 Step 1: Create Account
Go to ThingSpeak and sign up
📊 Step 2: Create Channel
- Click New Channel
- Add fields:
- Field 1 → Voltage
- Field 2 → Current
- Field 3 → Power
🔑 Step 3: Get API Key
- Go to API Keys tab
- Copy Write API Key
🔧 Step 4: Update Code
- Paste:
- WiFi name
- Password
- Channel ID
- API Key
📈 Step 5: View Output
- Open channel → See live graphs
8. Output
- Accessible from anywhere 🌍
9. Applications
- Home energy monitoring
- Industrial power tracking
- Smart grid systems
- Energy saving systems
10. Advantages
- Real-time monitoring
- Remote access
- Low cost
- Easy to implement
11. Disadvantages
- Requires calibration
- Depends on WiFi
- Accuracy limited
12. Future Scope / Improvements
- Add mobile notifications
- Integrate relay for auto cutoff
- Use smart meter IC for accuracy
- Mobile app integration
13. Conclusion
The Arduino-based Smart Energy Meter using ESP8266 and ThingSpeak is an efficient and modern solution for monitoring electricity consumption in real time. By integrating current and voltage sensors with IoT technology, the system allows users to track power usage from anywhere through cloud-based graphs and dashboards.
This project demonstrates how embedded systems and IoT can be combined to create practical, real-world applications that improve energy management and awareness. Although basic in design, it provides a strong foundation for developing more advanced smart metering systems.
With further enhancements such as automation, alerts, and improved accuracy, this system can be transformed into a complete smart energy management solution suitable for homes, industries, and research applications.