Software apps and online services
When you add solar to your grid-connected home, with the intend to consume your own production (i.e. self consumption), you will quickly realize that any solar energy not consumed by your home will go to the grid.
This is called “injecting”, or “exporting”. The energy injected is called “surplus” or “excess” solar.
There is nothing that can be done about it. Produced solar energy has to go somewhere..
A grid-tied solar system is designed to always operate at the maximum production capability of the solar panels, and typically cannot be “asked to slow down”.
Regulations about injection are country dependent. Injection can be allowed, tolerated, or strictly forbiden. In some countries you can get some money for the exported energy, in others you do not, and in some others you even have to pay to export!
The electricity grid was not designed with the idea of millions of tiny generation points, all injecting power at the same time (noon on sunny days). Grid operators are cautious about any effect of such injection on grid stability.
In France, where I live, injection from self-consumption installation is disallowed (there is some kind of tolerance for small amount of power).
Beside any regulatory issues, it is also a pity. Why invest in a solar installation to end up providing part of the production for free to the electricity company?
So how to maximize self-consumption?Maximizing self-consumption
There are various ways to maximize self-consumption:
- Manually turn-on energy-hungry appliances (eg washing machine, dryers, iron..) when it is sunny. This requires a bit a discipline, change of habits, and also some level of mental strength (ever felt the urge to start the dishwasher as soon as it is filled with filthy content ?)
- Use surplus solar energy to heat the water tank, as opposed to using grid energy at night. This is by far the most common use of solar surplus and this requires the installation of a “solar router” (more on that later).
Of course, my family has been trained (brainwashed ?) to have the above discipline.
However, we are not always at home and moreover, my water tank is already heated with “thermal” solar (i.e. sun energy directly converted to heat water).
I live in the French Alps, and for half the year I need to heat the house. But what I want is a way to automatically feed all excess solar energy,and only excess, into existing electric heaters.Solar router is good, but not enough.
Solar routers are devices which read the power flow between your house and the grid. As soon as energy is being exported, they divert it to a specific device, to consume exactly this amount of energy (no more, no less).
Those devices are typically used to power water heaters’ electrical resistance; thereby heating water with energy that, otherwise, would have been exported.
There are many models of solar routers. I am using the eddi from myenergi. I choose this device because it works hand in hand with my Solar Electric Car charger, but this is a subject for another article.
However, this device alone does not fulfill my need:
- I want to be able to use existing electric heaters. Unfortunately, solar routers only power devices connected on their dedicated AC output. Rewiring existing heaters is a NO GO.
- Solar routers have a maximum power output. Even if mine is adequate for a water tank, it is below the production capability of my solar array.
- Solar routers are designed to produce a variable power (i.e. the value of excess solar at any point in time). This is achieved by modifying the AC voltage (e.g using 100 Volt instead of the traditional 230 Volt) or by distorting the AC sinusoidal wave. A pure resistive load would not mind this, but modern electric heaters may not work with such funky input voltage.
I decided to combine the flexibility of a solar router powering one dedicated heater (*) with on/off automation of multiple electric heaters already installed in my house.
(*) I removed all electronic from that heater to directly connect to its resistance.
The existing heaters are controlled using wifi-enabled relay. Adding those only requires very modest rewiring and therefore is easy.
Why still using a router ? why not using existing heaters only?
Because the existing heaters are controlled using on/off commands, and they have a fixed power rating. So a 1kw heater will either consume 1kw or 0kw. With such step function, it is not possible to only consume a surplus of, let’s say, 800w.
With this combination of eddi and on/off automation, a typical automation scenario is:
- The sun rises, the eddi start powering its (eg 1kw) heater with 400w, 600w, 800w …
- As solar production ramps up, at one point the eddi is providing 1kw to its heater and cannot divert anymore. Solar will start injecting into the grid.
- This is detected by the application (more on this later), which will turn one of an existing (eg 1.5kw) heater on, using a wifi relay.
- At 2kw solar production, the existing heater will consume 1.5kw, and the eddi 0.5kw.
- When the solar production surpasses 2.5kw, the application will turn on a second existing heater.
- As the solar production drops (cloud, sunset), the application will turn existing heaters off
- and so on..
The existing heaters will add loads in a discrete manner (by increments of their power rating), whereas the eddi will always consume the “rest” of the surplus.
Excluding some transient states in the automation loop, no energy should ever be injected into the grid.The system in action
The graphs below are from my solar monitoring application.
The first one is before the automation described above. Only the eddi is installed.
- The blue curve on top represents the daily solar energy production.
- The orange curve at the bottom represents the daily energy consumption of the house.
- The eddi is diverting as much as possible into its heater, but there is too much solar production and some surplus appears.
- This surplus (the gray zone at the very bottom) is what gets exported into the grid.
So, on that day, 27Kwh were produced from solar, out of which 9kwh got exported.
With automation in place, the consumption curve (orange) nicely follows the production curve (blue), meaning very little energy is left on the table (i.e. exported)
A monthly view:
The automation application needs to know the direction and intensity of the current flowing between the grid and the home, whether the current is drawn from the grid, or exported to the grid.
There are many ways to get such information:
- install a dedicated current clamp (such as this one)around the wire connecting the home to the electricity company.
- some consumer unit meter (provided by the electricity provider) do provide this information via an API/protocol (The French “Linky” does)
- I decided to leverage the monitoring device which comes with my solar installation, the Enphase envoy
The Envoy already has a current clamp for grid monitoring so there is no need for extra hardware. Besides, it provides a local REST API allowing the automation application to interact, over my home wifi, with a server located in the envoy box itself.
This means I get real time information and do not have a dependency on any cloud system.
I am also using a dedicated current/voltage sensor (PZEM 004t) to get an idea of the power being diverted by the eddi. Even if not required for the automation logic, this is a valuable piece of information which can be used to build nice graphics/statistics.
Existing heaters are equipped with wifi enabled relay. I picked Shelly products, because they have a comprehensive and well documented REST API, which the python automation application can use.
Most of my existing heaters come with what is known as a “pilot wire”. This wire is designed for home automation, and allows to configure the heater in different modes, based on the 230V AC voltage applied to this pilot wire.
- Comfort mode. Heater ON. Target temperature set on heater’s thermostat
- Eco mode. Heater ON. Target temperature typically comfort minus 3 C
- Anti freeze. Heater OFF, except if ambient temperature drops too low (typically below 7C)
- Stop: heater OFF
A Shelly 1PM relay and a simple diode allow to set the heater in either Comfort mode or Antifreeze mode.
The diode suppresses the positive part of the AC voltage. The table above shows that this correspond to Antifreeze.
With a pilot wire, the wifi relay does not switch heater’s power (power switching is done in the heater itself). Therefore the relay does not need to have high power rating
The diode suppresses the positive part of the AC voltage. The table above shows that this correspond to Antifreeze.With a pilot wire, the wifi relay does not switch heater’s power (power switching is done in the heater itself). Therefore the relay does not need to have high power rating
The logic (implemented in Python on a Raspberry PI) is quite simple. It periodically monitors grid current (using the Enphase API), and based on the direction of the current (export or draw), turns heaters on or off using the Shelly API.
Which heaters to turn on first ? By popular vote, it is entirely configurable. Heaters are grouped as “primary” and “secondary” with primary heaters being switched on before secondary ones. Likewise secondary heaters will be switched off before primary devices.
It is also possible to disable automation altogether. Typically, the system would run in full automation when we are absent/happy to let the application manage the primary/secondary heaters.
Some behaviors (such as how often to check for export, how quick to react to change of grid status,..) are also configurable.
The eddi in operation. Solar production is 3.2Kw. Home (eg oven, fridge..) is consuming 1.7Kw. Eddi is diverting most the the excess (1.3 Kw). Export is only 100W.Control with a smartphone
As the solar2heater application is meant to run forever and unattended, much attention is given to application management.
I used the excellent Blynk platform to build a smartphone application to manage the configuration and monitoring of the solar2heater application.
With Blynk, no code needs to be written on the smartphone side, applications are built by assembling widgets. The Python application running on the Raspberry PI interacts with those widgets.
In the screenshot above, you can see how the power on the controlled heaters (yellow line) reasonably tracks solar production (green line), and how the grid (red line) hovers around 0.
The delta between the green and yellow lines is what the house consumes outside of the controlled heaters (fridge, etc...)
The smartphone application also provides real time access to all power meters, and to log of key events. It is pretty handy to see the automation logic in action..
The Raspberry PI is monitored using Linux’s Monit. Monit checks the health of various system’s components (network connections, filesystems, memory, CPU, processes, etc…) and take automated actions on error.
For instance, in case the solar2heater application fails, it will automatically be restarted.
As for event reporting, alarms are provided with both push notifications and emails.
All this makes the system “embedded”, i.e. able to run forever, without much attentionRaspberry PI add-on board
I also developed the PCB (printed circuit board) for an add-on board to the Raspberry PI (i.e. it connects to the standard Raspberry Pi’s expansion header)
The PCB design is available on github
In the solar2heater application, the board is used for visual cues (display some statistics, events). It is equipped with led and a color display.
The board is designed to be quite generic, and can also host temperature sensor, current sensor, gesture sensor, light sensor, lithium battery sensor, buzzer, opto-coupler..etc.
For now, I am only using the display as text, but when I have time, I’ll build nicer graphics ( good idea says the editor )
The system has been working fine for several weeks now and indeed, it makes sure I use all the excess solar to help heating my house.
The orange area corresponds to the power consumed by the house.The blue area corresponds to the solar power productionThe gray area on top corresponds to the power being imported from the gridThe gray area on bottom corresponds to the power being exported to the grid
- In the early part of the day, power consumed by the house is provided by the grid (gray and orange matches).
- The narrow peak in the morning is heating of the water tank around 6pm (I do not need much, as the tank is already hot)
- As solar production ramps (blue), the power is consumed by the house’s heaters (orange). You can see the effect of a cloud on both production and consumption.Very little gray area on the bottom of the curve means no power exported to the grid. The heaters take it all !!!!.