Script for switching ON/OFF water heaters if there is spare electicity being generated from Solar PV

20 replies [Last post]
jamesg
Offline
Maidenhead, United Kingdom
Joined: 4 Feb 2011

I am using a HAH with an Envi Current Cost meter and 2 clamps to measure the amount of electricity being generated, and the amount being used. If there is spare capacity I switch on one or two 500W heaters wirelessly using the HAH.

If I switch the kettle on or the dishwasher heater kicks in, the water heaters immediately turn off and will come on again a minute or so after the load has dropped back to a background level.

The system works brilliantly and I anticipate being able to heat most of my hot water over the next 6 months for free!

If anyone is interested in any other details of this system I am more than happy to share,

James.

AttachmentSize
PowerMonitorV1.1.lua5.35 KB
brett
Offline
Providence, United States
Joined: 9 Jan 2010
Wow that lua script is circa

Wow that lua script is circa Plugboard V1.  I'd almost forgotten how that code looks.  Are you running a really OLD version of the firmware ?

Your must be on a version < 279 and we are now up to 306.

Check in /etc/build and tell me what you have.   Note if you upgrade this script WILL break.

Brett

jamesg
Offline
Maidenhead, United Kingdom
Joined: 4 Feb 2011
Yes its probably really old

But as it works I've no immediate plans to change it, unless there's a killer reason to do so.

Do you have any plans to port the HAH to the Raspberry Pi as this would make the HAH accessible to a much wider audience?

brett
Offline
Providence, United States
Joined: 9 Jan 2010
For killer reasons you'd have

For killer reasons you'd have to decide that yourself - the release notes for each release since your build are in the News and Announcements topic. Way too many changes to list here.

Then again sometimes if it working and it does what you want its better to just leave it alone.

Brett

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Switching script

James

Had a quick look through your script and I'm interested in doing something similar. My problem has always been that I can't figure out how to determine if my system is feeding the grid or drawing from the grid because my CC clamp only shows the total figure but not whether it is feeding or drawing from the grid. Could you explain how your script determines whether power is being used or generated?

I have done a specialist script for Dean which I gather works pretty well but requires additional hardware to detect the state of the power flow. If your script really does the business then it would be simple for people to use without the need for further hardware devices. I'm sure that it could be updated to take account of the latest firmware updates.

 

Allan.

g7pkf
Offline
United Kingdom
Joined: 11 Jan 2011
And it

works really well, currently my solar pv is running the house and the immersion heater in the hot water tank.

 

Dean

jamesg
Offline
Maidenhead, United Kingdom
Joined: 4 Feb 2011
I am using 2 clamps with my CurrentCost

I have two clamps connected to my CurrentCost meter - you can see in my code that I check which channel the reading has come from.  Unfortunately it means the data on the CurrentCost screen becomes meaningless as they assume that you are consuming power on both channels, not generating on one of them!

        if channel == "1" then
               last_Generating=watts
        else
            last_Using=watts
        end

Also, my Currentcost meter always shows 58W even when nothing is being generated.  The same thing happens with an Owl meter and is something to do with the design of the inverters that makes it appear that power is flowing, even when it isn't. 

g7pkf
Offline
United Kingdom
Joined: 11 Jan 2011
Yes but and

If your house is drawing 3Kw (kettle) and solar generating 1.5Kw are you drawing or feeding 1.5Kw how do you know?

 

also its the inverter "drawing power" they need  a small standby, mine is 36w ac clamp meters cannot tell if power is being fed or drawn (the direction of the power)

 

the way i tell if i am feeding or drawing of grid is i detect the state of led on meter. By using a cc digital board and an LDR if channel 3=500W then i am feeding grid. if 0 i am drawing.

kevin9
Offline
Lincolnshire, United Kingdom
Joined: 24 May 2010
I may be wrong but it sounds

I may be wrong but it sounds as if James has two clamps connected to a single primary transmitter ( which is capable of having and reporting and summing 3 clamps) ?

In this case the CC head unit simply adds the values for its display

