Background

In September 2011 I had a 3.92kWp PV system installed. My house is heated by oil and I was attracted by the idea of an EMMA unit, but not by the price...

Inspired by the OpenEnergyMonitor project and specifically by pauldreed's Solar Power Manager I thought I'd have a go at an Arduino microcontroller based system myself... 

The basic idea is simple - when generating more solar power than the house is using, rather than export the surplus energy I send it to the water tank immersion heater. In the summer this is much more efficient than firing up the oil boiler and heating the long indirect pipework - despite hot boiler efficiency claimed at >80%, I worked out the overall efficiency in heating small amounts of water is more like 25% for my system. In the winter when the oil boiler is already heating radiators it's probably better than that, but still a waste of precious oil!

The system has been up and running for about 10 months without a hitch - recently I've moved on to the final phase which is internet data posting to Pachube (now called Cosm) and a revised 'daily boost' function linked to measured cylinder water temperature to top up the hot water on cloudy days.

I thought it was about time I documented what I've been up to:

a) in case it helps anyone else

b) in case I forget what I've done and can't fix it if it breaks!

The Project Build

I made life a little difficult by choosing a rather small aluminium project box, but have managed to squeeze it all in...

Front cover removed for access to the FTDI programming pins on the Nanode (an internet-enabled microcontroller based on Arduino). I also have to pull the black and grey Rx/Tx wires out when programming.

On the left is the Freeduino (an Arduino clone) with a useful prototyping shield on top and BV4236 real time clock.

Top right is the Nanode, below that is the stripboard for the 3 current transformer inputs (Solar, Immersion and House), 9V AC sampling circuit for real and apparent power calcs and current direction measurement (import/ export) and a bridge rectifier with 8V L7808CV voltage regulator - I use this to power the Freeduino and Nanode. I've since seen various threads on the problems with powering the Arduino from the same supply used to sample the AC, but haven't really noticed a problem other than needing to re-calibrate the power measurements once the circuits are all live. Perhaps my separate voltage regulator helps?

The vertically mounted stripboard has two micro-switches (single rocker button robbed from an old modem) and 2 tri-state LED's:

LED1 - RED when the timed immersion 'boost' function is on.

LED2 - GREEN when exporting to the grid, RED when importing from the grid, ORANGE when exporting and diverting power to the immersion heater.

 

On the LHS end cover I have the 3 CT connections (Solar, House, Immersion), the Freeduino USB port and a co-axial F-socket for the Dallas DS18B20 one-wire temperature chip. This is great as the only connections needed are Ground and Data line (connected to 5V through a 5K pull-up resistor). I used standard co-ax as I had a roll spare and thought it would be good for data transmission and easy to add more sensors in the future with splitters:

On the RHS end cover I have the RJ45 Nanode connection - this goes straight to a power line network adaptor. The jack plugs are 9V AC input to the sampling/rectifying board and 0-5V DC output to the Phase Angle Controller (4kW industrial triac controller). This needed a little careful matching as the input resistance is only 5000 Ohms:

Dallas 1-wire DS18B20 temperature sensor installed in airing cupboard - approx 10m of co-axial cable to the Nanode and no communication problems:

Incredibly simple wiring - data line (grey) to centre core of co-ax, ground and power wire joined to outer shield of co-ax. The 1-wire chips are really cheap and fantastic for networked sensor set-ups (each has a unique identifying address) - I may add more just  because I can!

