FAQ
TL;DR: ESP8266 NodeMCU sleep currents: 70 mA (NONE), ~20 mA (MODEM), ~15 mA (LIGHT). "NodeMCU firmware provides 4 power saving modes." If Wi‑Fi won’t reconnect and current spikes, compare files and reflash firmware+init.lua. [Elektroda, MichałS, #18572884]
Why it matters: This FAQ helps ESP8266/ESP‑12 NodeMCU/Lua users fix router reconnect issues and cut battery drain.
Quick Facts
- Observed NodeMCU sleep currents: NONE_SLEEP ≈70 mA, MODEM_SLEEP ≈20 mA, LIGHT_SLEEP ≈15 mA; DEEP_SLEEP not usable when counting pulses. [Elektroda, MichałS, #18572884]
- In Light‑sleep the CPU is suspended and ignores peripheral interrupts; only the RTC can run. [Elektroda, khoam, post #18572926]
- NodeMCU/Wemos boards draw more in sleep due to onboard parts; they’re poor battery choices unless reworked. [Elektroda, khoam, post #18575192]
- Reflashing NodeMCU firmware plus a fresh init.lua restored Wi‑Fi on a stuck ESP‑12. [Elektroda, MichałS, #18005745]
- Lua file writes can corrupt during saves; load and compare with the original when issues appear. [Elektroda, TvWidget, post #18004926]
Why won’t my ESP8266 ESP‑12 reconnect to the router after a hang?
A Wi‑Fi subsystem fault or corrupt file state can block association. The MCU may keep running and displaying data while Wi‑Fi fails. Power cycling can leave the fault unchanged. Reflashing NodeMCU firmware and re‑uploading init.lua restored connectivity in practice. That behavior suggests a stuck radio path or damaged Lua file. [Elektroda, MichałS, #18005745]
How do I recover an ESP8266 that’s stuck with high current and no Wi‑Fi?
Follow this quick reset path:
- Power off, wait a few seconds, then power on and confirm the fault persists.
- Reflash a stable NodeMCU firmware build to the ESP‑12.
- Upload a fresh init.lua, reboot, and verify the station joins your router.
This sequence revived a jammed unit. [Elektroda, MichałS, #18005745]
Can logging to SPIFFS in Lua corrupt files and break networking?
Yes. File writes can corrupt during saves and leave scripts inconsistent. If symptoms reappear, load the stored Lua file and diff it against your original. Some operations block safe writes, so avoid writing during critical tasks. “During certain operations, data cannot be written to the file.” [Elektroda, TvWidget, post #18004926]
My current draw matches the “connecting” phase but it never associates—what does that indicate?
It signals the radio is stuck trying to connect. Users observed current identical to the router‑association phase while Wi‑Fi never completed. OLED and measurements continued, pointing at the Wi‑Fi stack, not the application loop. Reflashing firmware and init.lua resolved it. [Elektroda, MichałS, #18004814]
What currents should I expect for NodeMCU sleep types on ESP8266?
Typical observed currents: NONE_SLEEP about 70 mA, MODEM_SLEEP about 20 mA, and LIGHT_SLEEP about 15 mA. DEEP_SLEEP gives lowest draw but disables continuous pulse counting. Use these figures as practical targets when budgeting battery life. [Elektroda, MichałS, #18572884]
Can ESP8266 count pulses while in Light‑sleep?
No. “During Light‑sleep, the CPU is suspended and does not respond to signals and interrupts from peripherals.” Only the RTC keeps running. Continuous pulse counting requires the CPU awake or periodic wake‑ups that service counts. [Elektroda, khoam, post #18572926]
Why is Light‑sleep still drawing tens of milliamps on my NodeMCU board?
Dev boards include regulators, USB‑UART, and LEDs that add quiescent draw. “NodeMCU or Wemos modules are poorly suited to solutions where minimising current consumption matters.” You may need hardware rework or a bare ESP‑12 design for ultra‑low power. [Elektroda, khoam, post #18575192]
Do multiple Lua timers keep ESP8266 awake in Light‑sleep?
Only the RTC timer runs in Light‑sleep. Firmware timers do not execute while the CPU is suspended. If timers continue firing, the device is not actually in Light‑sleep. Audit your sleep configuration and ensure Wi‑Fi sleep type is set correctly. [Elektroda, khoam, post #18575822]
How do I set Wi‑Fi sleep type in NodeMCU Lua?
In your script, set the station sleep type with the Wi‑Fi API. Use wifi.sta.sleeptype with MODEM_SLEEP or LIGHT_SLEEP as needed, then reboot to test current. Apply changes in init.lua to persist them across resets. See the API reference. “wifi.sta.sleepType”
Can I save power and still count pulses without using Deep‑sleep?
Yes, but not with Light‑sleep running continuously. Light‑sleep halts the CPU, so peripheral interrupts for pulse counting do not fire. Use MODEM_SLEEP and optimize code, or add external counting hardware and wake periodically to read it. [Elektroda, khoam, post #18572926]
Are NodeMCU sleep modes equivalent to Espressif’s chip modes?
They map conceptually, but board‑level current differs. Espressif figures apply to the ESP8266 chip only. NodeMCU/Wemos boards consume more in each mode due to onboard components. Budget power using measurements on your exact hardware. [Elektroda, khoam, post #18575192]
How can I baseline current with a minimal Lua test?
Create a simple script that only sets the sleep type and initializes Wi‑Fi. Measure current for each mode to establish expectations on your hardware. This isolates app effects like timers from sleep behavior and clarifies achievable draw. [Elektroda, MichałS, #18578096]
Do power cycles always clear Wi‑Fi faults on ESP‑12?
No. Users reported that turning power off and on did not restore Wi‑Fi. The application kept running, but the radio remained stuck. A firmware reflash and clean init.lua upload fixed it, confirming a persistent software‑state issue. [Elektroda, MichałS, #18004814]
What’s a safe way to check for Lua file corruption on ESP8266?
Read the stored Lua file back from flash and compare it byte‑for‑byte with your source. If corruption appears, avoid file writes during operations known to disrupt saving. Re‑upload the corrected file and retest Wi‑Fi. [Elektroda, TvWidget, post #18004926]