With the current release of Livebox it is possible, when using a CurrentCost 128 or Envi, to have up to 9 'Appliance' channels. Typically these would be IAMs, plug in modules for monitoring subsections of your electricity consumption. However you can assign a spare, non-invasive, primary transmitter or a mini transmitter to these channels as well.

Mk1 IAM's here http://www.flickr.com/photos/netcompsys/sets/72157625168084766/

Mini Transmitters here http://www.flickr.com/photos/netcompsys/sets/72157624901424769/

The values from these channels are broadcast as xAPBSC endpoints and are therefore available to plugboard/lua

Maybe this might be a good enough reason to update your Livebox HAH?

In addition the issue of a floating base value for Appliance Channels was raised as  issue 24

http://code.google.com/p/livebox-hah/issues/detail?id=24

kevnt

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Import or export

I also have two clamps attached to my CC meter. The problem is, as Dean says, that the clamp in the "conventional" position i.e. on the tail by the consumer meter only reads the total load; so I can't work out a way of telling if I'm generating 3 Kw and consuming 1.5 Kw or generating 1.5 Kw and consuming 3 Kw because the CC clamp show a load of 1.5 Kw in both cases.

In these circumstances switching on a water heater may just increase the amount of electricity being drawn from the grid and completely negate the idea of using "surplus" electricity.

So what is it that I'm missing from your code that allows you to determine whether the load is an import or an export?

EJ-Ambient
Offline
Ringwood, United Kingdom
Joined: 5 Aug 2011
Three CC clamps

Just to throw in my two 'penneth -

I have an EnviR rigged with

ch1 clamped on the PV array (before it hits the 'fuse box')

ch2 clamped on the mains supply (i.e. the meter reading)

ch3 clamped on the supply to the immersion boiler (nothing else on that line!)

