7 ms·
How to run an Arduino clone on a 9V battery for weeks or even months
- nathanpc 14y agoGreat explanation. Thanks.
- fr0sty 14y agoThis is a wonderful little piece of information. Thank you. I had the crazy idea a while back about stuffing a micro-controller, temp+humidity sensor, piezo speaker into my guitar case to let me know if the Humidity got out-of-band but I couldn't see how to get this to run for more than a few days with out having a gian5t battery pack or having to plug it in to the wall. Now I know, and knowing is half the battle.
- Joeboy 14y agoTI's msp430s are crazily power-efficient. Worth a look if you want to run a long time on batteries. Or indeed fruit: http://www.youtube.com/watch?v=nPZISRQAQpw http://www.youtube.com/watch?v=nPZISRQAQpw
- catch23 14y agoI think the core argument of the blog post is to use a voltage regulator with a low quiescent current. It doesn't really matter what uC you're using since it's only turned on every few seconds with the watchdog timer, however if you used common voltage regulators like the 7805, lm317, or lm1117, you'll use up the battery in short order.
- theatrus2 14y agoThe best thing is to NOT use a voltage regulator at all. The MSP430 line will happily run down to sub-1.8V levels, which means a pair of AA/AAA alkalines could power your project in time spans well exceeding the shelf life of your batteries (5-7 years, and this was an application coupled to a 802.15.4 radio). For more performance oomph, there are Cortex-M3 parts which exceed or meet the efficiency of the MSP430 line, such as the Energy Micro EFM32.
- catch23 14y agoIf you want to extract the most out of your batteries, wouldn't you use a boosting reg so can extract every last bit? I think for most projects, the uC uses far less power than the auxiliary components around it, like a LED. If you boost the voltage you can use higher logic levels. There are many examples boosting a "dead" 0.5V AA battery to 3V at a lower current. If you use a buck regulator, you could use starting voltages beyond the chip's max voltage limit and burn the power past a typical dead cell's voltage levels -- start with a 12V battery using 1.8V logic and burn the battery down to 2V -- probably around 98% used. I think you'll find that most projects out there use a voltage regulator because you can use up "more" of the battery this way.
- hansc 14y agoYou are absolutely right: Once you get the uC power consumption down with sleeping, others components use the majority of the power and determine battery life for the most part.
- theatrus2 14y agoBoosting regulators are common, but there are efficiency tradeoffs, since: a) boosting regulators consume energy, b) boosting regulators with a sleep mode (so you're not spinning the wheels 24/7) don't start up immediately. Two 0.9V alkaline cells can still power most microcontrollers, especially in sleep mode, and red LEDs will still light. If you really need higher voltage, than the boost is the way to go. I previously worked off of an MSP430-turned-EFM32 product which had a MCU+radio lifetime of 5-7 years on 4-AA cells (two paralleled). Most switcher solutions we looked at wouldn't have netted a measurable increase in runtime due to the much higher sleep currents in those units compared to even the MCU.
- mbell 14y agoA big reason most hobby boards use LDO regulators is that buck-boost topologies are comparatively complex. PCB layout is critical and protections are more complicated. You'll have a really bad time if you try to build a buck-boost switcher in a breadboard and won't have a clue why its not working. On the other hand you can throw an LDO into a breadboard with a couple caps and be pretty confident it'll just work.
- IgorPartola 14y agoI recently started playing with MSP430's. They are fun devices and I think there are lots of possibilities with those. I have no real experience with other uC's so I can't say anything about others or compare. Having said that, here are some very basic impressions: TI's example code is often confusing and over-engineered. It is much better to find advice on blogs and forums instead. The community has some great individuals that will produce great examples and tutorials. Unfortunately, it is very far removed from places like GitHub. Almost all code is shared directly in the forums at 43oh.com. There are a couple of big projects surrounding MSP430's. Energia is, from what I understand, an Arduino-like IDE which lets you program at a much higher level, but at the cost of some performance. When you only have 512 bytes of RAM, it may or may not be an issue. Another one is BSP430 which is a lower level set of libraries. It promises much higher level abstractions at the cost of small performance penalties. I found the tutorials to be rather terse, but I may need to give it more time. Outside of those big projects, there is lots of duplication of effort. It is typical to see 3-5 different implementations of bit-banging UART drivers that are all slightly different. I am no exception, as I started writing my own little set of libraries for dealing with various peripherals. Lastly, a lot of the tutorials out there either use the register names directly (P2IE, P1SEL, etc) or provide really poorly named abstractions (cal_adc_15t30). Most of my time working with it so far has been spent on naming functions something like gpio_get_val(), uart_puts(), etc. P.S.: Physical hardware buttons are terrible devices. Debouncing them is a must and most implementations in the wild are incorrect. [1] is a good read. [1] http://www.ganssle.com/debouncing.htm http://www.ganssle.com/debouncing.htm
- theatrus2 14y agoThe problem with the raw register names is that they're not even consistent between compilers/libraries. However, they're usually the best route to go form an efficiency standpoint.
- IgorPartola 14y agoWell, even doing a #define LED_GREEN BIT6 would be an improvement. However, I'd be willing to pay a small cost in terms of RAM/performance for doing something like this: gpio_get_val(P1, 6); which would return whether port 1, pin 6 is high or low. I think that can even be a macro so it would be compiled down to (P1OUT & BIT6).
- mleonhard 14y agoThe fruit power source made me wonder: Has anyone made a device that is powered by a growing plant? Plant-derived power could be much more robust than traditional solar cells. A solar cell fails if it gets dirty or broken, but a plant will just grow new leaves and branches.
- ars 14y agoSigh. It's not powered by fruit. It's sad how many people believe this. It's powered by the metal. The fruit just acts as a salt bridge from the metal. The power source is the oxidation of metal.
- jcr 14y agoExcellent writeup. Thanks. Are you planing on covering the "What else can you do?" stuff in more detail in another post? If not, then adding a few more details/links in that part would be an idea for improving something that's already great.
- ericb 14y agoI'd love to see a pre-packaged low power optimized Arduino. This would open up a ton of possibilities that I daydream about. I don't want to solder chips myself, though.
- veemjeem 14y agoI'm not sure if that makes sense. I think you'll find that most of the time when you do a project, the microcontroller is the component that uses the least amount of power compared with your other parts.
- ericb 14y agoIt does, for certain use cases (see the guitar case humidity monitor mentioned above). In the RAMPS stack for the 3d printer I'm building where the heated elements and stepper motors burn up proportionally more power, it wouldn't make sense. This would be a specialty flavor of the arduino, not a change for the standard.
- SageRaven 14y agoEver since these small devices have been in production, I've always wondered about their potential use in clandestine installations. Obviously things like the Shiva Plug are almost capable of hiding in plain site, so long as there's a plug near by. I've also wondered if there are clamp-on induction taps that can be clamped to power lines (say, above the tiles in a corporate bathroom powering the lights) and drive low-power devices like a small Arduino. This 9V hack is really cool for sensors and the like, but it wouldn't power a full OS with wireless AP ability for very long.
- Maakuth 14y agoHmm, indeed. Some sort of rogue mesh network installation powered by induction should be interesting for people like the Syrian opposition.
- chris_mahan 14y agoI think right now the Syrian opposition is more interested in anti-tank and surface-to-air missiles.
- johngalt 14y agoHow about this: http://en.wikipedia.org/wiki/Thing_(listening_device) http://en.wikipedia.org/wiki/Thing_(listening_device) Powered by an external radio beam. Transmits by modifying that same beam and reflecting it back. No internal power source. No active transmission. Weighs 1.1 ounce and was built in 1945
- gpurkins 14y agoSparkfun also has an exceptional write up on how to get into the microamp ballpark: http://www.sparkfun.com/tutorials/309 http://www.sparkfun.com/tutorials/309 The article's try and see approach is very detailed and a great read for anyone looking to get into prototyping with AVR for battery based projects.
- stephengillie 14y agoVery cool. This is how final projects should be -- we shouldn't just shove the entire prototyping board into whatever we're making. Any clues for how to keep 9v batteries providing enough juice when they're in the fridge? I'm trying to build a fridge monitor: http://gilgamech.blogspot.com/2013/02/wireless-temp-sensor.html http://gilgamech.blogspot.com/2013/02/wireless-temp-sensor.h...
- swamp40 14y agoLithium is the way to go for anything < 20°C. (A refrigerator should be around 2°C.) Digikey carries 9V lithium cells.
- Eduardo3rd 14y agoCool starter project! You could solve this problem in a couple of different ways. The most obvious would be running the circuit off of the fridge power supply directly. I'm not sure how comfortable you would be with re-wiring your fridge though. The potential to start a fire is probably relatively small, but it still exists. Another option would be running a small heater around the battery itself. It shouldn't take very much power to keep a 9v warm enough for minimal losses in a fridge. (http://www.bipowerusa.com/products/bipower-bl9v-u.pdf http://www.bipowerusa.com/products/bipower-bl9v-u.pdf)
- HeyLaughingBoy 14y agoInstead of using a heater to warm the battery, much better to find a battery that is rated for the temperatures you need to use it.
- Eduardo3rd 14y agoTrue, but if someone is going for low cost off the shelf 9 volt batteries it could be a temporary solution. Plus they would learn how to build an electrical heater, which is a useful skill to have for lots of applications.
- stephengillie 14y ago
- ay 14y agoI have a dark corner near the entrance door and I made a battery-run light (2 LEDs - to light up the key hole) with very simple logic: when you press the button, it lights up for 2 minutes, then blinks for another 2 minutes; then blinks faster for another minute; then goes dark. The button is wired to "reset" pin of an attiny45, the LEDs are connected to two pins of the chip, and the code, predictably, ends with a low-power sleep instruction. Two 2100mAh AA-sized accumulators provide the power. I "launched" it into use about 4 months ago (I forgot the exact date), still did not have to recharge.
- chimi 14y agoJust out of curiosity, why have it blink for 2 minutes, then faster for 1 minute?
- theatrus2 14y agoThat would be annoying to me too. I'd have it PWM dim.
- ay 14y agoUnhelpful when you are putting in the keys - better strobed full-light than dim - the latter sounds cool but is impractical. The human vision is much more effective at flash-like lighting than at a constant near-zero one. At least, mine and my cohabitants :-) Try it IRL and then tell me your opinion, I'm curious to know your opinion.
- jevinskie 14y agoSo you aren't left in the dark without notice?
- ay 14y agoexactly. This is to say "soon it will be dark, press the reset if you are sure you need a lot more time and just hurry up if you do not". Most of the time it really is no-op though.
- juanre 14y agoA good option when you only need to monitor a few signals is to use an xbee series 2 module, that will also wirelessly transfer the data to a central server. It can run attached to an Arduino, but also stand-alone. "Building Wireless Sensor Networks", by Robert Faludi, is a very readable introduction.