Design of the Extended Battery Life Power Controller for the Arduino

In a prior post, “Operating an Arduino for a Year from Batteries”, I presented a strategy for operating an Arduino for multiple months off of batteries, assuming the Arduino is used for relatively infrequent data collection.  The strategy essentially involves shutting off power to the Arduino using a special power controller in between the times when readings are being taken.  In this post I will discuss the design of that custom power controller board.

The power controller really has two tasks: 1) convert the voltage from the battery pack to a level suitable  for the Arduino, and 2) turn on power to the Arduino when a reading should be taken and shut off power to the Arduino at other times.  The voltage conversion task can be handled by a Boost switching power converter.  I didn’t want to reinvent the wheel here so tried to find a suitable off-the-shelf module to use for this purpose.  I ran into some challenges that I’ll talk about later.  For task 2, controlling when power is applied to the Arduino, I used a PIC12F683 microcontroller that controls the Shutdown pin (or Enable pin, depending on the boost converter) and also controls a MOSFET switch to solidly disconnect the Arduino from the boost converter for converters that don’t isolate the output load when in shutdown mode.  The schematic of the design is shown below.  (Pardon my hand drawing!)

Power Controller Schematic

Schematic of the Power Controller (Click to Enlarge)

The PIC12F683 has the task of periodically switching On the power to the Arduino and then responding to a signal back from the Arduino to turn the power Off.  Three I/O pins are used on the PIC.  Pin 7 is the GP0 I/O pin on the PIC and it configured as an input.  This pin accepts a signal from a digital output pin on the Arduino.  The Arduino code should raise this output High when it has completed it’s processing.  That action tells the Power Controller board that it is time to shutdown the power to the Arduino until the next cycle.  The 10K resistor in the schematic is used to pull down the input low except during times when it is raised High by the Arduino.  The 2K resistor makes the PIC circuit tolerant of the 5V logic levels present on many of the Arduino boards (the cirucit above also works with 3.3V logic).

Pin 6 on the PIC is the GP1 I/O pin and is configured as an output to control the Shutdown (or Enable) input on the Boost Converter.  When power is not being applied to the Arduino, the boost convert should be put into a low-power state so that battery energy is conserved.  This pin serves that purpose.

Pin 5 on the PIC is the GP2 I/O pin and is configured as on output to control a MOSFET transistor that is used to isolate the Arduino from the Boost Converter.  For many boost converters, simply shutting down or disabling the converter does not disconnect the output load.  Instead, the converter will stop its voltage-boosting function but will leave the output of the converter essentially connected to the input battery.  Voltage drops from the boosted 5V, but will approximately equal the battery voltage.  That level of output voltage will probably cause the Arduino to operate, perhaps unreliably, and will certainly cause the Arduino to draw substantial current.  So, the MOSFET transistor in the schematic is used to fully disconnect the Arduino from the boost converter.  Later when I discuss boost converters, I’ll talk about a model that does not need this transistor, as it is already designed to fully disconnect the output load during shutdown.  Unfortunately, I didn’t have access to this particular boost converter when building the prototype power controller.

The PIC code is relatively simple and is listed at the end of this post.  The general approach is to repeatedly put the PIC to sleep and then have it wake up when the Watchdog timer expires (after about 4.5 seconds for the settings I use).  After a suitable number of Sleep/Wakeup cycles, power is applied to the Arduino util the power-down signal is received back from the Arduino.  If that signal is never received, the controller times out after a certain number of seconds and shuts down the Arduino power anyway.

Because I don’t use any of the special PIC features except the Watchdog timer, the current consumption of the PIC during sleep falls to about 1.5 uA (micro-amps) (or about 7 micro-Watts for the 3 x AA battery pack I am using).  Achieving this extremely low power level requires that you do not use the Brown-out protection circuitry of the PIC, as that feature increases sleep-mode current draw to about 60 uA.

While you can get the PIC to use a miserly 1.5 uA during sleep, many boost converters are not so low-power when shut down.  The boost converter in my prototype uses 35 uA when in shutdown mode, more than 20 times what the PIC uses.  So, the sleep-mode power consumption of my prototype circuit is about (1.5 uA + 35 uA) x 4.5 V = 164 micro-Watts, not particularly impressive.  This brings me to a discussion of boost converters and the various challenges I faced with that part of the design.

