74. Sleep Mode with Periodic Wake-Up

The task is to create a low-power system that wakes every 1 minute to read ADC, print the value, and return to sleep using an accurate, power-efficient wake-up method.

Functional Requirements

1. Accurate 1-Minute Wake-Up

The system must wake up every 60 seconds with minimal time error.
 Possible wake-up sources:

  • RTC (Real-Time Clock):
     Highest accuracy, good for long-term timing, slightly higher power use.
  • Low-Power Timer:
     Internal to MCU, good balance between accuracy and power.
  • Watchdog Timer (Periodic Mode):
     Lowest cost, moderate accuracy, may drift over time.
  • External Timer/Clock Chip:
     Very accurate, but adds extra cost and power consumption.

2. Low-Power Operation

During idle time, the MCU must enter the lowest supported power mode, such as:
 STOP / STANDBY / DEEP-SLEEP / POWER-DOWN (based on MCU family).

3. Stable ADC and UART Operation

After waking up

  • Restore system clocks
  • Enable ADC and UART
  • Wait briefly for stabilisation
  • Then read the ADC value and send it to the serial terminal

4. Fixed Task Sequence

The system must always follow the same operation order:

Wake → Measure (ADC) → Transmit → Sleep

No steps should be skipped or executed out of order.

5. Reliable Recovery

If the system resets or faces power glitches:

  • It must restart cleanly
  • It must continue the same 1-minute cycle without errors

Key Implementation Notes (Best Practices)

  • Wake-Up Source Selection

    • RTC
      • Very accurate
      • Good for long-term timing
      • Slightly higher power
    • Low-Power Timer
      • Internal
      • Easy to configure
      • Balanced power + accuracy
    • Watchdog Timer
      • Lowest cost
      • Moderate accuracy
      • Time drift increases over long periods
    • External Clock / Timer
      • Highest accuracy
      • Increases hardware cost and power usage
  • Peripheral & Power Handling

    • Enable ADC and UART only when needed
    • Disable UART after transmission
    • Configure unused GPIOs with pull-up/down to avoid leakage
    • Turn off unused clocks and peripherals
    • Enable Brown-Out Detection (BOD) for safe low-voltage operation

So, by considering the above points, we can implement the task.

Below are the solutions to the given task using different microcontrollers

  1. ESP32
  2. Arduino UNO