ESP32-Based Energy Meter Project (Introduction)
on
In the field of engineering, combining the right technologies can lead to significant advancements. This project aims to develop an energy meter using the Espressif ESP32 microcontroller and Microchip’s ATM90E32AS energy metering IC. In this article, the beginning of this project’s journey is briefly shared, from component selection to prototyping. The goal is straightforward: to create a reliable system for accurate energy measurement from your home or workshop’s main circuit box. This meter will enable users to track their power consumption in real time, offering insights that can lead to more efficient energy use.
![esp32 energy meter elektor intro](https://cdn.xingosoftware.com/elektor/images/fetch/dpr_1,w_720/https%3A%2F%2Fwww.elektormagazine.com%2Fassets%2Fupload%2Fimages%2F42%2F20240711181352_esp32-energy-meter-elektor-intro.png)
Design and Requirements
The project has clear goals and design requirements: real-time monitor single-phase power using three current transformers (CTs), keep it affordable, and make it user-friendly. The choice of ESP32 and ATM90E32AS IC components was guided by these aims, offering both cost-effectiveness and reliable performance. Another target was to keep the size smaller than 100×80×30 mm (L×W×H) to ensure that it can be accommodated in a circuit breaker box. To enhance the user experience, a mobile interface is also included for remote monitoring, as well as an OLED display with buttons for direct interaction. The design also allows for future software updates, ensuring long-term utility for the consumer. In Figure 1, the rendering of the current prototype enclosure is shown.
Microcontroller Selection
The choice of the ESP32 microcontroller was predicated on a detailed analysis of its capabilities. The chip excels in several areas crucial to the success of this project. First, its ease of integration into varied circuit designs provides flexibility during the engineering phase. Second, its cost-effectiveness makes it an attractive choice for a prototype that aims to balance performance and budget. Third, the compatibility with a wide range of sensors and ICs offers significant advantages. Lastly, the extensive community support for ESP32 chip augments its suitability for this project. Figure 2 highlights the ESP32-D0WD-V3’s main features and advantages resulting in its being selected for this project.
![esp32 main features](https://cdn.xingosoftware.com/elektor/images/fetch/dpr_1,w_720/https%3A%2F%2Fwww.elektormagazine.com%2Fassets%2Fupload%2Fimages%2F42%2F20240711181632_esp32-meter-2.png)
Metering IC Integration
The ATM90E32AS IC from Microchip was integrated according to the manufacturer’s application note; the document served as a cornerstone in ensuring that the energy metering IC communicated seamlessly with the ESP32 microcontroller. However, this phase was not devoid of challenges. The procurement of the correct components within budget constraints required meticulous planning, given the constraints on availability. In Figure 3, the application note provided by Atmel (now Microchip) in shown.
![Circuitry around the metering IC](https://cdn.xingosoftware.com/elektor/images/fetch/dpr_1,w_720/https%3A%2F%2Fwww.elektormagazine.com%2Fassets%2Fupload%2Fimages%2F42%2F20240711181821_esp-meter-fig3.png)
Design Phase and Electrical Safety Standards
The design phase is indeed a pivotal part of the engineering process, particularly when safety is an indispensable consideration. In a device designed to interact with mains AC voltages, meticulous attention must be paid to conformance with established safety standards. In Figure 4, the project’s block diagram is shown.
To ensure safety, several specialized electrical components were integrated into the design. Metal oxide varistors (MOVs) were used for transient voltage suppression to protect the circuitry from voltage spikes. Furthermore, fuse components were included as an essential failsafe to prevent overcurrent conditions.
![esp32 meter fig4.png](https://cdn.xingosoftware.com/elektor/images/fetch/dpr_1,w_600,h_455,c_fit/https%3A%2F%2Fwww.elektormagazine.com%2Fassets%2Fupload%2Fimages%2F42%2F20240711182351_esp32-meter-fig4.png)
Beyond component selection, circuit design also focused on layout considerations that would abide by safety norms. Adequate creepage and clearance distances were maintained between the conductive elements on the PCB to prevent electrical arcing. Trace widths for AC voltage lines were calculated carefully to handle the current ratings, adhering to IPC-2221 standards . This was critical in ensuring the thermal performance of the board under full-load conditions. To ensure ground integrity, a solid ground plane was used. Special attention was given to the design of differential pairs for signal integrity, making sure that the routing followed precise geometry to minimize electromagnetic interference.
Manufacturing Selection: Opting for JLC PCB
After scrutinizing various PCB assembly services, JLC PCB was selected. The principal reason for this choice was the balance of cost-effectiveness and reliability that they offer. This decision was important in keeping the project within budget without compromising on the quality of the assembled board. Currently, the prototype schematic and PCB designs are being finalized, and they will soon be sent for production.
Reflecting on the Journey and Looking Forward
In retrospect, this project shows what can be achieved when careful planning meets good engineering. The hurdles we faced helped us improve our design. As we move from making a prototype to possibly mass-producing it, we expect it to make a real difference in how people manage energy. This project will be detailed in upcoming editions of this magazine — we’re still in the process of getting the prototype made, tested, and working, on the software that will run it. There’s more to come, so stay tuned for updates on this project. We will near completion and share updates in the January/February 2024 edition of Elektor, which is dedicated to the topic of Power & Energy.
This article originally appeared in Elektor Guest-Edited by Espressif (230646-01). Check out the ESP32-Based Energy Meter Series.
Discussion (0 comments)