My initial choice for a boost converter was the LiPower unit from SparkFun.  My plan was to use a MOSFET transistor on the input side of the converter to entirely remove power from the converter in the period between Arduino power On periods.  This would reduce the sleep power consumption of the boost converter to zero.  Unfortunately, the large and high-frequency switching currents drawn from the battery during power On periods wreaked havoc with the particular MOSFET (IRLU024Z) that I was using.  I wasn’t able to achieve a low Drain-Source voltage when the MOSFET was On, so the MOSFET wasn’t being a very good power switch.  I’m sure someone more knowledgeable about MOSFETs could have solved this problem with a different MOSFET, but I was eager to get something working, so I moved on.

I decided to change to a design where I always powered the boost converter, but I would use a shutdown or enable pin to put the boost converter into a low power state when the Arduino wasn’t being powered.  The LiPower module used a regulator chip that had an Enable pin, but the Enable pin was not accessible through the module terminals.  The surface-mount circuitry also made it hard for me to modify the module to access the Enable pin.  So, I next tried a Minty Boost v 2.0 module, which I happened to have in the drawer.  The LTC1302 regulator chip used in this module has a shutdown pin, but it also was not wired to a terminal in the module.  However, because the regulator utilized a DIP package, I was able to bend upward the shutdown lead on the DIP, removing it from the module circuit, and I soldered directly to the pin to access it.

Below is a picture of the prototype using the Minty Boost.  The screw terminals to the front left of pic include the output power terminals for the Arduino plus some other terminals to facilitate switching other power sources in addition to the Minty Boost.  The battery input terminals are on the right side of the circuit board.

Minty Boost Prototype

Prototype Power Controller using Minty Boost Converter (Click to Enlarge)

I have found a different boost converter module that should be a much better fit for my application.  The module’s design is based on the Texas Instruments TPS61240 chip.  It has an enable pin and claims to have less than 1 uA current draw when disabled!  Also, when the chip is disabled, the output is disconnected from the input battery, making the MOSFET in the above circuit unnecessary.  A converter board has been designed by Circuits@Home, and I currently have some on order.  Because the MOSFET is not needed, I should be able to use this circuit with a 2 x AA battery pack, as I will not have any worries about sufficient battery voltage to turn on the MOSFET.  This links to my post describing the power controller I built using this converter.

Here is a comparison of expected battery life with my current prototype and with future use of the TPS61240 boost converter.  Both calculations assume a 3 x AA battery pack having 7.5 Watt-hours of energy and an Arduino circuit using 70 mA for 1 second out of every 10 minutes.  The Arduino power-on load is therefore 5 V  x  70 mA = 350 mW.

Current Prototype with Minty Boost:  As calculated before, when the Arduino is Off, power consumption of the power controller board is 164 uW (micro-Watts) .  When the Arduino is On, the battery draw is the 350 mW Arduino load divided by the converter efficiency, which I measured to be about 75%.  350 mW  / 0.75 = 467 mW.  Weighting On and Off consumption:  1 sec / 600 sec  x  467 mW  +  599 sec / 600 sec  x  0.164 mW = 0.942 mW.   Battery life is 7,500 mW-hours  /  0.942 mW  = 7,960 hours or about 11 months.

Future Model with TPS61240 Converter:   When the Arduino is Off, the power consumption of the controller should be (1.5 uA PIC sleep + 1.0 uA converter shutdown)   x  4.5 V = 11.3 uW.  The regulator specs indicate an efficiency of over 85% at my load condtions.  So Arduino On power consumption is 350 mW / 0.85 = 412 mW.  Weighting On and Off consumption:  1 sec / 600 sec  x  412 mW  + 599 sec / 600 sec  x  0.0113 mW  =  0.698 mW.  Battery life is 7,500 mW-hours  /  0.698 mW  =  10,750 hours or about 15 months.

I’ll try to post more pictures and discoveries once I get the new boost converter module and build a better power controller circuit.

—————————————————

Below is the PIC code for the Power Controller, written for the CCS C compiler (sometimes know as the PICC compiler). I tried to comment the code enough so that it could be reproduced in another language or for a different microcontroller.

#include <12F683.h>
// Definitely turn off the Brownout protection, as that feature
// increases sleep mode current draw by about 60 uA.
#fuses INTRC_IO,WDT,NOPROTECT,PUT,NOBROWNOUT
#use delay(clock=4000000)

