First of all, please bare with me. This is my first Instructable.
In June 2015 we got our 1kW solar panel system installed. It is an on-grid system, so excessive energy is send back into the public network. We started the process with the local energy supplier Meralco to get registered for “net-metering”. “Net-metering” means that we get paid for energy that we send back into the public network. But we stopped in the middle of the process, because it was tiring, complicated and the additional requirements (additional breaker, evtl. additional watt meter, updated electrical plan by a certified electrician, ...) would have cost us a lot of money.
Without having net-metering we are invoiced for every kWh that is send back to the net as if we have consumed it. The net meter counting our consumption is a modern digital style, he shows whether we are consuming energy from the net or if we are sending out energy. (See image above).
Inside the red rectangle the net meter says either Receiving (energy supplier is receiving energy from us) or Delivered (we receive energy from the the energy supplier). But the counter goes up in both situations.
As we have only a small 1kW system and we are at home during the day we decided to just adjust our energy consumption so that we do not push back too much energy into the public network. But how to know if the solar system is producing more energy than we are consuming? The supplier of the micro inverters offers a monitoring system. But the cost is 10% of what we paid for the whole system. Too much! And on top it is a proprietary system, using power line communication but the protocol is not available (One of the things I hate in this world!). To monitor we are limited to use our web browser and get the data from the companies web server, where they store all the information they receive from our system. So I started searching on the internet for an alternate solution to monitor our power consumption and production. The best site I found is: OPENENERGYMONITOR.
Everything I did on the monitor system side I could only do with the information, source codes and hardware explanations I found on their site. And when I got stuck, their forum is very helpful for research and to get answers.
I decided to build up my own system instead of buying a pre-built system from their shop. The monitoring system can be split into 3 parts:
Luckily for 1) and 3) only one device is necessary. This is possible with the Arduino Yun
This nice small and affordable piece of electronic has an 8bit Atmel AVR ATmega32U4 microcontroller to do real-time measurement and in addition a Linux system based on the Atheros AR9331. The Atheros runs a Linux distribution based on OpenWrt named OpenWrt-Yun. The board has built-in Ethernet and WiFi support and a SD card slot. Perfect for IoT solutions. Of course the web server has limited performance, but for my requirements it is sufficient. The built-in Ethernet and WiFi gives the connectivity needed and the SD card provides the storage to save the recorded data in a database.
The Android application 4) was developed from scratch, but thanks to STACKOVERFLOW it was no problem to find the necessary libraries and answers to upcoming problems during the development..
For the sensors and the Arduino board I found Circuit-Help as a reliable and customer friendly company here in Manila! A list of all parts used in this project can be found on the last post of this series. All schematics and source code can be found on my Github repository spMonitor.
Now head over to the next step, where I explain the measurement electronics.
This step will go into details of the used hardware.
To connect the different sensors I build a “shield”. In the Arduino world a shield is an extension board that is plugged on top of an Arduino board. The Arduino has most of the analog input ports, digital I/O ports and communication ports on headers located on the side of the board.
The sensor connection shield I build to connect the different sensors is plugged into these headers.
For the current measurement 2 CT (current transformers) are needed. One is measuring the current coming from the solar panels, the second one is measuring the house main line current. For calculation of the power the voltage is measured as well with a voltage transformer. I plan as well to mount a light sensor next to the solar panels. The light sensor will be connected with an i2c serial connection. But for now this is not implemented.
The Arduino analog input ports accept a maximum voltage of 5V. Therefor the analog signals must be adapted by a circuit to match with these specifications.
OpenEnergyMonitor has very good tutorials for connection the CT sensors (including calculation of burden resistors and calibration values) in their CT sensors – Interfacing with an Arduino building block. The only CT sensor I could find was a 100A type (YHDC SCT-013-000). As my currents are not reaching 100A, I re-calculated the burden resistors to match my requirements. For the main line I used a 165 Ohm burden resistor, which allows a maximum measurement of 20A which is more than enough for our house consumption. For the solar panels I chose a 330 Ohm burden, which allows a maximum of 10A, which is more than enough for a 1kW system. For calculation of the burden resistors please check the link to the OpenEnergyMonitor building block.
For the voltage measurement circuit I found as well a tutorial at OpenEnergyMonitor. Check out the Measuring AC Voltage with an AC to AC power adapter building block. Instead of using a AC/AC wall plug I decided to get a cheap 220V/9V voltage transformer and integrate it into the box with the Arduino hardware.
For the light sensor I chose a module from Adafruit. This module has the advantage that it has two sensors which are measuring the visible and IR parts of the light. The light sensor communicates with the Arduino over an i2C interface. The pins of the sensor are directly connected to the Arduino header pins.
The full circuit schematic is shown above. Basically it is not very complicated.