Arduino Sleep Mode for Power Savings

发布人是

Arduino boards are excellent tools for experimentation and prototyping, especially when power is abundant. But what if power is an issue? Whether you're running on limited battery or working in a remote monitoring scenario using solar power, sometimes every milliamp counts. Your device's power draw―when in use and at rest―can make a huge difference in your application.

Power Draw

Let's look at a few popular options in the world of microcontroller boardsWhen running normally with a blank program (as in, what you get when you open a new blank file on the Arduino IDE), we observed the following power consumption values.

  • Arduino Uno (ATmega328P):47mA
  • Sparkfun Pro Micro 5V (ATmega32U4): 36mA
  • Arduino Pro Mini 5V (ATmega328P): 16mA

These values don't sound like much power, but consider that an Arduino Uno would theoretically suck the power out of a 750mAh 3.7V LiPo in under 12 hours, neglecting conversion losses and other inefficiencies. Even the comparatively efficient Pro Mini only lasts about 35 hours in perfect conditions. In a real application, both times would be significantly shorter. There must be a better solution.

Arduino Sleep Mode

As it just so happens, there is something called sleep mode. In fact, several types of low power sleep modes are available via the Arduino IDE:

  • SLEEP_MODE_IDLE
  • SLEEP_MODE_ADC
  • SLEEP_MODE_PWR_SAVE
  • SLEEP_MODE_STANDBY
  • SLEEP_MODE_PWR_DOWN

We arranged this list beginning with the least power savings and most active functionality and ending with most power savings. In SLEEP_MODE_PWR_DOWN, most processor functions are turned off. For a quick test of the SLEEP_MODE_PWR_DOWN, I used code found here, listed below:

#include <avr/sleep.h>

void setup ()

{

set_sleep_mode (SLEEP_MODE_PWR_DOWN);

sleep_enable();

sleep_cpu ();

}  // end of setup

void loop () { }

With that code loaded into our respective boards, we see the following:

  • Arduino Uno: 24mA
  • Sparkfun Pro Micro 5V: 5mA
  • Arduino Pro Mini 5V: .63mA

Putting the Uno to sleep saves about half its power consumption. That's better, but not great, since the Uno still has to power a USB interface chip, voltage regulators, and a power LED. The Pro micro sees its power consumption cut by around a factor of 7 to 5mA, likely owing much of its sleep efficiency to the fact that the chip entering sleep mode also handles USB interface.

The Pro Mini, however, is exceptionally efficient in sleep mode. At just .63mA, the Pro Mini has just 2.6 percent of the power usage of sleeping Uno. You'll need to supply your own FTDI device, which makes this board a bit harder to program. But for projects that need to sip power, the Pro Mini is the clear winner.

On the other hand, if you need extremely low power, the ATTiny85 in its V variation, running at 1.8V and 1 MHz, only draws:

  • Active: 300μA, or .3mA
  • Power-down mode: in.001μA. or .003mA

The ATTiny85 uses half the current consumption of the sleeping 5V Pro Mini when active and fully functional. If you're interested, I outlined how to get started with this fantastic chip.

Arduino Wake Up

Sleep modes can be beneficial for applications with intermittent tasks. For instance, a sensor or real-time clock (RTC) module could ping an interrupt to wake up when it needs to perform a task. It can also use the reset pin to restart the system, allowing it to do its duty, then go back to sleep. While you won't need it for every project, being able to put your microcontroller to sleep is an excellent skill to have in your microcontroller programming toolbox.

最新消息

Sorry, your filter selection returned no results.

请仔细阅读我们近期更改的隐私政策。当按下确认键时,您已了解并同意艾睿电子的隐私政策和用户协议。

本网站需使用cookies以改善用户您的体验并进一步改进我们的网站。此处阅读了解关于网站cookies的使用以及如何禁用cookies。网页cookies和追踪功能或許用于市场分析。当您按下同意按钮,您已经了解并同意在您的设备上接受cookies,并给予网站追踪权限。更多关于如何取消网站cookies及追踪的信息,请点击下方“阅读更多”。尽管同意启用cookies追踪与否取决用户意愿,取消网页cookies及追踪可能导致网站运作或显示异常,亦或导致相关推荐广告减少。

我们尊重您的隐私。请在此阅读我们的隐私政策。