// Pin Assignments:
// A0:  The Power-Down input to this controller.  The Arduino or circuit being
//      fed power must raise this pin High when it has completed its tasks.
//      This power controller will then cut off power to the output terminals.
// A1:  This pin is wired to the Shutdown pin on the Boost converter.  The PIC
//      will set this pin High when it wants shut-down the Boost converter.
// A2:  This pin is wired to the Gate on the MOSFET that connects or disconnects
//      the output of the Boost converter to the output terminals.  The gate is
//      raised high to turn on the MOSFET and connect the Boost converter to the
//      output terminals
// All other IO pins are unused.

main() {

   // The 'interval' variable controls how often power is fed through to the
   // output of the controller.  The 'interval' value times 4.5 seconds gives
   // that duration in seconds.
   int16 interval=133;    // value of 133 is about 10 minutes

   // The 'timeout' variable is a backstop in case the Arduino does not signal
   // back that it is finished using power.  'timeout' times 0.01 seconds is the
   // maximum time that power will be fed through to the output of the controller.
   int16 timeout=300;   // value of 300 is 3 second timeout

   int16 ct=0;    // tracks the number Watchdog timeouts since last power-on.
   int16 i;       // used to implement the power-down timeout.

   // shutdown boost converter and turn off power switch initially
   output_high(PIN_A1);
   output_low(PIN_A2);

   // make all other pins outputs and drive low to eliminate any possible
   // switching currents that may increase power consumption.
   output_low(PIN_A3);
   output_low(PIN_A4);
   output_low(PIN_A5);

   // Set Watchdog prescaler.  WDT_DIV_1024 gives about a 4.5 second
   // watchdog period on my particular PIC, but this can vary substantially with
   // voltage, temperature, and the particular microcontroller chip.
   setup_wdt(WDT_DIV_1024);

   while (TRUE) {
      ct++;
      if (ct >= interval) {
         // enough Watchdog intervals have passed to power the output.

         ct = 0;   // reset counter that tracks Watchdog intervals

         // Enable boost converter and connect converter output to output terminals.
         output_low(PIN_A1);
         output_high(PIN_A2);

         // Wait for Arduino to boot up before checking for power down signal.
         delay_ms(140);      // Uno takes about 70 ms to boot up, but double that to be sure.

         // wait for a power-down signal, but timeout after a certain amount of
         // time.
         for (i=0; i<timeout; i++) {
            if (input(PIN_A0)) break;  // if the power-down signal is present, all done
            delay_ms(10);              // delay 10 ms
            restart_wdt();             // clear the watchdog timer.
         }

         // shutdown boost converter and disconnect output.
         output_high(PIN_A1);
         output_low(PIN_A2);
      }
      sleep();           // sleep until next Watchdog timeout
      delay_cycles(1);   // helps reliability of sleep?
   }

}
Advertisements

