
Raspberry Pi Zero – Conserve power and reduce draw to 30mA - geerlingguy
http://www.midwesternmac.com/blogs/jeff-geerling/raspberry-pi-zero-conserve-energy
======
janjongboom
Why are we even using a Raspberry Pi for battery powered projects... 30 mA
draw is so high you'll be changing batteries every 2 days, and that is without
doing anything. Compare that to f.e. a normal phone chipset with deep sleep,
which draws about 9 mA _with_ a cellular connection, or .1-.2 mA in flight
mode.

Or, if you just use the Pi for sensor readings, get a proper microcontroller,
where current is measured in micro (or even nano-)amps...

~~~
Andrenid
For someone like me who has only just started playing with microcontrollers
thanks to the Arduino and RasPi and has never touched/played with anything
else.. could you give any suggestions/links on what I should consider using
for sensors?

I have a bunch of "nodes" I need to make, each one has a single sensor
(temperature, moisture, light, or distance using a sonic sensor) that will
send back to a Raspberry Pi base station. I was going to use RasPi's for all
of them since it's all I know. Each will be battery powered with a solar
panel. Open to any/all suggestions people can give me on how best to attack
this!

~~~
david-given
The MSP430 is renowned for low power and will idle (i.e. suspended waiting for
interrupts) at microamps.

