Background
My father and I decided to install photovoltaic (PV) panels at home to help reduce our electricity costs. After installation, it was difficult to know exactly how much energy was produced by the system and how much savings we actually made. Most of our estimates were only rough guesses. To solve this, I decided to build a system to monitor our power usage and generation. This project also became a hobby that I truly enjoyed working on together with my father.
Web Application
I developed a fullstack power monitoring web application using Next.js. The system exposes an API endpoint for posting sensor readings collected by our sensors. On the front end, the dashboard presents real time and daily summaries of electrical data, with some key features:
- Daily Report: Displays a graph of grid, PV & battery, and inverter power usage over a day. It also displays electricity statistics (total energy, power range, voltage range, etc.) for grid, PV & battery, and inverter.
- Monthly Report: Displays an intuitive graph of total energy usage for a month across the grid, PV & battery, and inverter.
- Live Monitoring: Displays sensor readings in real time.
The daily report dashboard provides an intuitive summary. For example, in the screenshot below (see image), you can see how the energy usage shifts throughout the day, from early morning reliance on the grid to PV & battery taking over during the daylight hours.
Sensor & IoT Implementation
To measure the electrical parameters, I used two PZEM-004T sensors to monitor AC voltage, current, power, energy, power factor, and frequency, one at the grid-to-inverter connection and another at the inverter-to-load connection.
Simple diagram:
PV & Battery → Hybrid Inverter → House Load
Grid →-----------^
Both sensors are connected to an ESP32 microcontroller which collects readings and sends them to the web API every 5 minutes (technically, every 4 minutes and 30 seconds due to some timer inaccuracy on the microcontroller; this is handled server-side to avoid duplicate readings).
This setup allows us to have accurate, time-stamped measurements of how much power is being drawn from the grid, how much is provided by the solar and battery system, and how that varies over the course of each day.
Results and Analysis
The chart clearly shows:
- Grid supply is dominant overnight and early in the morning.
- PV & battery contribution rises during the day, reducing grid reliance.
- There are clear “switching” points as the system dynamically shifts the load source.
- By visualizing the data, we now have a clear, quantitative understanding of how much solar contributes to our daily energy needs and when the grid is most required.
Conclusion
This project gave me valuable insights into both energy usage and system design. It provided my family with accurate feedback on our solar investment, beyond just vague estimations. I’m excited to further improve the system with additional features, such as live alerts or historical analytics. If you have any feedback or ideas, feel free to share. Thank you for reading!

Top comments (0)