
ESPEasy can turn an inexpensive ESP board into a capable energy monitor. With the right measurement module, a node can report voltage, current, real power and accumulated energy, then share those figures with Home Assistant, Domoticz or a logging service. For anyone curious about where electricity goes in a home, a workshop or a small office, it offers detailed insight at very modest cost.
Energy monitoring also involves mains electricity, which demands respect. This article covers the supported hardware, how each type connects, how to calibrate readings and how to use the data, while making clear where professional help is essential.
A Word on Safety First
Mains voltage can cause serious injury, death and fire. Any work that involves connecting equipment to mains wiring, opening consumer units or modifying fixed installations should be carried out by a qualified electrician, in line with local regulations.
The safest approaches avoid live wiring altogether. Ready-made smart plugs with built-in metering, DIN-rail meters installed by an electrician and modules that use clamp-on current transformers all reduce the risk considerably. Never connect mains voltage directly to a development board, and never work on a circuit that is powered.
The firmware is not a certified safety device. It is excellent for monitoring and for non-critical automation, but it should never be the only protection against overloads or faults.
Supported Energy Hardware
The firmware supports several families of energy measurement hardware, and the project produces dedicated energy builds that bundle the relevant plugins together.
HLW8012 and BL0937 Chips
These measurement chips are found inside many smart plugs and switches, including early Sonoff POW models. They produce pulse signals whose frequency corresponds to voltage, current and power. The HLW8012 plugin reads these pulses and converts them into meaningful values. Because the chips are already built into finished products, they offer a relatively safe route into energy monitoring, provided the device is flashed while disconnected from the mains.
CSE7766
The CSE7766 appears in devices such as the Sonoff POW R2 and some smart plugs. Rather than producing pulses, it sends measurements over a serial connection, which the corresponding plugin interprets. As with the HLW8012, it usually arrives inside a finished, enclosed product.
PZEM-004T Modules
The PZEM-004T version 3 is a popular standalone module that measures voltage, current, power, energy, frequency and power factor. It communicates over a TTL serial interface using the Modbus protocol, and current is measured with a current transformer through which the load's live conductor passes.
The illustration accompanying this article shows the typical arrangement: an ESP-12E module connected to the meter's serial port, with a current transformer measuring the load. On the low-voltage side, the module's transmit and receive lines connect to the ESP's serial pins. The mains side of the module, however, must be wired by someone qualified, inside a suitable enclosure.
Eastron SDM and Other Modbus Meters
DIN-rail meters such as the Eastron SDM series are designed for permanent installation in a consumer unit. They provide accurate readings over RS485 Modbus. Connecting one to an ESP board requires an RS485 transceiver module, such as one based on the MAX485 chip, between the meter and the board. Because these meters are installed alongside fixed wiring, their installation is firmly a job for an electrician, while the low-voltage RS485 connection can then be made safely.
Other Modbus meters, including the DDS238 series, are supported by dedicated plugins in builds that include them.
Choosing a Build
Energy plugins are not all included in the normal build, especially on ESP8266 boards where flash space is limited. The project produces energy builds for this purpose. Check the documentation's plugin overview to confirm that the plugin for your hardware appears in the build you intend to use, and choose a build that matches your chip and flash size.
Configuring a Meter Task
Once the firmware is installed, open the Devices tab and add a task using the plugin for your hardware. The settings vary by plugin but typically include:
- The serial pins or pulse input pins connected to the meter.
- The Modbus address, for Modbus meters, which must match the address set on the meter itself.
- The values to report, such as voltage, current, power and energy.
- The reading interval.
After saving the task, the readings should appear on the Devices tab within a few moments. If they do not, check the wiring of the low-voltage connections, confirm that transmit and receive are crossed correctly and verify the Modbus address.
Calibration and Accuracy
Readings from built-in chips such as the HLW8012 often need calibration, because component tolerances vary between devices. The usual approach is to connect a known resistive load, such as a filament lamp or heater with a known rating, and compare the reported values with those from a trusted reference meter. The plugin settings allow you to adjust the calibration factors until the readings agree.
Standalone modules such as the PZEM-004T and DIN-rail meters are generally factory calibrated and need little adjustment. Even so, it is worth comparing their readings with a reference occasionally, particularly after installation.
Remember that inexpensive modules are intended for monitoring and insight rather than billing. Your utility meter remains the authoritative record of consumption.
Using the Data
Energy readings become most useful when they are recorded and visualised over time.
- Send readings to Home Assistant through MQTT and use its energy dashboard to track consumption by day, week and month.
- Use the Domoticz controllers to create energy and power devices with historical graphs.
- Send data to services such as Emoncms or ThingSpeak through their dedicated controllers for long-term logging.
- Show live power on a small OLED display attached to the same node for an at-a-glance view.
Rules can add local intelligence. A rule might publish an alert when power exceeds a threshold, switch off a non-essential load during periods of high demand or record the energy used by an appliance during each cycle.
Practical Monitoring Ideas
Energy monitoring often reveals surprising patterns. Monitoring a fridge or freezer shows how often its compressor runs and can highlight a failing seal. Tracking a washing machine or dishwasher reveals how much each programme costs. Monitoring a workshop circuit shows which tools draw the most power. Whole-house monitoring, installed by an electrician, identifies the baseline load that runs continuously, which is often the easiest saving to find.
Common Problems
- No readings appear: check the low-voltage serial wiring and confirm that transmit and receive are crossed.
- Modbus meters do not respond: verify the meter's address, baud rate and the RS485 wiring polarity.
- Readings are clearly wrong: calibrate against a known load and a reference meter.
- Values jump erratically: check the current transformer's orientation and connection, and make sure the board has a stable power supply.
- The plugin is missing: install an energy build that includes the plugin for your hardware.
Interpreting the Measurements
Energy modules report several related values, and understanding the difference between them makes the data more useful.
Voltage is the electrical pressure supplied by the mains, which varies slightly throughout the day. Current, measured in amperes, is the flow drawn by the connected load. Real power, measured in watts, is the rate at which energy is actually consumed. Energy, measured in kilowatt-hours, is the accumulated total over time and is the figure that appears on electricity bills.
Many modules also report power factor, which describes how effectively a load uses the current it draws. Resistive loads such as kettles and heaters have a power factor close to one, while motors, power supplies and some lighting can have lower values. A low power factor explains why current readings may seem high compared with the real power shown.
Frequency is usually reported too. It remains very close to the nominal mains frequency and is mainly useful as a sign that the module is reading correctly.
Storing and Resetting Energy Totals
Accumulated energy totals behave differently depending on the hardware. Standalone meters such as the PZEM-004T and DIN-rail meters keep their own running totals, which survive a restart of the ESP board. Totals calculated by built-in chips may reset when the device loses power unless they are stored or tracked elsewhere.
For dependable long-term figures, let your home automation platform or logging service record the readings and calculate totals over time. Home Assistant's energy dashboard, for example, can work from a steadily increasing energy value and present consumption by hour, day or month. Where a meter supports resetting its counter, do so deliberately and note the date, so that historical comparisons remain meaningful.
Readings are also more meaningful when compared over consistent periods. Comparing one week with the next, or the same appliance before and after a change in habits, shows the real effect of adjustments such as lowering a thermostat or replacing an old appliance. Keeping notes about such changes alongside the data turns raw numbers into practical lessons about where savings are genuinely possible.
Frequently Asked Questions
Can ESPEasy measure electricity usage?
Yes. With supported hardware such as the HLW8012, CSE7766, PZEM-004T or Modbus meters, it can report voltage, current, power and energy.
Which build should I use for energy monitoring?
Use an energy build, or another build that includes the plugin for your meter. Check the plugin overview in the documentation before flashing.
Is it safe to build my own energy monitor?
Low-voltage connections are straightforward, but any mains wiring should be carried out by a qualified electrician. Ready-made metering plugs and clamp-on current transformers reduce risk.
Do I need to calibrate the readings?
Built-in chips in smart plugs often need calibration against a known load. Standalone modules and DIN-rail meters usually need little or none.
Can I see energy data in Home Assistant?
Yes. Send readings through the MQTT controller and add them to Home Assistant's energy dashboard.
Can the readings be used for billing?
No. Inexpensive modules are suitable for monitoring and insight, while your utility meter remains the official record.
Conclusion
ESPEasy offers an accessible way to understand electricity use, from a single appliance to a whole circuit. Choose supported hardware, install an energy build, configure and calibrate the meter task and send the data to a platform that can chart it over time. Above all, treat mains electricity with the seriousness it deserves and leave high-voltage wiring to qualified professionals.