Architecturally it's a 16 bit Von Neumann architecture at up to 16MHz with a
remarkably elegant ISA and extensions to let it address more memory. Most
interestingly, some devices have 64kB or 128kB of FRAM --- non-volatile RAM
which operates at SRAM speeds! And because it's a Von Neumann architecture you
can load programs off disk into it, which lets you do some cool stuff. (I
ported Alan Cox's Fuzix to one.) Of course, an SD card will use loads more RAM
than the CPU itself.

I believe you can run one with no external components whatsoever. Hook it up
to 0V and 3.3V and it'll run at 8MHzish on its internal oscillator.

~~~
dfox
Another argument for MSP430 as a replacement for arduino and such is that even
the smallest devices support reasonable debugger.

As for external devices: at least G-series need external components to
generate reset pulse to reliably boot (it mostly works with reset left
floating, but whether it reliably works is function of how quickly the power
ramps up, I got burned by this on last project).

~~~
cnvogel
Regarding debugging: I don't know what additional hardware you need to debug
MSP430, but there's Atmel's AVR "debugWire" which works ok with gdb.

[http://www.larsen-b.com/Article/315.html](http://www.larsen-b.com/Article/315.html)

I used it with a AVR Dragon (a rather full-featured, but still relatively
inexpensive AVR programmer). You can use it with Arduino boards, of course,
when you solder in the 6-pin ISP socket. (e.g. the pin header on the right of
[https://www.arduino.cc/en/Main/ArduinoBoardUno](https://www.arduino.cc/en/Main/ArduinoBoardUno)
)

[http://www.atmel.com/tools/AVRDRAGON.aspx](http://www.atmel.com/tools/AVRDRAGON.aspx)

------
perlin
We've actually found that the RPi doesn't draw enough power, specifically to
the USB ports. Our peripherals are within the USB spec of a 500ma max pull,
but even so we are experiencing sporadic CPU brownouts. The first thought was
to double the max_usb_current in /boot/config.txt, but that only lengthened
the time between brownouts. We looked into hacks that could increase the
current even more, such as this bypass method:
[http://hackaday.com/2015/04/06/more-power-for-raspberry-
pi-u...](http://hackaday.com/2015/04/06/more-power-for-raspberry-pi-usb-
ports/). Unfortunately, this isn't a viable solution as we continue to scale
up our deploys. Some viable alternatives include switching to a board that
supports USB3.0, underclocking the CPU, or doing a custom solution through
Element14. I really wish the RPi was more stable around power / fault
tolerances, but they're a blessing nonetheless :) [Plug]: If you're based in
NYC, enjoy hacking hardware and find these types of problems to be delightful,
please shoot me an email: mykola@colorcreative.io ;)

~~~
lemevi
Have you tried a BeagleBone Black or any kind of BeagleBoard? What are you
scaling RPi's for? Arduino and Raspberry pis strike me as toys compared to
BBB's. BBBs are a lot less forgiving and require way more understanding of
basic electronics to do anything with, even as simple as lighting an external
LED will break your BBB if you didn't do it right, but they seem more powerful
in terms of what you can do (although underpowered compared to Rasbperry Pi
when it comes to video processing).

~~~
StavrosK
Wait, how can you break the BBB with a LED? I'm going to use one for a LEGO
robot, and I'd like to not fry it :P

~~~
lemevi
The gpio pins have low tolerance. Apply more than the 8mA or 3.3v and you
permanently damage your board. LED's usually require 20mA to achieve a good
brightness so you have to create a safe circuit using a bipolar transistor and
the 3.3v power pin which supplies way more current than a gpio pin. If you
hook up that transistor wrong or short the circuit it's game over.

I actually think you can even damage the board if you create a short between
the gpio pins and ground. So any kind of circuit requires a resistor,
carefully reading the system manual and data sheets for your components and
using ohm's law prior to hooking up components.

~~~
StavrosK
That's good to know, thank you. I'll have to only drive the MOSFETs with it,
in that case, and avoid too much experimentation.

~~~
lemevi
Oh I wasn't saying not to use a bipolar transistor. In any case, both would
work. Good luck!

~~~
StavrosK
Oh, no, I need the MOSFET anyway because of the load. I generally meant "I'll
avoid unknown components/experiments with the BBB", thanks!

------
geerlingguy
After posting a comparison of power consumption of the Pi Zero vs other
Raspberry Pis a couple days ago, I spent another couple hours today testing
various methods of reducing power consumption, and was able to get the idle
power usage down to about 25-30 mA on the Pi Zero!

Thanks to a few suggestions from others on the Raspberry Pi forums, Hacker
News, and Reddit, I am able to disable the ACT LED and HDMI, and that results
in a 5 mA and 30 mA savings, respectively.

~~~
analog31
How much of this applies to the bigger RPi models? Also, can you throttle the
clock speed of the microprocessor and further reduce current consumption?

~~~
geerlingguy
In my testing, underclocking only showed power savings when really stressing
the CPU, so it's not as useful to me. I didn't do any GPU-related testing
though.

------
cstross
Please can somebody build a case for the Pi Zero in the form factor of the
Psion 5?

[https://en.wikipedia.org/wiki/Psion_Series_5](https://en.wikipedia.org/wiki/Psion_Series_5)

(The patents on the folding keyboard will probably have expired by now -- the
design dates to 1994-95 -- and with a 30mA draw the Pi 0 is within spitting
distance of the sort of power the Psion 5's twin AA cells delivered. Add an
e-ink display and a wee USB bluetooth peripheral for i/o (wifi too, if it can
be done within battery limits) and it could be the second coming of the form
factor of the Sharp Zaurus Z-1 Netwalker (only with a better keyboard and more
usefully open software stack):

[http://www.engadget.com/2009/08/27/sharps-5-inch-
pc-z1-netwa...](http://www.engadget.com/2009/08/27/sharps-5-inch-
pc-z1-netwalker-honors-the-zaurus-legacy/)

~~~
yasth
Were you to want to, you'd have much much more space and could just convert a
lot of the body to li-ion which is probably a better use than really trying to
get it last that long on AAs. (Also there are probably better processors,
unless you really need the graphics performance (though not all the time of
course), it really is true that the RPi is a GPU with a CPU accessory, shame
it is so hard to do compute with the GPU)

Anyways for your needs I'd look at the CHIP, which is much like the rPi 0
except it has WIFI and BT connectivity, plus built in power control and
charging circuitry (and costs $9 (or $8 if you are fast)) [1]

A hackish job is probably possible, the hard part would be sourcing the
display.

[1] [http://makezine.com/2015/11/28/chip-vs-pi-
zero/](http://makezine.com/2015/11/28/chip-vs-pi-zero/)

------
joosters
Does the PI have any kind of 'deep sleep' support? If you could put the system
into something like ACPI S3/S4 sleep state (suspend to RAM) and make it
periodically wake up every n seconds, you might be able to save a lot more
power. The PI would still be usable for many tasks, e.g. data sampling every
few seconds.

~~~
geerlingguy
I've been looking into this; besides people calling me a 'noob' for not
knowing how to do this (but not offering any suggestions as to how it' stone),
I haven't seen any way to put the Pi in an official sleep mode, short of
buying a Sleepy Pi hat that basically runs a lite Arduino as a hardware power
management layer on top of the Pi.

------
chatman
Why are you referring to the units of mA for "power", as opposed to current
draw? The power consumed would be measured in watts or milliwatts.

~~~
weland
When studying power consumption for this type of devices, it's extremely
common to measure the current being drawn, rather than to put out values in
watts.

For one thing, it's the current that you usually measure in these cases
anyway. For the other, power consumption in watts is not what you generally
want to know when you design a battery-powered circuit. And, last but not
least, it's more useful to have a figure in (m)A than (m)W when batteries are
rated in mAh.

It's not correct terminology, mind you, but then neither is that of energy in
your energy bill, so I guess this can be forgiven.

~~~
chatman
But the mA units were used in a table whose column heading said "Power saved".
No matter what is "extremely common to measure", but it cannot be put in a
wrong heading.

------
kozukumi
Anyone got any info on running a Zero with WiFi and a camera running off
solar? I would love to build a ~£15-20 IP camera if possible.

~~~
tomjacobs
camera on raspberry pi zero - is it possible? usb webcam? any line into the
csi camera bus?

------
alkonaut
What is the practical difference between 500mA and 30mA? Both are way too high
for battery power, and both are low power in terms of cooling and electricity
cost?

A sensor node with a 5Ah battery would have a budget of .5mAh to have the
battery last s year. That is still two orders of magnitude under the Pi. Power
is interesting for cooling and economics until you get below a few watts, at
which point the power costs nearly nothing and the cooling is done without
heat sink in air without fans.

~~~
jacquesm
30 mA periodically gets within the range that you could do some interesting
things with systems that only power up periodically and are recharged by
solar.

------
exDM69
Is CONFIG_NOHZ enabled in the kernel? It should allow the CPU to remain in a
low-power state if there is nothing of interest happening by disabling all
periodic wakeups that can be disabled.

[https://www.kernel.org/doc/Documentation/timers/NO_HZ.txt](https://www.kernel.org/doc/Documentation/timers/NO_HZ.txt)

------
danepowell
To put this in perspective, 30mA costs about $0.15 / year at typical US
electric prices. 500mA is $2.50. A tiny draw regardless, but probably a lot
more significant if you're running on batteries.

~~~
UnoriginalGuy
Honestly that 15c/year really puts it into perspective why IoT might make
sense. I've always avoided those "smart" light switches and similar because
the power draw on them was too high (and it is likely closer to the $3 mark);
but if something was drawing 15c/year or similar I doubt I'd care.

PS - I know we aren't going to get WiFi for under a few dollars a year. But
physical ye-olde switches are vastly under-estimated I feel. In particular a
button to put it into "configuration" mode.

------
WatchDog
What are the low power options to run one of these with Ethernet networking?

Are there any reviews of the power usage of cheap USB Ethernet adapters?

~~~
ascorbic
How about using power over ethernet?

------
StavrosK
Mandatory OSS project plug: If you want to get your Raspberry Pi communicating
securely with other computers, even over a public network, I wrote a Python
library for that!:

[https://stringphone.readthedocs.org/](https://stringphone.readthedocs.org/)

------
akerro
Ok, it has low power consumption... no eth, no wifi, no usb... how do you
communicate and what for? Running on batteries for two days and manually
coping data from sd card?

~~~
fanf2
It does have a USB OTG port. In principle it should support device mode, but
currently the kernel has it forced off to avoid interop problems, and if you
fix that the driver is known to be buggy. But if device mode can be made to
work then you can use USB gadget drivers such as g_ether to communicate with a
bigger computer using just a USB cable - make a cheap alternative to a USB
Armory, perhaps.

------
markbao
That's really cool - with those settings, you could run it on a single charge
of one of those cheap 20,000 mAh portable batteries for a month.

~~~
teraflop
It might require a bit of hardware hacking to get that to work. I have one of
those battery packs, and according to the manual, it will shut off
automatically when the output current drops below 50mA.

~~~
geerlingguy
Same here. I actually can't run it in this configuration, I have to have
something plugged in to draw a little more power and keep the battery active.
Most of those batteries are designed for 1A+ power draw of a charging tablet
or smartphone!

