PV Energy Diverter w/ Local Display and MySensors Integration

Hi Folks, my first time here. I just thought I’d drop in to share the results of a project I’ve been working on for the last few weeks: I call it Energy Router. Its job is to divert any excess solar PV energy to the electric storage Hot Water Service, and also to record and report statistics about household energy consumption to my home automation system. I used two current transformers, one on the grid connection and another on the solar inverter output; as well as a voltage transformer for voltage measurement.

It’s heavily based on Robin Emley PV Router code, but I’m using a 0-5V phase-angle power controller, a 20x4 I2C LCD for local display, and RFM69 wireless module for remote control and logging. It’s all hanging off an Arduino Pro Micro. The wireless protocol is provided by the MySensors library and it’s talking through an MQTT gateway to my OpenHAB system.

So far it’s working a treat, keeping my HWS topped off daily and saving me maybe 5-6 kWh/day.

I’ll call back in here once I have upload privileges to share the code and scripts for it.

1 Like

You should have that now.

What are you doing to clean up the harmonics that your phase angle control is generating? I can’t see any filter components on the controller you’re using. Or maybe the rules where you are are less stringent than the ones we’re used to?

You’re right, the controller has no filtering on board. I’ve put a simple LC filter on the output that I’m hoping will have cleaned it up adequately. I will admit to not having investigated if that is actually the case though.

Here’s the files associated with this project: Energy Router.zip (16.6 KB)

Inside is the Arduino source file, you’ll need to use the Arduino IDE library manager to install the MySensors, LiquidCrystal_PCF8574, and TimerOne libraries. The code is reasonably well documented and the libraries are well-supported, so it should be possible to graft one into your system.

Also included is a modified version of the MySensorsCore.cpp file, which you should copy into your library directory where the current one resides. This has a couple of modifications to the request functions which make it work with OpenHAB via MQTT.

Speaking of OpenHAB, there are a couple of other files with extensions of .items and .rules, these contain the items and rules needed to interact with the Energy Router on OpenHAB via MQTT. You’ll definitely need to edit the “sensors-out” and “sensors-in” strings and the child ID numbers in the binding areas to match your own MQTT topics that your MySensors gateway sub/pubs to. In the rules file you’ll also need to adjust the timezone number used in the Time Response rule to put the ER in your local time zone.

It’s currently programmed to wait a minute for each response from the OpenHAB controller, meaning it could be 4+ minutes before it starts up and displays something if you haven’t got OpenHAB and MQTT talking properly yet. If you’re struggling here I highly recommend using another MQTT client to listen in and see what topics your MySensors gateway is spitting out, then editing the config files to match.

The hardware is fairly standard for these things around here: a couple of current transformers and a voltage transformer hanging off analog inputs. LCD on the I2C port, radio module on the SPI. If anyone is interested in building one of these but can’t quite put the hardware together just based on the info here and on MySensors site, pipe up and I’ll try and upload some drawings of what I did.

Oh, and now that I can post more than two links, here’s some more link salad for the parts I used:

20 x 4 I2C LCD Screen
Arduino Pro Micro 5V 16MHz
RFM69H 433MHz Radio Module
100A Split Core Current Transformer
240V AC - 5V DC PSU Module
Plastic Enclosure
0-5V Phase Angle Power Controller
5V to 3.3V Regulator
5V to 3.3V Logic Level Converter (for Radio Module)