Solar Energy Meter

by julianiot in Circuits > Sensors

1304 Views, 4 Favorites, 0 Comments

Solar Energy Meter

v1.0-box-test-top.png

I have always wanted to measure the exact yield of our small solar system. I started to remove an old Ferraris meter from the cellar and use it to measure the yield. To record the data digitally, I stuck a color sensor on the meter and tried to read the meter. That worked quite well. With an ESP8266 I transferred the data to my server to evaluate it there. But that only works well when the sun is shining and a lot of energy is fed into the house. Therefore I built my own energy measuring system.

Supplies

ESP-07S WiFi module based on ESP8266EX-IC with 32Mbit flash memory

HLK-PM01 power supply

ADE7757A / AD71056 Energy Metering IC with Integrated Oscillator and Reverse Polarity Indication

custom pcb

I designed the circuit board for this case: https://www.aliexpress.com/item/32907871269.html?s...

a few passive components

This Is How I Started Measuring the Produced Energy...

media-d16c0d50.jpg

How Do You Measure AC Power?

4281fig01.gif

Measuring power is actually not difficult. Power = voltage * current. And energy = power * time. Everyone knows that. But does it also work with alternating voltage? Yes, these laws also apply to alternating voltage and current. Now measuring is a little bit more difficult, because you have to measure positive and negative voltages. After you have multiplied the voltage and current (= power which you have to average to get a stable value), you also have to calculate the integral over time to calculate energy, because the power changes over time. That's why I started looking for IC, which can do this job for me. I was very impressed by the ICs from Analog Devices. In the end I decided to go for the AD71056. It is relatively cheap, needs only few external components and has a digital interface. That is all I wanted.

Image from maximintegrated.com

The Schematic

schem.png

I decided to use a 4-wire shunt because it measures more accurately. Since I did not want to design a power supply myself, I decided to use a power supply module. This module needs almost no external components and is therefore a compact solution. Since I wanted to have the longest possible range, I decided to use the ESP-07S module. I can attach an external antenna to this module and it also has 4Mb flash memory. The large memory is also important because I want to store in the internal file system the measurement points that could not be transferred.

Designing the Circuit Board

board.png

Designing the circuit board was a new small challenge. It was my first circuit board with mains voltage and I didn't want anything to go wrong. Therefore it was very important to define net classes, so that the tracks have the right width and distances to each other. I calculated the minimum width and distance of the tracks with the online calculator of 7pcb.com.

Looking at the PCB Preview

v1.0-box-test-top.png
v1.0-box-test-bottom.png

After you have finished the board, you should see if you like it too. Eagle offers you a preview right away.

Order Your PCB

sreen cap jlcpcb.png

When you are sure that everything is ok, you can order the board. When I started with Eagle, I still made some of the boards myself. But it soon became clear that this process is too complex for more complex projects. Since a while I order my boards from jlcpcb. I have already ordered a few and I am very satisfied with the quality and delivery time. The price is also very good.

The Software Part

The AD71056 generates pulses whose frequency depends on the power measured by the IC. The pulses trigger an interrupt in ESP, which increases counter. So not only the energy but also the power can be calculated. The energy results from the counter and the power from counter/time.

The ESP has a software system clock that can be synchronised with an NTP server. So you can also save the time of data points when the internet is broken.

The data is stored in the internal file system. This can be accessed very easily. As on the computer, there are commands to create new files, open them and write lines. Of course you can also read the files again. The program automatically creates a new file when the file size reaches 6KB. This ensures that the stored data can be transferred easily.

ESP file system: https://arduino-esp8266.readthedocs.io/en/latest/f...

Solder the Components

Even if SMD components are relatively small, they can still be easily soldered by hand. You do not need expensive equipment, a simple soldering iron is sufficient.

Test the PCB

Program the ESP

If now all components are on the board, we still have to upload the program. There is a pin row on the board for this.