It is an intelligent energy consumption management system of separate devices based on CT Sensor.
Devices and components
Arduino Uno Rev3
Cable assembly, 6 position Mini CT socket
Current voltage multimeter module
NodeMCU ESP8266 Breakout Board
LED bulb, frosted GLS
Jumper wires (generic)
Project description
Smart energy consumption meter
So, with a computerized or smart electricity meter, we can get more accurate and robust measurements.
It can also be used to limit energy consumption when it is known that household electricity consumption has exceeded the relevant units, thereby saving energy and controlling energy consumption.
We can monitor the electrical system more quickly.
We must also guarantee the security of the house so that no outside person is forced to measure electricity consumption.
AC voltage test range 80-260V, working voltage 80-260V, maximum current can reach 100A.
Electrical parameter measurement function, including measurement of voltage, current, active power and energy.
Designed for testing high power equipment and you can observe the accumulation process intuitively for low power load testing (less than 100W).
Equipped with TTL serial data communication interface, you can read and set relevant parameters through the serial port.
Operating voltage: 80 ~ 260 V AC.
Test Voltage: 80~260V AC
Rated power: 100A/22000W.
Working frequency: 45-65 Hz
Measuring accuracy: ±1.0%
Board size: 7.3x3cm/2.87x1.18"
Current transformer size: 3.1x2.9x4.7cm/1.22x1.14x1.85"
Wire Length: 20cm/7.87"
Manual meter readings are no longer necessary.
Increase the monitoring speed of the electrical system.
Provide real-time data to balance electrical loads and reduce power outages.
Enabling more efficient use of energy resources.
Save money by not having to build new power plants.
Transition to new technologies and procedures.
Manage public reaction to new meters, as well as consumer acceptance.
Manage and archive massive amounts of counting data.
Arduino code
Upload this code to the ESP-32 device by connecting it to Arduino.
1#include <WiFi.h>
2#include <WiFiClient.h>
3#include <WebServer.h>
4#include <HTTPClient.h>
5#include <PZEM004Tv30.h>
6
7PZEM004Tv30 pzem(Serial2, 16, 17);
8
9const char *ssid = "Huawei Y7";
10const char *password = "12345678";
11const char *host = "http://vishwasdiaries.c1.biz";
12
13
14void setup() {
15
16 // pzem.resetEnergy()
17
18 delay(1000);
19 Serial.begin(115200);
20 WiFi.mode(WIFI_OFF);
21 delay(1000);
22 WiFi.mode(WIFI_STA);
23 WiFi.begin(ssid, password);
24 Serial.println("");
25
26 Serial.print("Connecting");
27
28 while (WiFi.status() != WL_CONNECTED) {
29 delay(500);
30 Serial.print(".");
31 }
32
33
34 Serial.println("");
35 Serial.print("Connected to ");
36 Serial.println(ssid);
37 Serial.print("IP address: ");
38 Serial.println(WiFi.localIP()); //IP address assigned to your ESP
39
40}
41
42//=======================================================================
43// Main Program Loop
44//=======================================================================
45void loop() {
46
47Serial.print("Custom Address:");
48 Serial.println(pzem.readAddress(), HEX);
49
50 // Read the data from the sensor
51 float voltage = pzem.voltage();
52 float current = pzem.current();
53 float power = pzem.power();
54 float energy = pzem.energy();
55 float frequency = pzem.frequency();
56 float pf = pzem.pf();
57
58 // Check if the data is valid
59 if(isnan(voltage)){
60 Serial.println("Error reading voltage");
61 } else if (isnan(current)) {
62 Serial.println("Error reading current");
63 } else if (isnan(power)) {
64 Serial.println("Error reading power");
65 } else if (isnan(energy)) {
66 Serial.println("Error reading energy");
67 } else if (isnan(frequency)) {
68 Serial.println("Error reading frequency");
69 } else if (isnan(pf)) {
70 Serial.println("Error reading power factor");
71 } else {
72
73 // Print the values to the Serial console
74 Serial.print("Voltage: "); Serial.print(voltage); Serial.println("V");
75 Serial.print("Current: "); Serial.print(current); Serial.println("A");
76 Serial.print("Power: "); Serial.print(power); Serial.println("W");
77 Serial.print("Energy: "); Serial.print(energy,3); Serial.println("kWh");
78 Serial.print("Frequency: "); Serial.print(frequency, 1); Serial.println("Hz");
79 Serial.print("PF: "); Serial.println(pf);
80
81 }
82 HTTPClient http;
83
84 String postData;
85
86String svoltage = String(voltage);
87String scurrent = String(current);
88String spower = String(power);
89String senergy = String(energy,3);
90String sfrequency = String(frequency,1);
91String spf = String(pf);
92
93 postData = "voltage=" +svoltage + "¤t=" + scurrent+ "&power=" + spower+ "&energy=" + senergy+ "&frequency=" + sfrequency+ "&pf=" + spf;
94
95 http.begin("http://vishwasdiaries.c1.biz/test.php"); //Specify request destination
96 http.addHeader("Content-Type", "application/x-www-form-urlencoded"); //Specify content-type header
97
98 int httpCode = http.POST(postData); //Send the request
99 String payload = http.getString(); //Get the response payload
100
101 Serial.println(httpCode); //Print HTTP return code
102 Serial.println(payload); //Print request response payload
103
104 http.end(); //Close connection
105
106 delay(5000); //Post Data at every 5 seconds
107}
108
Downloadable files
Wiring diagram with NodeMCU
The diagram above shows how the CT Sensor, Multimeter and Node MCU devices are connected to each other in relation to the overall system. The above clearly shows how the data from the CT sensor is connected to the multimeter and then to the MCU node. The multimeter and CT sensor have several pins. They are interconnected. The CT sensor has several main pins such as Gnd, Tx, Rx and 5V. Rx and Tx are used to communicate with the host computer[7] to which the object code being compiled is downloaded.
The PZEM-004T V3 and ESP-32 Node MCUs theoretically operate in communication over different voltage levels, but in practical life the 3.3V Node MCU pins have a tolerance of 5V. The VU pin is a 5V USB pin (only works when the Node MCU is powered via USB)
However, Node MCU has 11 pins. Of these, two pins are separated by Rx and Tx, leaving nine more. These are called I/O pins. They are named from D0 to D8. As mentioned above, the multimeter is only connected to a few pins of the Node MCU. These are Gnd, D6, D5 and 5V. The Gnd pin of the CT sensor connected to the Node MCU itself. Additionally, the Tx pin is connected to the D5 pin of the Node MCU. The Rx pin of the CT sensor is connected to pin D6. The 5V voltage provided by the CT sensor is connected to the 5V of the Node MCU itself.
Wiring diagram with NodeMCU
Documentation
pzem-004t-100a-wiring-diagram_LhS1ncKEP3.jpg
Please allow 1-3mm error due to manual measurement. please make sure you do not mind before bidding
Due to the difference between different monitors, the picture may not reflect the actual color of the item. THANKS!
No Retail Package
The package includes:
1 x Multimeter Module (USB adapter is not included)
1 x split core current transformer
pzem-004t-100a-wiring-diagram_LhS1ncKEP3.jpg
Note: Content and images are from: https://projecthub.arduino.cc/, with some modifications.
If you want it removed due to copyright reasons, please leave a comment. Thank you.
I want to share this article more widely so that everyone knows about Arduino and your project.