Photo Voltaic - Immersion heater power diverter - SAFETY WARNING!

Jeremy Harris

Senior Member
First off, a safety warning. This is NOT a project to be attempted by anyone who doesn't understand the risks of working with mains voltages. If you aren't competent at building a circuit that includes mains voltage wiring DO NOT attempt to build this.

OK, now I've (hopefully) allayed the concerns of the more safety conscious members, let me explain what this unit does, and how it works. In the UK, anyone with a solar photo voltaic (PV) system may receive a Feed In Tariff (FIT) subsidy, paid on the basis that 50% of their installed PV capacity will be exported. There is therefore a financial advantage in using as much of the power you generate as possible. One way to do this usefully is to divert any excess power generated to an immersion heater, to help heat the hot water tank. With a big hot water tank you can store a fair bit of hot water and in summer can probably get all your hot water for free using such a device.

Commercial units are available, but they cost between £200 and £300 as a minimum; one even sells for well over £1000. The challenge was to find a way to accurately measure the power being used by the whole house, and accurately determine whether power was being imported (from the grid to the house) or exported (from the house to the grid). Luckily, there are some very cheap and accurate electricity meter front end chips available that do all the hard bits. These use an isolated clip-on current transformer to measure the current flowing in the main feed cable to the house (the cable from the meter) and an isolating mains transformer winding to measure the supply voltage, and can calculate the true power (allowing for power factor variations) and output a frequency that is proportional to power and a direction signal that indicates import or export.

These two logic signals can be easily read by a Picaxe, so the next challenge is to work out how to control an immersion heater (safely). Luckily, fully isolated Solid State Relays (SSR) are readily available at a reasonable price (I paid £6 for a surplus 25A Cruezet one). These are easy to use and will switch a big mains load safely at the zero crossing point directly from a Picaxe output pin, as they have a built in opto isolator. The difficulty was finding a way to vary the power sent to the immersion heater, so that it was just enough to use any surplus, but not so much as to end up having to pay for imported electricity.

