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:

  1. An Arduino based measurement system
  2. The necessary sensors
  3. A Linux based web server
  4. An Android application to visualize the data.

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.

<p>hello Beegee, Hope you are doing well.</p><p>I went through all of your code on Github. But I could not understand how this sketch decides if power is exported or imported. Can you please explain. </p><p>Thank you</p>
Hi Ambalika,<br>Quite easy to detect. If the current value read from the sensor is positive, then you are exporting energy. If it is negative, then you are importing energy.
<p>Hey beegee, hope you are doing well.</p><p>I read the discussion about interfacing CT with arduino on open energy monitor. In that discussion, &quot;EmonTx &quot; term is used. I am not sure what is this but do you really need it to interface CT with arduino? I did not see it any of your discussion or figures.</p>
<p>Hi Ambalika,</p><p>EmonTX is an electronics device that you can buy from OpenEnergyMonitor to connect several CT sensors =&gt; <a href="https://openenergymonitor.org/emon/modules/emonTxV3">https://openenergymonitor.org/emon/modules/emonTxV...</a></p><p>I didn't use this device, instead I build the electronics to connect the CTs by myself on a small board that is plugged onto the Arduino Yun.</p>
<p>Great work!! I am trying to make one like this but i am stuck in connections. It will be really helpful if you can provide a bit clear circuit diagram.I have attached the one I want. I would like to know about your extension plan, how far did you reach? Good luck for that and thanks in advance</p>
<p>I attached a (hopefully) better quality image of the connections. </p><p>Basically there are 3 connections to measure current and voltage, in the schematic they are named CON2A, CON3A and CON4A.</p><p>- CON2A is the connection point for the CT that is clipped on one of the wires from the solar panel after the inverter (220V AC line)</p><p>- CON3A is the connection point for the CT that is clipped on one of the wires of the house main supply</p><p>- CON4A is the connection point for a 220V/9V transformer that is used for the voltage measurement.</p><p>For the system extension, I have made a small electronic based on the ESP8266 to remotely control my aircons. If the solar panels produce more energy than I use, then the aircons are switched on automatically. Check my instructable &quot;ESP8266 WiFi controlled aircon remote&quot; =&gt; <a href="https://www.instructables.com/id/ESP8266-WiFi-Controlled-Aircon-Remote/">https://www.instructables.com/id/ESP8266-WiFi-Contr...</a> for more details.</p><p>Another extension I made is a security system with the ESP8266. It uses a PIR (passive infrared sensor) to detect movements. It will start an alarm if (during the night) a movement is detected in my front yard. But I did not yet create an Instructable for it.</p><p>But all three devices (solar panel monitor, aircon remote and security system) are communicating with each other.</p>
<p>Thanks a lot beegee</p>
<p>Great idea for monitoring the performance of your solar system.</p>
<p>Thanks.</p><p>I am already working on the extension of this system. The plan is to automatically switch on/off appliances (like the air con) to balance our consumption in case we produce more energy than we consume.</p>
<p>Nice project, quite inspiring.</p><p>Q: Was your electricity supplier correct?</p>
<p>Thanks.</p><p>Not sure if I understand your question. Let me know if I gave the wrong answer.</p><p>The supplier was correct with the fact that he charges me for every kWh I send back to the grid. </p>

About This Instructable



Bio: Electronic engineer. Swabian. Retired. Keeping my brain active with building some hardware and writing software for Android, Arduino and ESP8266 -- Einem Deutschen Inschenör ist nix ... More »
More by beegee1962:ESP8266 WiFi controlled aircon remote Arduino Yun - Solar Panel Monitoring System 
Add instructable to: