0
0
Arduinoprogramming~3 mins

Why Wake-up from sleep with interrupt in Arduino? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

What if your device could sleep forever and wake up only when it really matters?

The Scenario

Imagine you have a battery-powered sensor that needs to save energy by sleeping most of the time. You want it to wake up only when something important happens, like a button press or a signal from another device.

The Problem

If you try to keep checking the sensor all the time without sleep, the battery drains quickly. If you use a simple delay or loop, the device wastes power and misses events that happen between checks.

The Solution

Using interrupts to wake up from sleep lets the device rest quietly and instantly respond to important events. This saves battery and makes your device smart and efficient.

Before vs After
Before
while(true) {
  if (digitalRead(buttonPin) == HIGH) {
    // do something
  }
  delay(100);
}
After
attachInterrupt(digitalPinToInterrupt(buttonPin), wakeUp, RISING);
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_mode();
// Device sleeps here and wakes on interrupt
void wakeUp() {
  sleep_disable();
  // interrupt code
}
What It Enables

This lets your device sleep deeply and wake up immediately only when needed, maximizing battery life and responsiveness.

Real Life Example

A wildlife tracker that sleeps most of the day but wakes instantly when an animal passes by a sensor, saving battery for months.

Key Takeaways

Manual checking wastes power and can miss events.

Interrupts wake the device instantly from sleep.

This approach saves battery and improves responsiveness.