The market leading commercial device just uses burst fire control of a triac (which is what's inside the SSR) to effectively vary the number of on and off cycles of the mains to vary the power to the immersion heater. This works, but has a side effect that has attracted some criticism. Under some conditions this rapid switching can cause lights to flicker, not only in the house with the unit fitted, but also in the homes of close neighbours. It's not a major problem, but not that desirable, either. Luckily a chap on the Open Energy Monitor forum, Robin Emley, has come up with a way around this problem, using a method that doesn't need resorting to a potentially nasty control method, like phase angle control.

Robin's technique utilises a deliberate design feature within electricity meters. To ensure that these meters don't "creep" when no power is being consumed (due to small measurement errors) they have a threshold energy level below which they don't register. This is usually set to around 1 Wh, or 3600 Joules. If less than 3600 J is imported from the grid the meter won't record it. This means you can "borrow" up to 3600 J from the grid and send it to the immersion heater, then "repay" this with the same amount of energy exported back to the grid, so resetting the meter energy threshold.

As the meter front end chip supplies accurate power and direction data, all the Picaxe needs to do is manage an "energy bucket", monitoring when the bucket reaches a set level of exported energy, then turn on the immersion heater and wait for the bucket to empty to a set minimum level. I've set the "energy bucket" to have a capacity of 3600 J and have set the immersion turn on threshold to be 75% of this and the immersion turn off threshold to be at 25%. To eliminate an accidental drift towards importing energy, the "energy bucket" has a small leak, so that over time it will tend to empty, even with the immersion heater turned off.

This project uses an 08M2 as the controller, and an Analogue Devices AD7755 24 pin DIP meter front end chip (unfortunately this particular chip has now been discontinued, but there are very similar alternatives available). Below I've given details of the circuit and construction, together with the code.

As mentioned at the beginning, this is NOT a project to be undertaken by anyone who isn't competent with mains voltages. Although the design is safe, this project requires an understanding of isolation and earthing and an acceptable level of competence in assembling mains voltage circuits. It is NOT suitable for construction using strip board or prototype board construction methods. Finally, if you decide to build a unit like this, then I take no responsibility for your own safety.

PV power diverter 1.0.JPG

Power diverter - cover off.JPG

;Energy bucket immersion heater PV diverter, using Picaxe 08M2 controller

;Code not yet fully tested, but does seem to work as expected using a bench simulation

;Uses Analog Devices energy meter chip, AD7755 (now replaced by ADE7755, only available as surface mount)

;AD7755 determines true instantaneous power and direction of energy flow and has two outputs
;Output CF is an 18µS wide positive pulse equivalent to 10 J that has a PRF of between 0 and about 5570 Hz (covering a range of 0 W to 55.7 kW in theory)
;Output REVP indicates the direction of energy flow, low for import, high for export

;Operating Principle:
;Uses interrupt to trigger a routine whenever a CF pulse occurs.  This interrupt is on pin c.3 and is set up using the setint command (pin and mask)
;The state of the REVP input (pin c.3) is used to determine whether 10 J is added to the energy bucket or whether 10 J is subtracted from it.
;A small safety leak is built in, in that after a set number of iterations of the interrupt routine the energy bucket accumulator is decremented.
;the loop counter used to keep track of the number of iterations of the interrupt routine is reset to 0 after the leak is decremented  
;The energy bucket accumulator has a lower limit of 0 J and an upper limit that is set by the variable "capacity", in Joules / 10
;When the energy bucket accumulator fills to the upper trigger level, set by the value of "upper", the solid state relay is turned on, via pin c.2
;Whenever the energy bucket accumulator empties to the lower trigger level, set by the value of "lower", the solid state relay is turned off
;After the interrupt routine has completed the setint command is used to "re-arm" the interrupt, ready for the next energy pulse
;With values of 270 for the upper trigger point and 90 for the lower trigger point this controller shuttles 1800 J across the meter
;The majority of household energy meters have a 1 Wh (3600 J) threshold before registering any energy.

;This design reduces the flicker frequency by offsetting the upper and lower trigger points.  Typically the immersion will turn on for a short period every few seconds.
;For example, at 500 W export the immersion will be on for 0.7 seconds and then off for 5.5 seconds, with a 2% leak rate set.

;Pin designations:

; pin c.4 = CF		pulses from AD7755, calibrated to be 10J per pulse

; pin c.3 = REVP		import/export direction signal from AD7755.  High for export, low for import

; pin c.2 = output to drive SSR, high is SSR on, low is SSR off

#picaxe 08M2

symbol accumulator = w0										;energy bucket accumulator variable

symbol leakcounter = b2										;used as loop counter for leak, records number of times interrupt routine called

symbol upper = 270										;upper energy bucket threshold for switching on immersion (270 = 75% full)

symbol lower = 90											;lower energy bucket threshold for switching off immersion (90 = 25% full)

symbol capacity = 360										;nominal 3600 joule energy bucket capacity (value = Joules / 10)

symbol leak = 50											;50 gives a 2% leak rate in the energy bucket (decrements by one every 50 iterations)


	setfreq m32											;set clock frequency to 32 MHz for best speed

	setint %00010000, %00010000								;set interrupt on pin c.4, masked to detect high pulse


	pause 1000											;loop around aimlessly waiting for an interrupt
	goto main

interrupt:												;interrupt routine is called whenever an energy pulse is detected
	inc leakcounter
	if pinc.3 = 1 then let accumulator = accumulator + 1 max capacity		;accumulate export energy in energy bucket up to max set by variable "capacity" 
	endif												;pin c.3 is REVP on AD7755 and indicates import/export
													;pin c.3 low = import, pin c.3 high = export
	if pinc.3 = 0  then let accumulator = accumulator - 1	
	if accumulator > capacity then let accumulator = 0				;trap under flow error from subtracting from zero
	if accumulator > upper then high c.2						;switch on immersion if over upper trigger level
	if accumulator < lower then low c.2							;switch off immersion if below lower trigger level
	if leakcounter = leak then 
		let accumulator = accumulator - 1 min 0					;decrement accumulator once every "leakcounter" times interrupt called
		leakcounter = 0
	setint  %00010000, %00010000								;re-arm interrupt ready for next energy pulse
	return											;return back from interrupt routine to main loop
													;interrupt routine takes about 950µS to execute
Last edited:


Senior Member
Argh !!!

I've blown off the tips of three fingers, and most of my hair, just by downloading your circuit diagram.:rolleyes:


Nicely written up project, thanks for sharing.
I too am in the process of undertaking such a project.
I've played with most of the power control methods you have mentioned and am still dithering over which to go for.
Do you have any links to the "energy bucket" feature that you mention?
I was aware that there was a certain level of "give and take" that could be exploited but could find no details.
In particular, any information about how long you can "borrow" would be very useful.
Can it be over several cycles or must it be within one cycle or is it litterally up to a certain energy level?

FWIW, I took the painful route of designing my own power measurement circuit. In trials I found that simply taking the average current gave almost as good as 'proper' power measurements. By keeping a headroom of ~100W it never dipped into the grid for power. Such an aproach ends up with a design alsmost as simple as yours!

Jeremy Harris

Senior Member
Thanks for the kind words.

I came across the energy bucket idea from some posts by Robin Emley ("calypso_rae") on the Open Energy Monitor forum. There are some basics on energy meters there, here:
and also a summary of links that may be useful, here:

In general, most UK meters allow at least 1 Wh (3600 J) of energy to be borrowed without being recorded, but I have read of one model (not sure if it's in use in the UK, though) that has a threshold of 1250 J. Most people seem to be finding that sticking to less than 1 Wh is OK, but it's easy enough to adjust the threshold values if you find that you have a lower threshold meter. You can borrow and repay energy over many cycles, the meter doesn't seem to have any time limit (or at least it doesn't seem to have a limit within the timescale of a few seconds).

I agree that, for most households, measuring current alone is probably almost as good as measuring true power, as the power factor for most homes probably isn't that far off unity. That might not be the case for a home with all CFL lighting and the majority of electrical appliances running with switched mode supplies, though, so measuring true power is perhaps the safest way to ensure you get the most power diverted without risking an accidental import. There are a host of energy meter chips available that make the power measurement part very simple. All seem to work pretty much the same way as the AD7755, but there are a dearth of them in DIP packages now; the majority seem to be SM only. I managed to buy a handful of surplus AD7755s in 24 pin DIP packages for £2 each, as I couldn't find a source of DIP energy meter chips from the usual suspects.


Links and info appreciated, thanks.
In many typical installations there will be a long distance between the consumer unit (where the clamp needs to be ) and the hot water tank (where the immersion is).
This leaves the dilema of running a long lead for the (sensitive?) clamp signal or running a long lead with frequently switched high current to the immersion.
Did you do any testing or have any rational for which way to go?

Jeremy Harris

Senior Member
The immersion should be connected to a dedicated spur on the consumer unit (or at least it is supposed to be) and the meter tails where the current sensor needs to go should also be at the consumer unit, too. This makes mounting the unit next to the consumer unit the best option, as the immersion feed can be fed out from it, into the diverter and then back to the original feed. It doesn't seem to cause any problems doing this, as the switching only takes place at the zero crossing point, so there's no current being switched (not sure I'd want to do this with a phase control design, though).

I can't see a problem with running the current sensor cable a fair distance if you wanted to, as it's a very low source impedance (less than 20 ohms for the modded one described here) feeding into around 10K at the meter front end chip. The additional voltage drop on a long cable could be compensated out during calibration easily enough.


My immersion comes from a spur off the socket ring.
I'll probably end up putting the high voltage stuff next to that and run a long lead for the current sense.
Too many things going on right now but thanks for posting the project and inspiring me to 'get on with it'.


Well done on a good write up and thanks for posting.

Albeit that Feed-In tarrif structures are quite different here, down under, I am still considering to do something at my new castle (a man's home is his "castle") It is better to try and use as much power as possible internally as exported power on gains one-third the credit per kWh than is expended for imported power.
Some folks did do better with higher feed-in tarrifs (roughly double and then equal to import rates with 10 year "contracts") but those arrangement had expired by the time I moved into new house.


New Member
Hi all,
I'm not sure I unstand why its better to divert pv power to an immersion heater, rather than export it to the grid. |The other house we lived at had one of
these solar water heater panels, about the size of an 160W pv panel. This gave us an abundance of hot water, and even warm water from the moon here in the uk!
Are these 'arrangements' with energy companies so bad? reason I ask, we are considering having panels installed here ( if our compensation ever materializes !)
Any advice would be welcome, regards john


It depends on the country you live in, when you had the panels fitted and probably a few other factors.
In the UK, it's a very odd deal:-
you get paid for generating electricity no matter what you do with it.
you get compensated for what you put back on the grid but UK energy meters cannot run backwards.
because what you put back cannot be measured, they assume 50% of what you generate.
Then there's all the different tarif rates that may apply.
In the UK, this has changed from 42p/kWhr through 22p and I think is now down at 16p.
What you put back (which can't be measured anyway) gives you a whopping (wait for it) THREE pence per kWhr!

So, "use it or lose it".
Even if they did actually pay (which they don't) for putting back on the grid, the current rate is half the value for the equivalent gas to heat water and one sixth of the rate at which electricity is charged.
Hence, it's an absolute no-brainer to use every last scrap of what you generate.

Jeremy Harris

Senior Member
The other odd thing is that it's actually cheaper to fit PV panels to heat your hot water via an immersion heater than it is to fit a wet solar thermal system. The cost of PV has come down a lot, so even though it's far less efficient (in terms of roof area needed for a given amount of hot water) it's still cheaper. Using PV to heat water also works better at the start and end of the day and during winter, because pretty much any amount of light will generate some electricity and this will then heat the water, no matter what temperature the tank is (as long as the tank thermostat hasn't cut in). An acquaintance has summarised the relative merits of using PV against solar thermal panels for hot water, here:

The other big advantage of using PV for hot water, in addition to the clear freebie situation described by BeanieBots above, is that it needs no maintenance and is likely to last a long time. Any wet solar thermal system is going to need attention from time to time, as it relies on at least one pump circulating antifreeze around the system, plus a pressure vessel. The chances are that a solar thermal system is going to need maintenance, and perhaps replacement of parts, every few years, whereas a PV system may well run virtually maintenance free for decades.


It depends on the country you live in, when you had the panels fitted and probably a few other factors.
Very much so, in fact even which state you live in.

Here in Western Australia, the energy suppliers (synergy and horizon power, etc) only give you currently $0.09/kWh that you actually export (that is about UK5.3 pence) [net feed-in].
If you got in about 3 years about the state Govt also gave you AUD$0.40/kwh, then about 2 year ago they reduced it to AUD$0.20, and finally about 18 months ago it was dropped altogether. But those who received a state Govt at the time received a 10 year contract so keep getting the higher rates.
The rate to buy/import is $0.25/kWh.

Some Australian states had Feed-in tariffs that were around $0.44/kWh for a considerable time and others up to about $0.70/kWh for a period of time.

So in summary:
If you have a nice high feed-in tarrif (higher than import rate) you are better to export as much as you can during the day and running the dish washer, washing machine, etc, at night.
For the rest of us, you are far better off to try and use as much as you can as you generate it hen dish washer, washing machines, etc should be run during the day.


Using PV to heat water also works better at the start and end of the day and during winter, because pretty much any amount of light will generate some electricity and this will then heat the water.
On a sunny day here, at say 8am and 4pm I generate about 1 kW (up to 1.5 kW in summer) and from 11am to 1:30pm I generate about 3 to 3.5 kW depending in time of year &#8211; on a hot day the output is less.
In the course of a sunny day I can generate 15 to 18 kWh in winter and 28 to 30 kWh in summer.
On a heavy clouded winters day I typically generate from 2 kWh to maybe 8 kWh in an entire day.

My system has 2.25 kW facing east at 25 deg slope and 2.25 kW facing north at 32 deg (location 32 deg South). In summer the east facing system generates about 10% more than the north facing system as a result of higher higher ambient temps from late morning till late afternoon reducing the output from north side. But in winter the north facing system generates around 50% more that the east facing system due to better roof /installation slope.

Jeremy Harris

Senior Member
Nice figures, I doubt we'd do as well here with a system of that size. The prediction I have for my system is that it will generate around 6,550 kWh per year.

My array will be 6.25kWp, facing 206 deg, so better optimised for our winter. In summer here the sun rises a fair way north of east, today it rose at 059 deg and will set at 300 deg, but by mid-December it will rise at around 128 deg and set at around 232 deg. My array won't see any direct sunlight in August until late morning, but in winter it'll see sun from sunrise to sunset (assuming there's any sun around!).


Senior Member
Neat well documented project!

One way to do this usefully is to divert any excess power generated to an immersion heater, to help heat the hot water tank. With a big hot water tank you can store a fair bit of hot water and in summer can probably get all your hot water for free using such a device.
Excuse me if I'm missing something but is there any provision for limiting the temperature of the hot water tank?

The immersion should be connected to a dedicated spur on the consumer unit...
US conversion: The heater should be on a dedicated circuit from the breaker panel.

Another option is to mount the SSR remotely near the hot water tank. The control wiring to the SSR should be able to run a considerable distance without problem. Another advantage to this is that the logic board would not need any special (HV/mains) wiring provisions since the current sensor is external.

Jeremy Harris

Senior Member
Thanks for the kind words.

The hot water tank temperature is regulated by the thermostat built in to the immersion heater (here in the UK this is the normal arrangement). If you have an immersion heater that doesn't have a built in thermostat to regulate the maximum temperature, then you'd need to add one to the tank.

No problem with fitting the SSR up by the immersion heater itself at all, as you rightly say, the control wiring could run a fair distance as it's only carrying a logic signal at around 10 to 15mA.