Powering the Raspberry Pi
Pi power consumption is actually quite low - from about 100mA (Zero/A+) to about 250mA (modern B series). Even the original Pi B only consumes about 350mA. The camera adds another 100mA to these figures and (for the B series) and you would also have to add any power provided by the Pi to any attached USB devices, however "in theory" all you should need to run the original Pi A or B is the standard 500mA USB charger
However it didn't quite work out that way ...
Despite the low power requirement, when the Pi was first released it was quickly discovered that almost no "500mA" USB charger was capable of maintaining 5.0 volts at 500mA. Indeed, to get anything like 5.0v, you needed a charger rated at 1A. What's more, even some 1A chargers proved unable to regulate their output voltages sufficiently well enough to avoid dropping below 4.75v and causing 'random' Pi resets.
This should not have been surprising as most USB chargers are designed to recharge phones, not cope with the wildly varying demands of the Pi. Many phone manufacturers, knowing that their phone would cope with anything from 4.5 volts upward, had little incentive to spend money on clever circuits capable of maintaining a steady 5.0 volts from their 'freebie' bundled charger. About the only 'charger' that would 'do the job' when the Pi was released was the BlackBerry (an early 'smart' phone) charger and those intended for Tablets and eReaders, and, at £10 and up, none of these were 'cheap'. However manufacturers of 'generic' 1A USB chargers, being unable to 'predict' what voltages were required, typically output a more stable 5.0v (some even 5.2v) at their full rated output current So, it should be quite possible to use a 'generic' charger rated at 500mA (so long as you are not powering lots of external USB devices from the Pi = i.e. for the Zero, A/A+), however I would recommend adding a decoupling capacitor of 1,000uF/6.3v (or more) across the Pi 5v power rail.
You can now find perfectly good 'generic' 1A chargers that will power the Pi at well under £5 (check out your local Poundland - as of May 2017 they had a 1A rated USB output 'power block' (to which you have to add the cost of a USB to micro-USB cable, for another £1). However, whilst the charger itself might be small, the massive UK mains plug pins makes these less than ideal for building into a project.
To avoid the need to chop off the UK plug pins, look to eBay for 'international' USB chargers, especially those that come with 'mains pin adapters' for various 'mains power' socket types. These can typically be used without any adapter (by soldering direct to the input mains 'lugs')
Note that, since the Pi B3 can actually supply decent current to directly connected USB devices, it is recommended that you use at least a 2A rated USB power supply
'Back-driving' from a USB hub
The Pi Zero, A/A+ have a single USB port and really need to be used with a USB hub - and that hub should have it's own power supply. To avoid the need for a second USB power supply for the Pi, it makes more sense to power the Pi from the hub.
Whilst the B series had more than one USB socket, early Pi's limited their USB output current to about 200mA (only the later B3 Pi was capable of delivering 500mA on it's own USB sockets). A 4 port hub could (in theory) supply 500mA to each of it's 4 ports - and no Pi is able to deliver the required 2A to that hub without blowing diodes and burning out circuit tracks. So it's 'recommended' that any hub used with any Pi have it's own PSU, in which case you might as well power the Pi from the hub. This is known as 'back-driving' and whilst the USB standard requires that 'no USB device shall provide power at any input plug', that's not going to stop the determined hobbyist :-) A 'real' 4 port hub should have a power supply capable of suppling 500mA to each port. This means it should be rated at 2A, however almost every hub I've ever found with any power supply at all, has one with a measly 500mA rating. Only the (much) more expensive ones come with a 1A supply (and I've never found a 4 port hub with an included 2A supply). However, there is nothing to stop you buying a cheap hub and cheap 2A 5v PSU and putting the two together, after which it turns out to be quite easy to back-drive the Pi. NB. try to find a 'generic' hub with a 'power in' socket (it's a lot easier to connect to a socket that already exists and there is at least some chance that the hub PCB tracks will be thick enough to carry the current)
1) The typical hub comes with a standard USB plug on the end of it's 'up link' cable, which is fine for all but the Pi Zero (for which you need a hub with a micro-USB input cable, see (2) below).
To modify the hub, all you need to do is add a wire from the Pi USB cable input '5v' to the hubs +5.0v power socket.
At the Pi end, all you need to do is 'bridge' the Pi's own USB socket 'reverse protection' diode (but only on the USB socket you are going to use with the hub).
2) A hub with a 'micro-USB' plug is ideal for the Pi Zero (but can be used with any Pi**). After making the +5v power wire modification, it can just be plugged straight into the Pi zero USB data socket (the Zero doesn't have any 'reverse protection' diodes as it's designed to be powered from a 'host' computer)
**To use a 'micro-USB' plug hub with other Pi's, the Pi micro-USB power-socket has to be turned into a 'data socket by 'taking over' one of the Pi's full sized USB sockets. To do this, you link 2 small wires from one of the 'full size' USB socket (i.e. link the 2 middle pins (Rx & Tx) from microUSB to a full USB) = and make sure to fit a 'blanking plate' to that socket :-)
With the Pi Zero, you can 'back drive' the Pi from a USB to Ethernet adapter, using PoE (Power over Ethernet) !
The trick is to dismantle a 'micro-USB to Ethernet' dongle and pick up the PoE wires from the Ethernet socket. You then fit it with a 24v DC-DC 5v regulator, the output of which you wire to the micro-USB power pin. The Ethernet to USB dongle then effectively powers both itself as well as the Pi Zero !
Many displays - especially older Dell 'Ultrasharp' range (1905FP, etc) - support a 'sound bar'. This means the display has a DC power output - in the case of the Dell's, it's +12v at 1A
A 'Car cigarette socket USB adapter' can be found that will deliver +5v at 1A for £1 or less (these can sometimes be found in the Poundland stores, although most are 500mA, so check before buying) It's a simple matter to 'gut' one of these and use it to convert the display +12v into 5v for your Pi.
It's worth noting that many such displays have a built in USB hub (so much the better for a Pi Zero / A/A+), however you can't run the Pi off one of the USB outputs because to get their 'Energy Star' sticker Dell etc. has to disable the USB power out until some 'host' (like the Pi) 'activates' the hub = so you have to power the Pi off the +12v (which can be 'enabled' via the display Menu) before the Pi can use the USB hub.
Power over Ethernet (PoE)
Some projects - especially those using the Pi camera - will likely place the Pi somewhere away from mains power access. Since an Ethernet cable is more or less required (especially if you want a guaranteed connection and high bandwidth (for high quality images)) it makes sense to power the Pi using PoE. If WiFi (or no connection at all) is a better choice, then you will need to look into battery (and solar) power options = see at end below
Once again, it's the Pi Zero, A/A+ that is the easiest to power in this way. They all need a USB hub with Ethernet (and you can 'tap off' the incoming DC within the hub - and even mount the DC converter inside the 'dongle' - and wire up the DC converter output to 'back drive' the Pi from the dongle USB 5v) The Pi B range is a right pain when it comes to PoE = you have to split off the PoE DC power before the Pi as the Pi Ethernet socket has an internal R-C circuit that will 'inject' any noise on the PoE lines straight into the 100mbs link.
(-) Power over Ethernet - (PoE)
How to power a Pi via an Ethernet cable (PoE)
PoE (in 'Mode B') makes use of the 2 'spare' pairs of wires in a 10/100 standard Ethernet cable. These 2 pairs (pin 4,5 = DC V+, and pins 7,8 = 0v) are 'not used' for 10/100 data transmission, however they ARE used for Gigabit data transmission. The Pi, however, only supports 10/100 (directly or via a USB-Ethernet 'dingle'), so pins 4,5 (blue, blue/white) and pins 7,8 (brown, brown/white) will always be 'spare' - however using them is not as easy as you might think (see Pi model B Ethernet socket issue, below) 'Professional' PoE solutions cost the usual 'arm and a leg', with 37-57v sent down up to 100m of cable (see here for 'proper' PoE specs). Plainly 'aimed' at the Corporate user base, the DC-DC converters required are ludicrously expensive (the 'cunning use' of a 37v 'minimum' is plainly designed to prevent the use of cheaper regulators, which are limited to 36v max). Whilst 'professional' PoE DC-DC converters are prohibitively expensive, if your 'DIY PoE' limits itself to less than 36v (rather than 38v+ used by 'professional' solutions) you can use 'off the shelf' converters. Even the Farnell (6.5-36v to 5v, 1A for about £4) are a fraction of the 'professional' PoE cost. If you are prepared to wait (and are OK with an open PCB product), it's even cheaper from China via eBay ("1/5PCS LM2596S DC-DC Power Supply Buck Converter Adjustable Step Down" 40v in, 2A out, 5cpcs for £3.69 so 74p each) If your cable length can be kept under 50m, a 24v 'feed in' supply voltage can be used ... and for cables of 25m or less, at the typical power consumption level of a Raspberry Pi (even with camera, it's less than 500mA at 5v = 2.5w), a feed-in voltage of 12v (so 2.5w = 210mA) should work just fine (a 12v to 5v (1.8A continuous current rated) DC-DC converter can be had for 68p (Qty 5 off) from China (via eBay)) When going for a DC-DC converter at the Pi, look for a 'buck' converter rather than a 'linear' type (sold by some expensive UK High Street chains, such as Maplins), especially if you are driving more than about 18v down the PoE wires, since (for a 'linear' converter) the higher the 'input' voltage, the higher the heat dissipation.
You can find 'buck' style converters in almost every 'USB car adapter'. Those (such as the 'Smart' adapter) rated for 'car/lorry' use (12v/24v) can be found for a couple of quid (including micro-USB plug cable) from eBay.
Be warned that most of those found in the £1 stores only output 500mA, although this should be (just) enough for the Pi Zero/A+. More to the point, many cheap ones are only 12v input limited - so check the specification 'sticker' carefully before using them for 24v PoE :-)
Whilst the 'car USB charger' will give you the required 5v 'steady state' voltage, many fail to cope with the Pi's wildly variable current demands. This can be addressed with a decent 'reservoir' capacitor (100uF, 6v) at the output of the converter, although you may have to use shielded Cat6 Ethernet cable (to stop it acting as an aerial)
Of course you can buy a 'real' PoE 'HAT' - see, for example, one from RS components (for the rip-off price of £25, for which you get the Pi HAT only, no cable, no 'injector' no 12/24v PSU). Since it's specified to support an input voltage of 36-56v, plainly RS expect you to pay another £25 for their PoE power 'injector' power block (remember, the 36v PoE minimum requirement has been carefully chosen to prevent the use of cheap 24v sources, and for sure to prevent the use of the 'dedicated' 12v PoE injectors that can be found on eBay for less than £5)
Using a PoE hub
Don't bother = all PoE hubs are (of course) limited to 100mbs (a Gigabit hub uses the PoE wires for 1000mbs transmission), and (even on eBay), a PoE hub is at least 3x the cost of a Gigabit hub with the same number of ports. Since it costs only £1 for a PoE 'power injector' (or PoE 'split off') adapter and less than £2.50 for a 12v power-block (eBay), it makes no sense to pay £10 a port extra for a PoE hub. Note that the 4+1 port PoE hub rated at 10/100 can only support an 'up-link' data rate of 100mbs. When spread over 4 'down-link' ports that's 25mbs each. If one 'down' port uses the full 100mbs, the other ports must get 0 ! However a 4+1 port Gigabit hub will support an 'up-link' data rate of 1000mbs - spread over 4 ports that's 250mbs each. That means all 4 'down-link' ports can be run at a full 100mbs each (or one at 100 and the other 3 at 300mbs each :-) )
The Pi model B (B/B+/B2,B3) Ethernet socket issue
The problem with the Pi B series is that the designers have chosen a 'clever' Ethernet socket that has internal circuitry which shorts pin 4 to 5 and pin 7 to 8 (so far so good) but then feeds them via some sort of internal resistor / capacitor network into the 10/100 receiver transfer circuits !! (see page 3 of the Pi circuit diagram). This, of course, means any 'noise' on these wires (as would be caused by using them to power the Pi) will be 'injected' straight into the Ethernet data wires leading to data corruption and a massive deterioration in throughput. So, in order to use a B series Pi with PoE, you have to 'split off' the pins used for PoE (4,5 and 7,8) from the incoming Ethernet cable before it reaches the Pi (PoE adapters exist or you can physically cut open the cable). The final choice - replacing the socket - risks damaging the Pi motherboard. Of course you also need to 'feed in' the PoE DC voltage at the LAN end - and an Ethernet hub with 'real' (48v) PoE costs an 'arm and a leg'. You can find 12v or 24v PoE hubs on eBay for not much more than one without, however most have only 4 sockets, many are limited to 500mA per socket and (of course) all PoE hubs are limited to 100mbs. By far the best solution (and the only solution for those using Gigabit hubs) is a pair of PoE 'split in/out' adapters. These can be had on eBay for £2 the pair (or more than double that from a 'Pi shop'), and an off-the-shelf 2A+ 24v 'power block' can be found for less than £5 (or 12v 2A for less than £2.50) if you search around on eBay.
Pi A/A+ PoE
The Ethernet socket is not fitted to the A, so there is plenty of space to 'stick' a DC-DC converter (the output of which can be wired to the USB power-pins, although you will have to bridge the USB 'reverse protection' diode). Assuming you want to 'talk' to the Model A Pi by Ethernet (why else did you run the wires ?), you will then need a USB to Ethernet 'dongle', about £2.50 from eBay (the Ethernet comms chip (LAN9512) is simply not fitted to the Model A) = see below. The plastic case of most 'USB to Ethernet' dongles can be popped open (the rest can be cut open) allowing you to 'get at' the PoE pins inside - indeed in some cases it's even possible to add a DC-DC regulator inside the dongle ! I've not (as yet) found any 'dongle' using the same sort of 'clever' Ethernet socket (that feeds noise from the PoE wires into the 100mbps pins) as used by the Pi B's, however if you do run into one then you will need a PoE 'break out' adapter between the incoming Ethernet cable and the USB dongle. The output of the converter then has to be fed to the Pi micro-USB power socket - or better, you can 'back drive' the Pi from the dongle
Pi Zero PoE
As per the A/A+, however, the Pi Zero (which effectively replaces all but the Pi B3) has the advantage that you can power it straight from it's USB data socket without even needing to add wires or bridge diodes ! So PoE is actually a lot easier to use with the Pi Zero (even compared to the A/A+). Just open up the USB to Ethernet 'dongle', wire the incoming PoE (pins on the Ethernet socket) to the DC-DC converter, then wire the 5V (output from the converter) direct to the micro-USB 'feed in cable' pins = and case closed ! Note. For the Pi Zero almost any 'off the shelf' 12/24v car/lorry 'cigarette lighter socket' USB power adapter can be dismantled and the insides will often be small enough to fit inside an 'Ethernet-to-USB' dongle (especially after de-soldering the full sized USB socket). However, if you are using an 'Ethernet+3port hub' dongle, then the typical car adapter (rated at 500mA) is not going to deliver enough power (3 ports at 500mA each = 1.5A !). So you will need a 12/24v DC to 5v DC converter rated at 2A, and these are actually cheaper than the Poundshop 'car adapter' ('5PCS DC-DC buck adjustable step down Regulator' can be had for £3.40p, eBay = so 68p each). The PCB width is only 11mm (length 17mm) so these will fit within most USB Ethernet 'dongles' (they are rated for a continuous current of 1.8A, same as the 'headline 3A' product). In short, the ease of using it with PoE is just one more reason to stick with the Pi Zero.
This note last modified: 29th May 2018 14:36.
Remember - in 'sleep' mode a Pi will still consume 30mA (model A), 125mA (B) or 70mA (B+) due to the fact that the Pi SoC does not control power to any of the on-board components (which includes the RAM chip). If you have anything plugged in the Pi USB sockets, these devices will also continue to draw full power. So any application that relies on 'zero' power consumption when the Pi is 'not in use' will need to use some means to physically remove the power (eg a relay)
Warning: Lead-Acid (6v / 12v), NiMH (.12v) and LiPO/LiION batteries all require DIFFERENT charging approaches. In particular, the typical charging method designed for Lead-Acid charging will 'burn out' the other types. The only simple 'universal' approach is to use 'trickle charging' (eg. see Circuit 3, here)
A major complaint from the hobbyist side is that 5v is not exactly 'easy' to get from the 'standard' 6v battery pack (4 x 1.5v primary cells or a sealed lead-acid battery - or even 5 x 1.2v NiMH, which will start above 'nominal' (so '5 x 1.2' NiMH will be more like 5 x 1.3 = 6.5v ..). You can't just connect 6v (or more) direct to the Pi - if you do, it will, for sure, trip the over-voltage protection 'Zener' (5v rated) and blow the input fuse (6v rated) or you will overheat & blow one or more of the Pi's three on-board (5v to 3.3v etc) voltage regulators. Standard linear voltage regulators (eg 7805) require at least 7.5v input - and even the 'switching' regulators typically require at least 6.5v (so can't be used to get 5v from 6v, but will work just fine from a 6 cell rechargeable pack = 6x1.2v NiMH = 7.2v) On the other hand, it appears that you can run the Pi direct from 3 x 1.5v alkaline batteries (nominal 4.5v) or from 4 x 1.2v rechargeable (nominal 4.6v) == but only if you don't try to use any of the USB sockets :-)
With a 6v battery supply, you need a proper 'Low Drop Out' (LDO) regulator, such as this one from Maplin (300mV dropout i.e. 5.3v minimum Vin). Of course you can get the same sort of thing from eBay for a lot less, but be warned = there are lots of eBay sellers who claim 'low drop out' (or even have 'LDO' in their headline description) but then go on to specify 'Vin min 6.5v' :-)
A simple (but risky) 'solution' would be to add a couple (or 3) 'power diodes' in a 6v DC supply before feeding it to the Pi .. at 1A a power diode will drop about 0.3v (so 3 will get the 6v down to 5.1), however the Pi's current demand can vary from less than 250mA to over 700mA (idle with camera to storing photo's on SDHC card) - so the voltage dropped by the power diodes will also vary wildly.
Of course there is nothing to stop you using a higher voltage battery pack with a DC-DC down-converter. Typically these have a 'minimum' input voltage requirement of 6.5v- 7v, so this is not a solution for those wanting to use a 6v battery pack (although a 7.5v, 9v or 12v pack would work just fine)
Finally you can use a lower voltage battery pack with a DC-DC 'up converter' (again, the typical Vdiff will be 1-2v, so in this case for 5v out you need 3-4v in)
Using half the voltage means drawing double the current - so a 3v battery pack will only last for half the time
It's well known that you can often 'get away with' running 5v kit on 4 x NiMH '1.2v' rechargeable batteries (giving you a 'nominal' 4.8v). It's also (quite) well known that each NiMH, when 'freshly charged', will deliver 1.35v or even more (so 4 x 1.35 = 5.4 v !) and will continue to deliver over 1.2v for at least the first 20% of their capacity (most only get below 1.2v at the "50% discharged" point = see here).
Since the Pi 'minimum' is 4.75v, some enterprising chaps have actually managed to get this to work = although it's to be noted that this was a 'robot' controlled via Pi I/O pins and not something that tried to use any of the Pi's USB sockets :-)
NB. CPC (and some others, eg Maplin) offer a "joke" 'Uninterruptible Power Supply' (UPS) 'Hat' for the Pi using 6x standard (i.e. not rechargeable) AA batteries (9v) for £26 ('batteries not included' :-) ) For less than half that price it's quite possible to build your own real (i.e. rechargeable) UPS 'batteries included' :-) (see my Pi UPS Project) Note that one problem with the DIY NiMH UPS solution is the 'charger' circuit. NiMH cells can be 'trickle charged' (at constant current - 1/40th the amp-Hr rating of the cell (c/40) - eg using a LM317) indefinitely, however if the cells are exhausted (eg after a power cut), you might want them to charge in less than the 40 Hrs (almost 2 days) that a 'trickle charger' would take (so you can be ready for the next power cut, which is bound to occur sooner than that :-) ). One way to solve this would be to program up a PIC chip to control a 'fast charging' circuit (but that's another project :-) ). The other solution is to use a Power Bank with 'pass-through' charging (see below)
LiPo Power Bank
During the last couple of years, the 'Power Bank' recharger has become quite common and, with prices more than halving in the last few months, is now quite affordable** (although some sellers still think they can rip-off the uninformed punter for upward of £100)
**You can find any number of Power Banks for under £15 in the UK High Street. Both Amazon and UK eBay sellers are even cheaper, with 'rock bottom' prices available from China (when aimed at the smart phone user = replacement LiPo battery packs and packs aimed at the 'model' market (especially model aircraft) are still way too expensive) and watch out for the sellers who offer the case only, without batteries, in an effort to grab the 'lowest price' point ! For the real 'rock bottom' price, go to Poundland, where a single PiPO Powerbank could be found during Q1 2017.
Power Banks contain one or more Lithium Polymer 3.7v** batteries with 5v circuitry allowing the Power Bank to charge phones and tablets (and, of course, allowing the phone charger to recharge the Power Bank)
** LiPo batteries vary from about 4.2v when fully charged to 3.65v when discharged to below 10%. A single cell 'Power Bank' case only, with built in 5v DC-DC converter, is so cheap (99p) that there is just no point in using the 'raw' battery The standard LiPo '18650' cell power rating depends on how far (how low) the DC-DC converter can 'discharge' the cell. A 'conservative' rating would be 2000-2200 mA-Hr (although some sellers claim up to 2800mA-Hr !). To 'up' the capacity, multiple cells are used in parallel. Note that the 'headline' 2000 mA Hr etc. capacities are given in terms of the LiPo (3.7v) capacity. The 'actual' capacity (at 5v output) will be 5/3.7 of the headline figure, and the 'real world' or 'in use' capacity is typically about half the headline value (there will be some losses and because recharging a totally flat LiPo is 'challenging', few systems will no discharge the battery much below 10%) Most cheap Power Banks have simple DC-DC 'dual mode' converters - which can only be used 'one way at a time' (i.e to deliver power to external USB devices or to recharge the Power Bank). If you search around you can find some Power Banks with 'pass-through' or 'charge-through' capability (some call this 'load sharing' or use their own fancy name - like 'Duo-Charge' (Tecknet BlueTek iEP390** / iEP360-W) or 'Smart Charge' (Energizer UE2601, although other manufacturers use 'smart charge' to mean 'fast charge' not pass-through)). These let you both recharge the Power Bank and pass power to the USB output(s) at the same time. A Power Bank with a 'pass-though' capability means a Power Bank that can be used as a UPS ! In fact, by adding your own 'switch over' circuit (even a single diode circuit can often 'do the job') you can use a cheap non-'pass-through' Powerbank. ** Note, I use the Tecknet BlueTek iEP390 as a UPS for my Pi and it works just fine. You will need to check out any of the others I've mentioned yourself = Power Banks are designed as phone rechargers and some (especially older) designs can 'glitch' when the USB power input plug is removed and the unit has to switch over to battery power. Indeed, some older ones with buttons would actually 'auto-off' and wait for the user to press the switch before switching to battery mode ! The Pi Zero with camera will typically run for 5 Hrs from a single cell LiPo '2200 mAHr' Power Bank "UPS".
(+) Power Bank pass through
For more on building a Pi UPS, see my Pi UPS Project
Next page :- Pi WiFi