31 Responses to “Design of the Extended Battery Life Power Controller for the Arduino”

  1. Arduino Power Controller with Texas Instruments’ TPS61240 « Alan Mitchell Says:

    […] part of my Arduino Power Controller project, I ordered and received the PCBs for the Circuits@Home boost converter utilizing the Texas […]

  2. Ignacio Says:

    I was looking for some useful project like this for my arduino, but i don’t have any pic programmer and my salary as a student doesn’t allow me to buy one, i have attinys 85, is there any chance i could do it with one of those atmega instead of pic?

    • Alan Says:

      I’m not an AVR expert, but I looked at the datasheet for the ATtiny 85, and it does have a Watchdog timer that can wake the chip from sleep mode. That is the key feature needed to be able to write the above code on an AVR chip.

      • Ignacio Says:

        thanks man, ill be looking onto it, now i’m having my final exams in my last semester so can’t full work on that right now, but if i can do it would be great, thanks!

        Ignacio.

  3. David Anderson Says:

    Wow! I was looking for a way to power an Arduino for a long time. Your article showed it all. Thanks for all your hard work and helping a novice like me figure out how to make this happen. Great job!!!!!!

  4. Dennis Jensen Says:

    We WILL be using your idea. Thanks man!

  5. George Klinger Says:

    This post is very useful! I was looking for a way to use a small solar cell and a small Lipo, and this is it!

  6. Dennis Says:

    Very useful informations. Thanks for the tip!

  7. Joe Says:

    Very useful Alan! Helped me a lot
    I am trying to implant this method in my research project. Please let me know how you want get credit for it.

    • Alan Says:

      Glad you’re finding it useful. No credit necessary, but I would be interested in learning more details about how you’re applying the idea in your research project.

      • Joe Says:

        We built a sensor network to measure environmental variables (soil moisture, humidity, radiation, temperature) using Zigbee network. The field site is in forest so either solar panel or AC is not feasible, and your battery control method is exactly what I need!

  8. juan Says:

    If you have to use a mosfet, why this kind of mosfet: IRLU024Z ?

    Could it be 2N7000 or similar ?

    • juan Says:

      Excuse me, I mean BS170 (60V and 500mA) or IRF510 (5V, 1000 ma), (or even 2N7000 200mA 5V ???). I dont know too much of mosfets, but why do yuo need a 10A 55 V mosfet for this board ?

      Best regards,

      • Alan Says:

        The IRLU024Z was the MOSFET I used when I originally tried to turn off the input side of the boost converter, as that MOSFET has good high frequency switching characteristics. I lazily reused it when I changed to output side switching, and it is a bit overkill.

        The important MOSFET characteristics are On resistance (low is good) and Gate Threshold voltage (low is good). When considering On resistance, calculate the voltage drop that will occur when the MOSFET is On and your Arduino is drawing current. If the Arduino and any peripheral devices draw 50 mA of current and the On resistance of the MOSFET is 3 ohms, the voltage drop across the MOSFET is 0.05 A * 3 ohms = 0.15 Volts, which is probably OK. I wouldn’t want anything higher than about 0.25 V. For the Gate Threshold voltage, remember that the PIC circuit, which is powered off of battery voltage is used to turn on the MOSFET. So, the PIC supplies a Gate voltage to the MOSFET about equal to the battery voltage. That voltage must be sufficient to turn-on the MOSFET (i.e. be above the Gate Threshold voltage). So, if you’re running off 2 AA batteries, the batteries could get down to 2 – 2.5 Volts when they get old. This voltage must be sufficient to turn on the MOSFET. ALSO, the On resistance of the MOSFET is affected by the level of this Gate voltage. For low Gate voltages, the On resistance increases, and you may have trouble keeping the prior voltage drop calculation to less than 0.25 Volts.

        I looked briefly at the spec sheets for some of the MOSFETS you mentioned. I would have concerns with the 2N7000 if you are using batteries that drop to less than 3V, as it looks like that MOSFET does not turn On at low voltages, or, at a minimum, has a very high On resistance at that voltage.

  9. Experiment 004 | subspacer.org Says:

    […] it may be interesting idea to [later] build power system – to reduce power consumption not unlike one suggested here and here […]

  10. Tyler Says:

    What did you use to program the PIC chip (e.g., PICkit 3 or something else)?

    • Alan Says:

      I used an Olimex PGM-00004, an alternative to the Microchip PicStart+. I now have a PicKit 3, which I use for my PIC projects.

  11. Gionata Says:

    Wow! This is really what I was looking for!
    I am planning to do the same thing, with an Attiny85v and an Xbee Serie 1. I need to read 3 analog sensors from a remote location and send them to and Arduino.

    The Attiny will be waken up by it’s watchdog, and the Xbee will always be in hibernation when not needed.
    On a particular event the micro will request for Xbee wake up through pin 9, the Xbee will wake, read all the 3 sensors, send data and go back to sleep.
    The power supply should be 2 AA alkaline batteries with at least 2700-2800 mAh.
    The expect battery life you calculated could be realistic, but I think you need to take in consideration the minimum operating voltage of some ICs. For example on the Xbee datasheet you can find tha minimum is 2.8v. The battery will not be exhausted when the voltage will fall down below that level, but the Xbee could stop to work!!!
    So in my opinion you to find the time it takes for the power supply voltage to drop down the minimum voltage requested by your circuit (and I should do the same). Maybe you can use the average load current and look on the batteries datasheet for the discharging curve at that load…. or do you have any other idea??

    Thank you for your post Alan and please correct me if I am wrong!

    Gion

    • Alan Says:

      In my circuit, the Arduino and Xbee module are not directly fed by the battery. Instead the battery feeds a boost converter, which boosts the low battery voltage up to 5.0 V. But, you are right that there still is a minimum battery operating voltage for the circuit. For the TPS61240 converter, the minimum input voltage is 2.3 V, so the circuit will stop working when each of the three AA batteries drops to 0.77 V. The AA batteries are really spent when they get down to 0.77 V, so this circuit really does extract the full mAh out of the batteries.

      • Gionata Says:

        So do you think I should use a step up or boost to extract the full mAh out of the batteries??
        In case of 2 batteries the minimum voltage is greater than 0.77 v of course… should be 1.15 v for each battery in your case…

  12. Alan Says:

    With a 2.8 V minimum voltage, you can’t go below 1.4 V per cell if you are only using two cells. A quick look at the AA Alkaline discharge curves seemed to indicate that you will only get 10% of the battery capacity at a 1.4 V cutoff voltage. So, I think you should think about 3 cells (if your circuit can withstand a 4.5 V initial input voltage). Or you could look at a boost converter, but you always lose energy in a converter due to converter efficiency and quiescent current draw. So, if you can pull it off with just batteries and no converter, you are better off.

    The other option to look at is use of Lithium AA batteries like the Energizer Ultimate Lithium L91. The voltage of the battery does not drop as rapidly over its discharge curve. It looks like you can get 80-90% of the battery capacity before the voltage drops below 1.4 V. Also, these batteries work well in cold weather and have more energy in general than an Alkaline. The downside is price, but I’ve bought them for about $1.50/cell on Ebay.

    • Gionata Says:

      I am using a small box so I can’t fit 3 batteries into that.. The better option in my case should be the boost regulator I think. Even though that are some energy losses.
      Do you know any boost converter model that work well with just 2 batteries?
      Anyway the xbee maximum voltage is 3.4 so I need regulator even with 3 batteries.
      Thank you!

      • Alan Says:

        I’d take a look at this boost converter board from Sparkfun:

        https://www.sparkfun.com/products/10255

        I haven’t actually used it, but the specs look pretty good.

        I would try to run your microcontroller directly from your batteries (I’m guessing the microcontroller can operate down to 2.0 V or so?) and that way you can use the microcontroller to enable and disable the boost converter. The boost converter would feed the Xbee. If you disable the boost converter, it’s current draw falls to around 1 uA, which is very low. If you don’t disable the boost converter, it will draw 55 uA even when the Xbee is asleep.

        If you take this approach, you may not need to mess with the sleep pin on the Xbee, since disabling this particular boost converter will totally shut off power to the Xbee (not all converters work that way).

      • Alan Says:

        Oops, that Sparkfun converter board does *not* give you access to the Enable pin on the converter chip, so you can’t put the converter into Shutdown and get the low 1 uA current. The underlying converter chip, the TI TPS61200, does have an enable pin. You might have to build up the converter circuit from scratch or find a different pre-made converter board.

  13. Gionata Says:

    Thank you for your reply.
    The problem with you solution is that the xbee cannot be shutdown completely in my case. The sensors I need are digital buttons that can be pushed every second, or even more than once per second, but when the xbee boot up it has to rejoin the network, and it could take many seconds. So the only possible solution is to keep the xbee in hibernation and wake it up (it takes 10 ms) to send the sensor reading.
    I have come up with a solution using Maxim max757 boost regulator, configured as in the datasheet. But I will need to build the pub from scratch. Anyway I have already a Pcb with the xbee and the attiny, so it’s only a matter of “space” on the board now… 😉

  14. Johnc116 Says:

    Magnificent website. Lots of useful information here. Im sending it to some friends ans also sharing in delicious. And obviously, thanks for your sweat! daeabedecgae

  15. Extend battery life with a power-controlling microcontroller? | CL-UAT Says:

    […] This article describes a method to extend the battery life: use a low-power controller to switch on the Arduino only when needed. The author states that this method uses considerably less power than using Arduino’s sleep mode. […]

  16. The DIY Arduino datalogger V2 – with low power shut down capability | Arduino based underwater sensors Says:

    […] not always that easy to get back into those caves on schedule. On future builds, I will try to find a simple latching relay circuit to get back the capacity I’m losing with the Pololu […]

  17. george Says:

    Hey Alan

    Congrats for this great project. I tried to use it in my project but unfortunatelly, I use a gsm shield which requires a max current of 2A. Do you think i can use a different boost converter wich can support an output of 5V,2A?

    • Alan Says:

      Hi George. I took a look at this boost converter: Adafruit PowerBoost 1000 Basic, and it looks like it might work in your application. If you feed it enough battery voltage (more than 3.7 V), it claims to be able to supply 2A of current at the output. The converter has an Enable pin, which will shut it down and isolate the output, so you do *not* need to include the MOSFET in my circuit diagram. The current draw of the converter in shutdown mode claims to be 20 uA, which is pretty low and should allow for decent battery life. Hopefully it works for you.

  18. George Says:

    Hi Allan, thank you for your response. It seems a good solution for my project. Thank you

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: