loading

Some utilities pay generous rates for solar power, some pay about the same as it costs to buy, and some pay little or nothing. If the utility is not paying an attractive rate, it may be better to use up solar energy rather than exporting. Many loads can't be time-shifted, but some can, and examples would be water pumping, heat banks, storing hot (and cold) water, pool pumps, and in the not too distant future, storing energy in battery banks and in electric cars.

One of the problems to solve when switching loads is communication between devices. The solar panels might be on the roof or in a sunny location away from the house, the pumps might be in a pump shed and the energy measurement is in the meter box.

The photo shows some solar panels I put up last year on a homebrew frame. Plug together, attach inverters and start exporting energy. But then I discover that my electricity supplier plans to greatly reduce the amount they are going to pay to the point it makes more sense to use the energy than to export it.

This instructable discusses ways of bringing it all together into a working solution.

Step 1: Measuring Energy

There are lots of ways of measuring high current AC, including some quite sophisticated techniques over at http://openenergymonitor.org/emon/. For my particular application, I was creating and using up to 20kW and this means three phase, and to do it properly this needs three current transformers and three voltage dividers plus an arduino, and doing the sums, it worked out cheaper to buy a commercial three phase meter.

The one photographed above is three phase and flashes a led at 200 pulses per kWh, but it has another very useful feature with an optocoupled output of the same pulse. With two resistors, that pulse can feed into an arduino.

The circuit is 5V to a 10k resistor to the +ve of the optocoupler, and the -ve of the optocoupler to 100k and then to ground. The high side of the 100k resistor goes to pin D2 on an arduino and this can be sampled with an interrupt.

attachInterrupt(0, onPulse, FALLING); // KWH interrupt attached to IRQ 1 = pin2

and then

void onPulse() {}

Next, this pulse width can be measured and turned into a voltage. The full code is in an attached zip file, and has a few other tweaks such as discarding very short pulses.

The arduino can then output a voltage proportional to the AC power. For energy up to 5kW, it can be scaled 1V is 1kW. In my case I measured up to 20kW and so also added a 4x non inverting amplifier with a CA3140 op amp, and then used a little step up module from ebay to generate a 25V supply, and a voltage module to display 0-20V. The display is more eye candy though - an old fashioned solution would be to us an analog 5V meter but relabel it.

Another little tweak was that the arduino outputs a pulse width modulated output, and if you sample this too fast it doesn't give the correct values, so the output goes through a low pass filter and then a voltage buffer to give a true smoothed and buffered 0-5V output.

Step 2: Display the Power ... and Send This Information Somewhere

The lower box has an arduino inside it and is taking the pulse and displaying a voltage.

The box on top also is an arduino and this is a two way wireless link that transmits voltages. Put 0-5V in one end, and 0-5V appears at the other end, maybe a kilometer away. And it works both ways too, and if you like you can have multiple channels. I'm only sending that data one way and I ended up with this rather simple solution after getting somewhat sidetracked with wireless mesh algorithms and wireless data protocols. In the end, voltages are easier to work with - you can build a couple of boxes, set them up and not worry any more about wireless protocols.

Code is in a zip at the end.

Attached is a schematic which shows several different wireless modules. There is the NRF24 for short range, the APC220 for medium range and I am using some Yishi long range modules as this goes nearly 1km through trees. There are lots of good writeups using the NRF and the APC modules. The APC module is a generic serial module and there are many brands of these available. Some talk TTL and some use RS232 voltage levels. The schematic is a generic solution for all these, but by far the most practical solution around a house would be NRF24 modules.

I put some little voltmeters in the box - these are so cheap nowadays and they are very useful for debugging. When I first was testing this, I simply looped the voltage back from the output to the input and moved a pot and watched the volts come back a few seconds later.

Step 3: Long Range Data Communication

Long range needs height, and this is a little antenna truss made of aluminium poles and pop-rivetted together. The antenna at the top is 2.4Ghz for a wifi connection using routers configured as repeaters. I used ones by TP-LINK and when you boot them up the menu option is either router or repeater and it was only a couple of easy steps to setup.

The other antenna is 433Mhz and this is a common frequency for modules like the APC220.

A little trap for beginners like me - the 3m cable for radio modules uses standard SMA connections http://en.wikipedia.org/wiki/SMA_connector. However, the 3m cable for a wifi uses RP (reverse polarity) SMA connectors. It can get very confusing if trying to mix and match and it is much easier to keep RP for wifi, and standard polarity for modules, and just buy cables with male on one end and female on the other.

Step 4: Turning Things on and Off

I have drawers full of relays, but relay modules are now available sometimes for almost less than a relay, and make connecting to arduino very easy. Some turn on with a High signal and some with a Low signal, so if you add blinkenlights on a front panel, leds need to be anode to 5V, or cathode to 0V.

Inside the box is a big mess-o-wires. Search dupont header cable on ebay. Male to female do most jobs but sometimes female to female and male to male are useful. Arduino protoboards are also very useful, and some come with rows of 5V and 0V headers (both male and female) so things can be plugged together in lots of different ways.

I also picked up some assorted heatshrink packs and put this on every soldered connection - working in a box for a while can cause wires to break at the solder connection and heatshrink prevents this.

I put a 24V transformer in the box and relays switch 24V. In a pump control box there are 24V relays which then drive contactors. This is one way to amplify a tiny arduino signal up to something that can control 10kW with two steps and with isolation all the way.

Step 5: Talking to the Internet