All fitted to my consumer unit cupboard - Current Transformers (CT's) on solar feed, house tail and immersion wires (plus an extra CT on solar that goes to the EON Current Cost transmitter for display in another room). The Phase Angle Controller is the metal box on the LHS of the consumer unit - complete with semi-conductor fast blow triac fuse and integral heatsink. The PAC actually stays cooler than the 9V wall wart... I fitted another metal box (RHS top) for a Schaffner EMC filter, but to be honest I haven't seen any interference on any other appliances, or on the power line network, so not sure I need to bother with this.

Features

  • Arduino (Freeduino) and Nanode communicating via serial link on Dig 0/1 pins
  • Real time data posted to Cosm for Solar, House and Immersion W and Wh (reset at midnight) and hot water cylinder temperature
  • 3 day summary of total Solar, House (Import and Export), Immersion power written to Arduino EEPROM
  • Real Time Clock with battery back-up for Arduino
  • One-wire DS18B20 temperature logging support on Nanode (I ran out of pins on the Arduino)
  • One-hour immersion 'boost' function from menu button at 2500W target power (less than the full 3000W rating as I guessed it might be more durable)
  • British Summer Time (BST) adjustment from menu system
  • 0-5VDC output control of 4kW United Automation Phase Angle Controller using a PID controller tuned around target export of 30W. This keeps the 240V circuitry limited to commercially approved products.
  • 9 different menus using 16x2 LCD display with time-out return to base menu
  • 2 buttons for menu and function control
  • 2 tri-state LEDs to quickly show status (and blind anyone staying in the guest bedroom...)

Menu screens

Performance

Overall performance has been fantastic - the main limitation being that on sunny days I can only dump about 3-4kWh to the immersion before the water is scalding. I'm thinking of swapping the hot water cylinder to a larger one with an immersion in the bottom rather than the traditional top-mounted one I currently have. Other good suggestions from forum members have been to fit a 36inch heater or to use a recirculating pump to mix the water in the tank - I've just started trying this.

I find that the immersion control is stable to approx +-20W and that the solar readings (W and kWh) agree to within approx 2% of my Diehl 3800S inverter stats.

A typical day's Cosm feed looks like this:

 

 

 

 

 

 

 

 

 

 

 

 

Emoncms

I have modified the Nanode sketch to upload to Emoncms as well as Cosm - I love the dashboard feature. Here is my current dashboard layout which works really well on smartphone and laptop:

I like this Emoncms dashboard so much I think an android tablet for the kitchen may be needed next...

Costs

Arduino development shield Ciseco 4.99
Arduino Freeduino Jungletronics 14.20
RTC Jungletronics 6.49
Case Maplins 11.99
12mm CT Current Cost 10.74
AVR programmer and component bundle Oomlout 29.00
12mm CT pack of 2 Current Cost 17.99
Components Spiratronics 6.55
Components Spiratronics 16.30
DC Power Jack sockets ebay 5.44
Nylon bolts ebay 2.45
DC Power Jacks ebay 1.49
Nanode Earthshine 22.38
LCD display ebay 2.90
Schaffner filter ebay 14.00
PAC 4kW heater controller United Automation 107.00
Connectors and solder Maplins 16.99
Mains box Toolstation 4.06
Dallas DS18B20 ebay 3.50
Cable Wilkinsons 2.15
     
     
     
     
     
  Total 300.61

Certainly not the cheapest project around (three hundred pounds) but it's been a great learning experience and the industrial PAC means the 240V power electronics should be safe and reliable - all my tinkering is low voltage!

This was my first microcontroller project, but I know it won't be my last.

Mike Rowland

Update 18/10/12

I have been suffering from unexplained Nanode hangs about once per day recently - no idea why as it was previously stable for weeks. This is a real pain as the Nanode has to be physically reset to recover, but as usual Google had the answer - Trystan has solved this already by using a watchdog timer from the AVR library.

All I had to do was update Nanode/ Arduino bootloader to Uno Optiboot (I used a USBTiny AVR programmer and soldered the ISCP pins onto the Nanode board). Then add the watchdog library #include <avr/wdt.h> and add wdt_enable(WDTO_8S); in the setup() portion of code and wdt_reset(); at the start of the loop()- then if 8secs expires without a reset, the Atmega chip is reset. I have tested this with several different types of error and it works perfectly - no more frozen feeds!