Adding Power display to Robin's PV diverter

I've been experimenting with adding a two row display to an Arduino Uno R3 to show the power being currently diverted and the total so far for the day. Using a simple press button the display will show the total for yesterday and the running total for today.

The display I'm using is the Sainsmart 2 row x 16 character display with a few push buttons for input. A minor modification makes the 'Select' switch suitable for a digital input on the A0 input.

The display uses 6 digital pins some of which clash with the original pin allocation in Robin's code so these have been changed and are commented in the source code.

The mode select is now digital pin 2 and the triac drive is from digital pin 3

One restriction of the first release is that the dump load must be greater than the maximum PV output - this suits my installation which is 2.3kWp and a standard 3kW immersion heater.

Power measurement is performed by counting cycles where the triac is on and the bucket is not overflowing. The power rating of the dump load needs to be entered in the code (currently 2750W) and conversion factors are used to display current power in kW and total energy dumped in kWh.

The way the Anti-flicker works does cause the current power to fluctuate unless it is heavily averaged. I've use a rolling average scheme to give a 1 second update rate of the latest 20 second average which to me gives an acceptable performance.

A couple of photos show the default display and the optional comparison between the total yesterday with todays running total.