Wi-Fi/Sleep and locks/A station that sleeps
Lesson 10 of 13 · in 3D and VR

A station that sleeps

A sleeping station wakes for some beacons while its access point holds its frames. The ESP32 wakes for every DTIM beacon by default, and sleeping longer saves power at the cost of delay and missed broadcasts.

Lonely BinaryUpdated 2026-10-094 min readNo board required

View it in VR

Lesson 10 of the Wi-Fi course opens in a VR headset, on a table in front of you, and a voice starts three seconds after you arrive. Type this short address into the browser on a headset such as Meta Quest or Apple Vision Pro, and press Enter VR. No headset? Press Start the lesson: the same lesson, full screen.

learn.lonelybinary.com/vr/wifi/10

Listening is not free

A classic ESP32 draws about 95 to 100 mA just receiving, against 240 mA transmitting at full power. A radio that listens all the time drains a battery all the time. So a station can tell its access point that it is going to sleep, switch its receiver off, and wake only for some of the beacons.

The access point holds the frames

While a station sleeps, the access point keeps the frames addressed to it in a buffer. Each beacon carries a TIM, a list with one bit per station; a set bit means a frame is waiting. A station that wakes, reads the beacon and finds its bit set asks for the frame. Frames for everyone, broadcast and multicast, cannot wait for each sleeper in turn, so they are sent right after a DTIM beacon: every second, third or Nth beacon, as the access point's DTIM period says.

Minimum and maximum modem sleep

ESP-IDF has three settings. WIFI_PS_NONE never sleeps. WIFI_PS_MIN_MODEM, the default, wakes for every DTIM beacon, so it does not lose broadcasts. WIFI_PS_MAX_MODEM wakes once every listen interval, a number of beacons in the station's configuration (ESP-IDF uses 3 if it is left at 0), and may sleep through a DTIM beacon and the broadcasts sent after it.

The cost is delay. A frame for a sleeping board waits up to one DTIM period in minimum sleep, or one listen interval in maximum. With beacons every 102.4 ms and a DTIM period of 3, that is up to about 307 ms before the board even sees the frame.

Modem sleep works only in station-only mode, after the board has connected. In Arduino, WiFi.setSleep(true) selects minimum modem sleep and WiFi.setSleep(false) turns sleep off. Arduino-ESP32 3.x starts with minimum modem sleep on every chip except the ESP32-S2, which starts with it off.

Target wake time

Wi-Fi 6 adds target wake time: the station and the access point agree a schedule of wake-ups. The ESP32-C6 can ask for one, and it works only with a Wi-Fi 6 access point that accepts. It is not automatic. The ESP32 book covers it under Wi-Fi 6 features; the station itself is in station mode.

Common mistakes

  • Choosing maximum modem sleep for a board that listens for broadcasts. It may sleep through the DTIM beacon, and the frame for everyone after it is gone.
  • Blaming the network for a slow first reply. A sleeping board picks its frame up late by up to a DTIM period. WiFi.setSleep(false) removes the wait and costs the listening current all the time.
  • Expecting a board that runs an access point to modem-sleep. Modem sleep needs station-only mode, connected; an access point, alone or beside a station, stays awake.

Edit this page — content/fundamentals/wifi/a-station-that-sleeps.mdx

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Fundamentals on the forum →