Ok, so we can sense things, and control things and do it over distances up to a kilometre or so. Why not the internet?

In the attached programs are some vb.net examples that show how to upload to xively. You can download data from xively or use xively to produce graphs and process data in other ways.

There is also a little vb.net routine to send an email and a little algorithm to work out when to turn things on and off. In general terms, I figure that if you can measure lots of things and control lots of things, there must be some sort of combination of loads to switch on and off to match the power being produced.

There are also ways to talk to xively directly from an arduino, however I didn't have much luck with this as the modules seemed to latch up after a week. This made debugging very hard, as it was not clear if this was a stack overflow software issue in the ethernet module, or an overheating problem (the chips do run hot), or glitches from things turning off nearby. A possible solution would be to reboot the module from time to time.

There are also wifi modules that are getting cheaper, eg the $4 ESP8266. I've got these talking to the internet and to google, but real world solutions like xively do stretch the memory of an arduino UNO, and there is a bit of string manipulation which can fragment the memory.

So while in theory one could upload data to the internet and download it elsewhere to control a pump, I couldn't get that quite to 100% reliability, and found dedicated 433Mhz networks were a better solution.

I guess overall this is partly about helping the environment and partly about saving money. There are many numbers to calculate with respects to solar systems, but the main one that matters is payback time. Currently this is an approx $10,000 system that has saved $6,000 in the first year so payback time should be under 2 years, and this was with no government subsidies. As an aside, there was also a wind turbine but it failed after one year and looking at the energy it produced it was going to pay for itself in about 200 years, so solar makes a lot more sense economically.

Please let me know if there are any questions or things that need clarifying in more detail.

Cheers, James Moxham

<p>Can someone send me this procjet at simon.malulu@gmai.com</p>
<p>simon.malulu@gmail.com</p>
<p>This is a very complicated system that produces a relatively huge amount of electricity. It may make sense to be a part of the grid generating system as a private individual but most people will probably prefer to generate just what they need and make it fairly simple. Solar panels generally produce a very fine quality DC (direct current) of approximately 21 to 23 volts which can be stored by conventional lead acid batteries or other types of batteries. Batteries really like solar panel electricity, store it well and panels can be hooked directly up to batteries for greater efficiency. There are many 12 volt dc led lights, permanent magnet motors that pump water water, 12 volt dc chargers for 14 to 18 volt dc laptops and 4.5 to 6 volt USB devices, as well as a huge number of very efficient 12 volt dc to 120 volt AC inverters. All in all, generating your power to reduce your impact on the grid and making a way to live well if the grid ever shuts down makes perfect sense.</p>
Some very interesting thoughts there. I started in this some years back with DC systems and I got quite confident building these, and then later I realised that AC is not that hard either. The key point I discovered is to do with economies of scale and AC things are made in much larger numbers than DC things and they end up a lot cheaper. Case in point would be DC vs AC pumps, and an extreme example would be trying to source a DC 5kW DC airconditioning system. The next leap in the thinking is to see DC and AC as the same - convert DC to AC with a grid tie inverter, transport that energy within your house (ie behind the switchbox, as it were) and then use it in other locations. I'm currently looking at batteries as you suggest, and while you can charge a battery with a solar panel directly, you can also convert the energy to AC and then use an AC battery charger. There are some intriguing efficiencies there as well - convert DC to AC and you can use a maximum power point tracking system, and you may actually be able to extract more energy out of the solar cells compared to direct DC charging. <br>My ideal system is to have an AC system with solar to AC, then AC to loads, and also AC to batteries and batteries to AC. Measure the power at the meter and produce the same amount of power, and effectively disappear off the grid. It is almost the same as being off grid, but you get the backup of the grid for extreme loads - eg if the batteries are flat and it has been cloudy for a week. <br>Or I guess you could rewire the house with 48V DC or 96V or similar. <br>I picked up some more solar panels the other day - these were bought with money saved with this current system so they are essentially free. Intriguing comment from the bloke selling the panels - he says forget coal, forget nuclear, forget fossil fuels, forget trying to save energy and even forget climate change. Yikes! He says we should not try to use less energy. We should use more, and we should use it with solar power with systems we already have, and then we can improve our lifestyles by using more energy. Crazy thinking and most definitely not politically correct - except that I have built a system here with no government subsidies, all paid for at true market rates, and it has paid for itself in 18 months and now it is making money and I can use that money to buy more free energy. So this could be a challenge to governments - if one private individual can become energy neutral, why can't a whole country become energy neutral?
<p>For a nation to become less wasteful starts with leadership...terminology is key. Presently when govs talk about conservation, they refer to the ideas as austerity rather than efficiency. For an individual with very little desire, solar power is just a passing thought. Most working people do not have the time or the inclination to invest themselves in bucking the politically incorrect notion of conservation because energy is cheap. Only when energy becomes too expensive or unavailable will everyone climb on board the energy efficiency train. I suspect that those who are investing in solar are living in fringe areas. In my travels, I see lots of sunny areas in the US barren of panels and places with very little solar potential, like Vermont, loaded with panels due to gov subsidies. People like you and I are not the norm....we just like adventures.</p>

About This Instructable

3,640views

86favorites

Bio: Dr James Moxham is a general medical practitioner in Blackwood, Australia. His interests include general family medicine, medical politics, microcontrollers and tending a rose garden ... More »
More by James Moxham:Charlieplex 30 Led Bargraph Arduino Dual 20x4 Display Arduino 10 bit analog output 
Add instructable to: