Purpose of Deep Sleep

Power consumption is a critical issue for a device running continuously for a long time without being turned off. So to overcome this problem almost every controller comes with a sleep mode, which help developers to design electronic gadgets for optimal power consumption. Sleep mode puts the device in power saving mode by turning off the unused module. Today we will learn about Arduino Sleep Modes and demonstrate power consumption by using Ammeter. An Arduino Sleep mode is also referred as Arduino Power Save mode or Arduino Standby Mode

Arduino Sleep Modes

Sleep Modes allow the user to stop or turn off the unused modules in the Microcontroller which significantly reduce the power consumption. Arduino UNO, Arduino Nano and Pro-mini comes with ATmega328P and it has a Brown-out Detector (BOD) which monitors the supply voltage at the time of sleep mode.

There are six sleep modes in ATmega328P:

Table of Power Save modes of ATmega328P

Using the Sleep Mode in Arduino

For entering into any of the sleep mode we need to enable the sleep bit in the Sleep Mode Control Register (SMCR.SE). Then the sleep mode select bits select the sleep mode among Idle, ADC noise reduction, Power-Down, Power-Save, Standby and External Standby.

An external or internal hardware interrupt  or a Reset can wake up the Arduino from the sleep mode.

Library Installation

A library installation is mandatory for using the low power modes and sleep modes in Arduino. Click here to download the library.

Arduino Sleep Tutorial

Arduino Sleep Mode

The 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

Code

The list is arranged in the order of least power savings to most power savings. In SLEEP_MODE_PWR_DOWN, most processor functions are turned off.

#include <avr/sleep.h>// Header files

void setup ()

{

set_sleep_mode (SLEEP_MODE_PWR_DOWN);

sleep_enable();

sleep_cpu ();

}  // end of setup

void loop () { }

// Enter loop statements of required file here.

Impact of Power Saving

Lets consider the power consumption of three boards before and after sleep mode in enabled.

Before Sleep Mode

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

After Sleep Mode

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

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 or ,make use of other internal /external interrupts 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 paradigm.

author avatar
Amith G Nair
Experience as a product developer, innovation coach, and electronics lecturer,a seasoned professional driven by passion for designing projects.expertise extends to 3D modelling, hardware designing, and web development using HTML, WordPress, and Django.