2 x amorphous silicon 15Wp panels (Make/brand is IPC Global Battery Saver Pro) |
Finally, I've put this setup to some better use. I'm experimenting with the idea of keeping a Raspberry Pi powered 24/7 using nothing but PV panels and a battery. I'm based in Galway, Ireland (53N, 9W) and here we don't get too much direct sun (clouds keep getting in the way :)... so this goal isn't completely trivial.
My setup so far: 2 x 15W-peak amorphous Silicon panels (300mm x 1000mm) usually laid flat on the ground. A 12V lead acid battery charge regulator, a 40Ah SLA battery. The charge regulator's function is to stop charging the battery when the battery reaches 14.2V.
So I have a nice 12V DC power supply from the battery. But the Raspberry Pi requires the standard USB 5V. A linear regulator could do the job but would be at best only 42% efficient (5V/12V). Instead I'm using a low cost USB car charger (listed as a recommended Pi accessory at Farnell / Element 14, SKU 2113630, cost about €5). This is a DC/DC switch mode converter.
Low cost 12V to 5V (USB) DC/DC converter available from Farnell (SKU 2113630) |
I want the Pi to be able periodically log the battery voltage. Unfortunately the Pi doesn't have an ADC, so it's the Arduino (Leonardo) to the rescue, connected to the Pi via the USB hub. But... the Arduino ADC only handles 0 to 5V, so a voltage divider is used to bring the maximum possible battery voltage (about 14V for 12V lead acid battery) into the 0 to 5V ADC range. I'm using a 39k/12k divider bringing the 0 to14V range down to 0 to 3.3V (I had originally planed to use a 3.3V logic board you see!).
My experimental setup. The yellow device (top right) is the battery charge regulator. The PV panels are outside in the garden. |
Note there is a trade off in the choice of resistor values: you want them much lower than the impedance of the ADC input, but remember that current continuously flows through this divider, so if you make them two low you'll drain the battery! In my case the current is V/R = 12V/(39k+12k) = 0.24mA: an insignificant line item in the power budget. And those values are low enough for use with the Arduino [2] [3].
My original strategy was to take one ADC value and echoed it to the serial port, pause for a few seconds and loop. But I found the data was very noisy. So instead I wrote this Arduino sketch:
void setup() {
Serial.begin(9600);
}
void loop() {
uint64_t a=0; // Need 64 bits due to size of sum
int i, n = 1<<14;
for (i = 0; i < n; i++) {
a+=analogRead(A0);
}
Serial.print((int)(a>>10));
Serial.print ("\n");
}
So I sum 16384 (2^14) ADC samples, but divide by 1024 (2^10). This is ADC oversampling and not only smooths out the noise in the signal, but gives me extra bits of ADC resolution! [4]
So my battery voltage under load (Vbat) vs time chart looks like this:
The goal here is to always keep the battery voltage under load over 12.1V (which I'm estimating to be about the 50% discharge point). [5]
For the first two days I had the panels indoors against the window. I was losing about 0.1V at the end of each day: clearly not sustainable. So I moved the panels outdoors, and this looks a little better. On days 19 June to 23 June (cloudy days with a little hazy sun) I'm losing 0.05V/day. But 24 June and 26 June were sunny and resulted in a net gain in battery voltage.
So the conclusion so far: if we had sunnier weather in Galway this setup would probably provide sustainable 24/7 power to the Raspberry Pi, at least during the summer months when the days are long. But realistically that isn't going to happen. Also in a few months the days will get shorter and the sun lower on the horizon so the available power budget will be greatly diminished. I'm not going to invest in more PV panels, so therefore I need to find ways to shed some load. Hopefully I'll follow this up with a Part 2 in a few weeks.
Footnotes:
[1] I did a quick measurement of the efficiency of the car USB charger adapter using a 10Ω resistor as a dummy load. The input (at 12V) was drawing 244mA and the output USB 5V was drawing 426mA. So the efficiency is (5 * 0.426) / (12 * 0.244) = 73%. When connected the the Raspberry Pi, hub, Arduino and WiPi I measure a mean current of 212mA entering the 12V side of the DC/DC converter. The (approximate) efficiency of a linear regulator is Vout/Vin.
[2] The Arduino (Uno, Leanardo etc) ADC impedance is often quoted as 10k. But that's a worst case scenario where you may be using several different ADC inputs with substantially different voltages. If you're continuously sampling something close to a DC voltage (as is the case with a battery) the impedance is more in the megaohm region.
http://forum.arduino.cc/index.php?&topic=116491.msg876799#msg876799
[3] For ultra low power applications a FET transistor could be used in series with the voltage divider to switch it off when not needed.
http://www.microbuilder.eu/Tutorials/Fundamentals/MeasuringBatteryVoltage.aspx
[4] See this link for an app note on ADC oversampling:
http://www.atmel.com/Images/doc8003.pdf
[5] Information about a 12V lead acid battery:
http://en.wikipedia.org/wiki/Automotive_battery
[6] Note on 'noise' in ADC signal. Actually this is mostly due to power fluctuations in the Pi (and peripherals). I notice a small spike each time I copy the the ADC log file over the network. Or if I run any CPU intensive task. Interestingly, Vbat appears to increase when drawing more current. This is because the additional current causes a small sag in the 5V supplied to the Arduino. The Arduino is using the 5V supply as the reference for the ADC. A small sag in the reference voltage means a higher ADC reading given the same battery voltage.
Other notes:
Similar projects: