Hacker News new | past | comments | ask | show | jobs | submit login
Raspberry Pi Zero – Conserve power and reduce draw to 30mA (midwesternmac.com)
178 points by geerlingguy on Nov 30, 2015 | hide | past | web | favorite | 89 comments

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...

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!

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.

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).

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.


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 )


In general the mbed has the better options for low power , but if you prefer the arduino, this would be a good starting point:


And if you want a long-range, low-power wireless connection - use LoRa , There's a driver here:


How have you found the mbed OS tools/community/documentation to be? I've played around a bit with Arduino but I'm interested in checking mbed out.

In general Arduino definitely leads in documentation. The mbed community is smaller , but on the other hand more professional - so stuff would be of higher quality , less bugs , etc - but somewhat more complicated. Same goes for the tools - more complicated but more capable. If you're aiming towards something professional/startup/etc - mbed is the way .

Depends on how they communicate between each other. I'm doing some stuff around LoRa [1] for long range communication, and my base station is a Rpi, the end nodes can be any type of microcontroller. E.g. [2] which comes with ARM's mbed, which even allows me to program them from the browser. For Bluetooth pick anything based on nrf58122, e.g. [3]. For WiFi pick ESP 8266 [4].

[1] http://www.link-labs.com/what-is-lora/ [2] http://www.multitech.com/brands/multiconnect-mdot [3] https://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Blue... [4] http://www.espruino.com/ESP8266

If you need something that has clock speed in the hundreds of MHz and RAM in the hundreds of MBs then the Arietta G25 is maybe a good option - http://www.acmesystems.it/arietta.

Until this current wave of boards (CHIP, RPi zero) it was pretty much on its own in the land of dev boards - substantially beefier than Arduino, ESP8266 and Teensy 3.2 but way leaner than the RPi and BBB et al.

I still think it's a nice piece of kit even in the context of these new ARM boards.

Update: found some numbers on current draw - looks like out of the box it sits around 40mA idle, so slightly more than they tweaked the RPi Zero down to. http://www.robertoasquini.com/?p=148

Looks really nice. How do you find the low-level peripheral stuff? Past experiences have taught me to trust Atmel's data sheets and examples way more than the ST or NXP ones, but that's been on simpler chips/projects, so I don't know if it carries over to here.

Also, is there an easy way to have an isolated realtime component, eg closed loop controller for motor drive? Could you just set up a hardware timer interrupt that preempts the kernel?

There are good answers already, here is my suggestion : once you are confortable with Arduino, look into using just the microcontroller (for example the ATMega328p of the Uno), and solder it on a protoboard with your sensors. You use the exact same code, you can easily load it via an Arduino (beware, you need an Arduino with a DIP microcontroller you can remove). Look up "Bareduino", that's the spirit.

Then you can have a look to smaller microcontroller (if your project allows it), for example the ATTiny family. You can get to ~10/20uA consumption when using deep sleep and only reading sensors once a while.

The most useful thing to have when working with embedded electronics is to have in-circuit programmers. Please don't get into the habit of swapping parts between, e.g., the Arduino board and your own... It's getting very tedious, very fast.

The simplest programmers (ISP: In System Programmer) are only a few dollars, and they allow you to burn your creations in blank off-the-factory chips without bootloader. I think there's even an Arduino project that turns your arduino into a (very limited) STK500 compatible programmer...

[a quick web search turns up https://www.arduino.cc/en/Tutorial/ArduinoISP ]

Teensy is awesome, cheaper than Arduino and many times more powerful


Esp8266 wifi/micro module. You can program it in lua!

Yeah, ESP8266 is a good choice for IoT projects. It supports quite a few different languages, I think the most recent addition was BASIC. It's very cheap as well (have seen people talking about prices as low as $3).


Also worth knowing that the successor to the ESP8266, the ESP32, is currently in beta testing:



You can order them for about US$3 per unit, or $2.85 if you order 10 from BangGood.[1]

You can get them for even cheaper directly from Chinese distributors.

Banggood, DealExtreme and AlieExpress are convenient and ship worldwide, but they are not the cheapest, although they are usually already quite cheap compared to most.


The Pi (and Arduino) is a gateway drug, imo. As a software guy, I don't think I'd have ever gotten into circuit design or hardware hacking of any sort until I brought a Pi B and Arduino Uno.

For fun, first-time projects, it's a lot easier to have someone write a Python script and go, rather than breadboard a circuit and write in a more obscure, less-abstracted language.

check out http://wipy.io/ . Best of both worlds and draws 850uA in suspend mode.

Cool! I did not realize there was a board with built-in wifi that ran https://micropython.org/

Very cool; unfortunately it's a bit pricey... and won't be available for a while. I'd like to pick one up when it is, though!

At this rate it's not far off what you would get with an ATtiny while active, which consumes around 10mA[0], the difference is that those and other micro controllers have sleep modes which reduce the consumption into the uA range - hopefully details on something like that for the Pi will be released too.

[0] https://learn.sparkfun.com/tutorials/h2ohno/low-power-attiny

But are these phone chip application-class or domain specific ones ? meaning you can leverage linux ecosystem or do you have to program on their ~OS ?

I was looking for the most power efficient thing that could run a minimal desktop on battery and fit into my palm.

Kinda unrelated to the whole Rpi discussion, but the SOC of any phone that runs Android would do. If that is Linux'y enough for you then it could be a solution. The problem is sourcing the SOCs. Spreadtrum makes some nice chips that include app processor, cellular, WiFi, Bluetooth, etc. for ~7$ but they're not for sale if you're not an ODM.

This is a great article [1] about how Chinese SOC manufacturers and Chinese IP works. I ended up just ripping out the mainboard of phones to get access to the SOC [2].

[1] http://www.bunniestudios.com/blog/?p=4297 [2] http://janos.io/

I thougth you were thinking of ~dumbphones, but sure enough any smartphone these days is exceptional in most features. Just today I saw a chinese dual core smartphone phone for 34$... The thing is that unless you're already in the know you can't repurpose the board.

ps: funny, just an hour ago I was trying to flash an old nexus s with CM*.

> "The thing is that unless you're already in the know you can't repurpose the board."

That's why projects like Fernvale are potentially very useful, as they would make it easier to repurpose the cheap hardware used for feature phones:



I heard Bunnie was a master but the FPGA cpu MITM had me sitting down. Fantasy level impressive.

On the higher end you have last gen quad core Intel Atom Tablets with Windows 10, 2gb ram, USB, bluetooth, wifi and 8'' touch screen for 80$ [1].

The price of hardware in China is beyond amazing - honestly I could run a laptop off those specs with a slightly larger better screen (assuming I don't need to compile C++ :D)

[1] http://www.banggood.com/Cube-iWork8-Ultimate-32GB-Intel-Cher...

And even compiling C++... synthetically this thing is 50% faster than my current laptop. In 2008 this would have been a great machine to program in C++.

First and foremost, the Raspi boards are for teaching. That's the goal of the foundation. I would guess the vast majority of people who buy a raspi are dipping their toes in to the world of hardware - not building semi/permanent applications.

Yes there are absolutely better suited platforms.

That's what people who don't own smartphones say about smartphones.

Smartphones last as long as dumb phones if you turn off background data transfers.

So it spends part of the time being highly capable, and part of the time sleeping with no downsides.

The Pi is just not cut out to be a passive battery-powered device.

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.... 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 ;)

It is normal that you are experiencing brownouts if you assume 500 mA is available.

If you power a RPi via micro USB, then the 500mA budget is shared between the RPi and all your peripherals. Your post doesn't say which RPi model you have, but a B+ or a gen2 B will draw anywhere from 230-420 mA idle, so your periphals only have 80-270 mA available.

[1] http://www.midwesternmac.com/blogs/jeff-geerling/raspberry-p...

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).

I have plenty of experience frying BBBs while trying to make LEDs blink ;) http://colorcreative.io/portfolio.html. The reason we use RPis in my place of work is due to USB peripheral support. I love the dedicated PRU in the BBB, though. It's perfect for the tight timing spec required by the WS281x LEDs :)

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

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.

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.

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

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

Our team has personally blown through three of them through shorting faults. It's our fault, but the BBB is a pretty tender beast.

That's too bad, it's pretty pricy :/ It's no $2 ESP8266, I wouldn't feel very bad shorting that, but at $70, I'm going to be super careful with my BBB.

Also, make sure you set the max_usb_current setting to 1 to provide more juice to the ports (see: http://raspberrypi.stackexchange.com/q/27708).

Splice your power supply directly across to the USB cable of the thing you're driving. For the Pi Zero, use an OTG+power cable. I think you can get cables with two A connectors (one for power, one with data+ground but no VCC) and 1 B connector.

I'm not interested personally, but your HN profile doesn't seem to include any contact info.

thanks for pointing that out. I've updated the OP to add that + correct the typo pointed out below

Depending on your requirements a powered USB hub could solve your problems quite nicely.

Also, having a good power supply makes a big difference. I have 2 RPIs running OSMC and used to suffer random lockups/reboots/corruption using a random power supply. Once I switched to a decent supply, they have been rock solid.

Hey, I poked around your website and like what you do! I'm a tinkerer too and have messed with LEDs and mirrors, but was wondering if you've heard of HeavyM [1]? I enjoyed a lot and it looks right up your alley. It uses a projector for cool visual stuff.

Also - get wordpress and analytics.

[1] http://heavym.net/en/

I thought USB 2.0 had 500ma max current?

indeed, you are correct https://en.wikipedia.org/wiki/USB#Power

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.

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?

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.

You can underclock and use the ondemand cpu governor

Does it have something in the way of sleep states, outside of being shut down?

This is another thing I've been investigating, and so far I've come up dry. I really wish there were some way of scheduling it to go into a sleep state, and wake up every 30s or every minute, something like that... you'd think the mobile processor would have some way of doing this, but so far all my searching has been fruitless :(

There are hardware add-ons like the Sleepy Pi[1], but that's a large added expense, and makes the management of the overall platform a lot more complicated.

[1] http://spellfoundry.com/products/sleepy-pi/

Can you try running things through powertop (follow the recommendations) and measure any possible differences?

Please can somebody build a case for the Pi Zero in the form factor of the Psion 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):


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/

Now there is one design that should make it to thingyverse.

I would love there to be a modern Psion Series 5. I'd just stick an android device in the nice clamshell case though.

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.

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.

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.

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.

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.

The Raspberry Pi runs on a fixed 5 volts. At a fixed voltage power will scale linearly with current.

That's a poor excuse for not using the correct terminology or the correct units.

I use Watts on the page where I aggregate my results[1], but since most USB-related projects measure mA (and most battery ratings use mAh), I use the same convention as a default, since 5V can be assumed in all cases.

[1] https://github.com/geerlingguy/raspberry-pi-dramble/wiki/Pow...

It wasn't intended to be an excuse for not using "correct" terminology or units.

The reason that these terminology and units were used by OP was because at a fixed voltage it is common for engineers to think about current instead of watts... even when their aiming to reduce power.

I'm not sure of the exact reason for this, but I suspect that it's because:

a) Measuring current is a more fundamental function of instruments. Quite a lot don't even measure power. So talking about current instead of power, even when you're aim is to reduce power, makes for a smoother process from a practical sense.

b) Batteries are usually measured in mAh. At lower power/currents you're usually using a linear regulator and therefore dividing mAh by mA is a very important measure. So you often keep everything in mA.

I have pretty much never seen a component specify wattage. They always specify the voltage and current draw.

Voltage and current are easy to measure with a pair of multimeters, so it's more useful to have those numbers than wattage.

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.

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

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.

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.

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.


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.

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.

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?

How about using power over ethernet?

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!:


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?

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.

That's one possibility. I can think of a few cases where I'd rather toss in a $5 board with a 50/50 chance of getting it/data back, rather than a more expensive circuit or something that includes a GPS device and could still get lost.

Also, there are other ways to communicate that can potentially use a lot less power than Ethernet or WiFi :)

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.

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.

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!

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact