Exploring Solar Power - Where do I begin?
I've got a new shed...
And even though it's wired for power, my 16x9m shed is going to be powered as much as possible from solar panels and batteries. Given that I have more than a few computers and radios in there, this is going to be a challenge.
The house already has a set of panels and a big inverter, so this is really my own personal R&D project. For safety, I am not attempting to connect my work to the house wiring, or feed into the grid. I will be running separate wiring to power this gear.
A note on safety
Electricity is dangerous. Contact with live wiring or components can be fatal. I can't state this clearly enough, electric shocks can, and do kill people. Batteries contain dangerous chemicals and can give off flammable gasses, which in a confined space can be explosive. Connecting or disconnecting batteries can cause sparks, which could have very bad side effects.
I will detail steps to mitigate these risks, but ultimately it is up to you to be careful.
You don't have to build the whole system in order to learn. You can start with me at the beginning and work on relatively safe, low-power components, then decide how far you want to take the project in your own environment.
Where's the code?
You can check out the code on Github:
There are excellent books on photovoltaic and battery systems, so I am not going to reprint that information here. My goal this time is understand how the energy moves through the system.
Clearly we have a panel of solar cells, each generates around 2 volts DC at a low current. The panel maker connects these cells in a series/parallel combination to give us higher voltage and current outputs.
My end goal is a fully automated charge controller, but I need to figure out how to do that first. I am planning on doing this in stages, so lets begin with something that lets us see what is happening:
For testing, I am using a 12V 20W panel, commonly used to keep car batteries topped up. My battery for the test is a 12V SLA (Sealed Lead Acid) with a 6.5Ah (Amp/Hour) rating. These batteries are often found inside of UPS or in my case in an electric kiddie-car. This combination is not going to yield very much useful energy, but it does give us a safe place to start working.
We need to know the voltage and current, and these are very easy to gather. An arduino has a number of ADC (Analogue to Digital Converter) channels built in. To get started, we will use channels 0 and 1 (A0 and A1).
A0 is used to measure battery voltage. For this, a simple resistor voltage divider is used. Values of 1M and 91K were determined experimentally, because it will allow an input voltage approaching 50V without exceeding the 5V limit of the micro controller.
DC Current is measured using an ACS712 sensor. I have chosen the 30A version of the sensor because it avoids having to upgrade later.
DC Power is simply the product of Voltage and Current, so this is easy to work out.
I chose to use a 20x4 LCD panel this time because I might want to add a lot of data on the screen at once. The photo above shows the result with the panel at a window on a sunny November day in Sydney.
The code for this test is contained in the "Monitor-1" directory under the GitHub repository. No attempt is made at this point to control the power, we are simply reporting what we see, and it's a useful test of the basic sensors.
This simple design will also show up an interesting problem. The open-circuit voltage of the solar panel can greatly exceed the stated value, albeit at a low current. My panel could reach 22V if the battery is disconnected. Regardless, this is a risk we need to deal with.
I had intended to add an under-voltage cutoff using a relay controlled by the arduino. The software will activate the relay only when the battery voltage as above 10V. After observing the over-voltage behaviour I decided that we also need to operate the cutoff when the voltage gets too high. (14V).
This means I now have two sets of outputs, one for the battery and another for the load.
We are going to control the relay using the D2 output on the arduino. I chose to use a relay module rather than create my own driver. This relay could also be used to drive a much bigger relay if need be.
Arduino Mega2560 Board. We don't need all the I/O yet, but it's an investment for the future.
20x4 LCD with I2C interface module.
ACS712 current sensor module. Specify the 30-Amp version
Resistors 1M0 and 91K 1/4W 1%
Solar Panel. 20W or more, 12V under load
Rechargeable Battery. 12V 2Ah or higher
For now, we are powering the unit from either the USB port or the barrel connector. In a later installment, I am going to cover options for powering the controller, and discuss merits and issues with different approaches.
If you're going to start building, give some consideration as to how you're going to mount everything. At this stage, the project is on a breadboard strewn across my desk, but this is not going to last, especially once we start dealing with heavy currents. I am considering using a 2U rack-mount enclosure. More information as it comes to hand.