Now - take a look at Pachube ( https://pachube.com/feeds/34982 )

Datastream 2 = PV generation (close to realtime)

Datastream 3 = what the immersion heater gets from my 'Solar Boiler'

Datastream 14 = what the mains (meter) reading looks like  AND

Datastream 1 = what the house usage looks like after applying my lua filter applet.....work in progress, but you can see the difference.....so yes..as long as you know whats being generated and whats being 'metered' you can get a pretty good representation of 'House Use'...

Does this help?

PS big thanks to Brett for fixing the bulk posting to Pachube - it works real fine now!!!

EJ

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Three clamps man

Yes I can see what you mean. Feed 14 clearly shows the effect of the solar generation and feed 1 is more like general house use. So do I need 3 clamps instead of the 2 that I already have and I'd obvously be interested to see your "work in progress" to find out what you do with the data.

Allan

EJ-Ambient
Offline
Ringwood, United Kingdom
Joined: 5 Aug 2011
Clouding the issue

Hi Allan

No, the third clamp is just for me to monitor what I'm able to push into the Immersion Heater....you only need two clamps to work out the House Consumption and the PV generation.....

As I said the lua script is a 'work in progress' because I think every house/clamp/array combination is going to be unique - so I don't think this'll be a generic fix for every situation, but when I tidy up the script I'll let you have a play.... it'll be usefull to see how much variance there actually is !!!

I'm currently tweaking the accumulation figures (Pachube datastreams 12 for the PV and 13 for the boiler) so that I have a daily figure for how many kWh I'm generating and able to use.... it's not as much as I'd hoped as once the boiler comes up to temp, the thermostat kicks in and the PV just pumps watts onto the grid!!!!  I'm going to rig up a line to my wired underfloor heating and dump the excess there, temporarily, whilst i look round for a battery/energy storage solutions.

I like the looks of the hydrogen production rigs which are commercially available - but SWMBO won't have explosives in the house....pity.

Drop me an email and I'll package up the scripts and a writeup for you.....

Have a great weekend.....

EJ 

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Modfied Script

Here is a modified version of jamesg's script for switching devices in order to use surplus PV generation. As far as I can tell I've just changed the bits that are needed in order to make the script run in the latest version of Plugboard. I don't fully understand the working but as I said the other day it seems to basically do what it is meant to do.

By way of explanation of what I do understand the section in global variables which reads:
    load_Details[1]={450,0,2}
    load_Details[2]={400,0,3}
is the bit that is configurable. The 3 parameters are: 1st the size of the load to be switched (in watts) 2nd a flag to show on (1) or off (0) and 3rd the rf device on the HAH which is to be switched (in this case rf2 and rf3).

I think that the switching is done sequentially so rf2 will be switched on first if there is enough surplus and rf3 will be switched on second if there is still spare capacity. They will be switched off in reverse order.

The current configuration is for PV output to be monitored by Currentcost ch1 and the grid load to be monitored by Currentcost ch2.

I've not really had very much sunshine in order to do any testing but it does seem to work. Maybe someone in the sunny bit of the country could have a go and comment on how it works.

I still think that there is a possibility that the script could misinterpret the grid reading and draw extra power from the grid when an import is already happening but the circumstances in which this would happen are probably rare. Perhaps jamesg would care to confirm whether or not my understanding of the script is accurate.

Allan.

AttachmentSize
JGPlugApplet.lua 5.91 KB
RichardScott
Offline
Joined: 15 May 2012
I'm planning on installing a

I'm planning on installing a similar system to use the excess generated power. How big a water heater is optimum.

DoubleSpeed
Offline
Bristol, United Kingdom
Joined: 31 Mar 2012
I think a 1.5 KW immersion is
I think a 1.5 KW immersion is probably recommended I've seen 1KW and 1.5KW available on the net, I've not installed mine as yet as I’m in the process of tuning my system monitoring to make sure the whole home consumption is monitored correctly so that the immersion isn’t triggered when we’ve got the tumble dryer on or kettle etc as soon as I am happy with the monitoring which should be in the next few days I will go to the next stage which is the triggering of the immersion! There are several members on here who are actively doing this already so you can get lots of help/feedback on this
paul_tanner
Offline
Gerrards Cross, United Kingdom
Joined: 19 Jun 2012
Commercial alternatives

I believe there are 2 or 3 products that do this but that they are quite expensive.  Anyone tried them?

Also, as my PV system rarely gets to 1.5kW, I think I'd need a smaller heating element.  Anyone found 1 1kW one?

BTW. Was just doing the sums around storing all the spare PV power in a battery.  That does not have a good payback if batteries last 1-2 years or less.  So producing and storing hot water feels like the best choice today.

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
I don't know exactly what you

I don't know exactly what you need but you could try something like this:

 

http://www.asap-supplies.com/marine/immersion-heaters

DoubleSpeed
Offline
Bristol, United Kingdom
Joined: 31 Mar 2012
There are some on eBay as
g7pkf
Offline
United Kingdom
Joined: 11 Jan 2011
cheaper option

wire 2 diodes in parrallel (ensure you have them the same way round)

 

http://www.maplin.co.uk/6a-silicon-rectifiers-46413

 

600j higher voltage option do not use d or a suffix

and put them in series with one of the supply wires that supplies the immersion. JUST ONE.

 

and they will half the wattage/consumption of immersion.

 

so if you have a 3Kw immersion brings it down to 1.5Kw

 

they half wave rectify the supply half of 240=120=half wattge/supply current.

 

Dean

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
I realise that this is an old

I realise that this is an old thread now; but this idea was what originally led me to discover the HAH.

For what it's worth, I have been using a modified version of this script for switching 2 dump loads
depending on available exported electricity. It seems to work reasonably well.

I decided to use an arduino with an EmonTx shield from the open energy monitor people to sample
the import/export of electricity, it works pretty well. I then send the data as a UDP packet
which is picked up by the HAH and then, using the udp2xap sample, re-transmitted as an xAP message.
The switching script interprets the xAP and decides which of the 2 devices to switch on/off.

The 2 dump loads I use are low wattage heaters (1 400w and 1 650w) and the system will switch either
or both on/off within a second or two of capacity changes. I realise that space heating is not an
ideal use of the surplus electricity but, sadly, I don't have a domestic hot water storage facility
so it has to do.

If anyone is still interested in doing this I can post the script/sketch for people to peruse.

Allan

Hardware Info