# Solar charger for RPi



## balanga (May 30, 2017)

Does anyone have any recommendations for a solar charger for a RPi?


----------



## aragats (May 30, 2017)

Well, a charger is to charge, i.e. charge a battery. So first you need to figure out what kind of battery is needed.
The power consumption depends on RPi model and its actual load, let's take a look e.g. here.
Without powerful USB peripherals RPi 3 may consume up to 730mA current. If you want to use a battery directly without any converters, and considering it's supposed to last for 12 hours, you will need 0.73 x 12 ≈ 9 Ah battery (at least). The next question is what type of battery. They all are different in terms of charging current and charging time. E.g. for a NiCd battery of 9Ah you will need to provide 0.9A for 10 hours. But you also need 0.73A for the RPi itself, so roughly 2A must be provided by a solar charger.


----------



## ralphbsz (May 31, 2017)

It's actually not that bad: A pi zero can do most of the tasks balanga is envisioning (sprinkler controller), and with wireless uses about 120mA at 5V (there are several web pages with that number).  So over a 12-hour dark night, it needs about 1.5 Ah at 5V, or about 7.5 Wh.  But any ancillary electronics will increase that, perhaps significantly.

But we can't just run it with a battery that has just that capacity, because (a) it would be mostly discharged every 24 hours, causing rapid wear out, and (b) if you ever get 3 days of bad weather (very rainy and overcast), your battery will actually go completely empty (deep discharge).  I would oversize the battery by a large factor to (a) keep the stress on the battery low, and (b) allow for bad weather.  A nice option would be a standard-size 12V 7Ah battery (about 2x4x5 inches, and not very expensive), which can provide roughly 100Wh.  That is a very comfortable safely margin. Converting the 12V down to 5V is easy (very efficient DC-DC converters can be found many places), and charging systems and solar panels for 12V are very common (because of the automotive / motorcycle / industrial market).

And finally we need to be able to charge it.  Say that we want to aim on average for 8 hours of sunshine per day.  During the other 16 hours, the RPi uses about 0.6W, so during the 8 hours the panel has to deliver 3x that (1 + 16/8) to run both the RPi and recharge the batteries.  That would make for roughly 1.8W.  To account for the inefficiencies (the 12V -> 5V converter is only 90% efficient, the solar -> 12V battery charger is only 90% efficient, and the battery itself burns 10% of the charge in the form of heat), we'll round that up to 3W (I'm being generous).  A solar panel that makes 12V at 3W is easy to find, and about 25x25cm in size.  With battery and charger, the whole setup should cost less than $100.

An interesting question is: Sprinkler valves (solenoids) need 24V AC, *not* DC.  Finding inverters that make 24V from a battery seems hard, and two minutes of google'ing didn't find any in small and inexpensive sizes.  This part along might double the cost of the project.


----------



## balanga (May 31, 2017)

ralphbsz said:


> An interesting question is: Sprinkler valves (solenoids) need 24V AC, *not* DC.  Finding inverters that make 24V from a battery seems hard, and two minutes of google'ing didn't find any in small and inexpensive sizes.  This part along might double the cost of the project.



I bought one of these last year in anticipation starting my project.

https://www.amazon.co.uk/gp/product/B00BWGDOZ4/ref=oh_aui_detailpage_o00_s01?ie=UTF8&psc=1

Would it be unsuitable?

Many thanks for your guidance...


----------



## ralphbsz (May 31, 2017)

Might work.  By the way, look at the specs: It uses 2W when on (as does a 24V AC valve, they typically draw 0.15 to 0.2A each).  So if your sprinklers are on for 2 hours per day, that's 4Wh, increasing the total power consumption by half.

My only worry is the amount of water such a small valve will let through: It is threaded for 1/4" pipe, and has a 2.5mm (1/10") orifice.  That's pretty tiny.  For drip irrigation, that will probably work; for landscape sprinklers, it might not, depending on how many and what size sprinkler heads you want.

And by reading about sprinklers, I just discovered that normal garden sprinkler valves can be outfitted with DC solenoids, and even latching DC solenoids (intended for battery operation, because they don't use current except while switching).  I have no experience with those, but for solar/battery operated systems they sound tempting.


----------



## Phishfry (May 31, 2017)

Most GPIO pins use 3.3VDC logic. The valve your showing is 12VDC. You would need to use a relay board to fire it off and 12V power for the solenoid. GPIO pins are not rated for much amperage. Best to trigger a relay instead..

http://www.ebay.com/itm/172323098814


----------



## Phishfry (May 31, 2017)

Most solar charge converters use 12/24/36V anyway. So you need to figure out how much $$$ you want to spend on the controller.
Choices range from basic to deluxe with battery thermal monitoring.
The 10 dollar cheapies work.
http://www.ebay.com/itm/192114816781


----------



## balanga (May 31, 2017)

Phishfry said:


> Most GPIO pins use 3.3VDC logic. The valve your showing is 12VDC. You would need to use a relay board to fire it off and 12V power for the solenoid. GPIO pins are not rated for much amperage. Best to trigger a relay instead..
> 
> http://www.ebay.com/itm/172323098814



My PiFace Digital contains two relays.... but I could do with some code to switch them on... I have no idea how to use the sample Linux code I keep coming across, on FreeBSD...

The instructions here are for Raspbian...

http://www.piface.org.uk/guides/Install_PiFace_Software/


----------

