This blog describes common low-power configuration options for ESPs.
The higher the CPU frequency, the greater the power consumption. Through DFS (dynamic frequency scaling, dynamic frequency modulation), the system can automatically switch the operating frequency to achieve a balance between power consumption and performance. To enable this function, you need to enable these two items in Figure 1-1, so that the system will switch to the maximum frequency when it is working, and switch to the lowest frequency when the system is idle. The maximum frequency defaults to the main frequency, such as ESP32-C3 is 160 MHz, the lowest frequency is the frequency of the external main crystal oscillator, generally 40 MHz. The maximum and minimum frequencies can be set by calling esp_pm_configure.
|Configuration item name||PM_ENABLE|
|Configuration item path||(Top) -> Component config -> Power Management -> Support for power management|
|Configuration item name||PM_DFS_INIT_AUTO|
|Configuration item path|| |
(Top) -> Component config -> Power Management -> Support for power management
-> Enable dynamic frequency scaling (DFS) at startup
Note: If it is auto-tuning with Wi-Fi application, the minimum frequency cannot be less than 40 MHz.
If you need to further reduce power consumption after dynamic frequency modulation is enabled, as shown in Figure 1-2, you need to enable automatic light sleep. Modem sleep mode plus automatic light sleep is what we often call power save mode .
|Configuration item name||FREERTOS_HZ|
|Configuration item path||(Top) -> Component config -> FreeRTOS -> Tick rate (Hz)|
|Configuration item name||FREERTOS_USE_TICKLESS_IDLE|
|Configuration item path||(Top) -> Component config -> FreeRTOS -> Tickless idle support|
There are two configuration items involved here, item A is the Tick frequency of FreeRTOS, the default is 100, that is, each Tick needs 1000 / 100 = 10 ms. Item B is the minimum number of idle Ticks required to automatically enter the light sleep state, and the default is 3, that is
When the system detects that the idle time is greater than 3 Ticks, it will automatically enter light sleep. As shown in the figure above, when the idle time is greater than 3 * 10 = 30 ms, the system will automatically enter light sleep. By increasing the A term, the system can detect idle time more sensitively and go to sleep. For example, if the tick rate is configured as 1000, it will go to sleep when there is no task within 3 ms, so as to achieve lower power consumption.
1. Automatically entering light sleep can only be configured after enabling the configuration item in 2.1.
2. After turning on the automatic frequency adjustment and automatic sleep, the communication of some peripheral devices will be affected. For details, please refer to the programming guide .
GPIO leakage during system sleep will cause current consumption and increase system power consumption. When the light sleep in esp-idf sleeps, the GPIO pin is suspended (prohibiting the internal pull-down resistor of the pin) and isolated (disconnecting the input and output of the pin) to eliminate the GPIO leakage current. The corresponding menuconfig configuration items of this function are as follows.
Note: This configuration item must be enabled after the automatic sleep of 2.2 is enabled.
|Configuration item name||PM_SLP_DISABLE_GPIO|
|Configuration item path||(Top) -> Component config -> Power Management -> Disable all GPIO when chip at sleep|
|When this option is turned on, all GPIO pins will be disabled during system sleep, which eliminates the impact of GPIO leakage on sleep power consumption, but also causes GPIO to be unable to perform signal input and output during sleep. However, in some applications, the application layer It is hoped that the GPIO function (input/output/internal pull-down) can be used normally during the system hibernation process, so a set of APIs are provided in IDF to manage the GPIO state during the hibernation process. The relevant API references are as follows:|
Sleep process GPIO management API:
Set the GPIO input and output state in sleep state
Set the GPIO pull-up and pull-down state in sleep state
Enable automatic GPIO state switching
Disable automatic GPIO state switching
If you want to keep the state of the GPIO pins during sleep, such as controlling the light output and closing the switch, you can use
gpio_hold_distwo APIs to hold the GPIO that needs to maintain the level before going to sleep, and do it after waking up
ESP32 increases system memory resources by connecting flash and PSRAM. The flash has the characteristic that the data will not be lost after power failure, and the PSRAM data cannot be retained after power failure. When the PSRAM is not used in the system , the flash power-off function can be enabled to reduce the chip sleep current. The relevant menuconfig options are as follows:
|Configuration item name|| |
ESP_SLEEP_POWER_DOWN_FLASH (after 4.4)
|Configuration item path||(Top) -> Component config -> ESP System Settings -> PD flash at light sleep when there is no SPIRAM (release/v4.3) |
(Top) -> Component config -> Hardware Settings -> Sleep Config -> Power down flash in light sleep when there is no SPIRAM (4.4以后)
Note: In reality, it is difficult to predict the time required for flash power-off. Even if the time required for flash complete power-off can be predicted, sometimes it is impossible to ensure the safety of flash power-off by setting a long enough sleep time (for example, sudden The asynchronous wake-up source will make the actual sleep time uncontrollable), so the configuration items can be adjusted as follows:
This method is better than power-off flash, in contrast, it increases the bottom current consumption of more than ten μA, but at the same time, safety and power consumption are taken into account.
The Espressif chip is a wireless MCU, so most of the low power consumption functions need to be used together with the Wi-Fi/Bluetooth function. Some low-power configurations and parameters related to Wi-Fi / Bluetooth are explained here.
At present, there are relatively few optimized configurations on the Bluetooth side, and BLE modem sleep can be enabled
|Configuration item name||BT_CTRL_MODEM_SLEEP|
|Configuration item path||(Top) -> Component config -> Bluetooth -> Bluetooth -> Bluetooth controller -> MODEM SLEEP Options|
If you want to enter light sleep instead of modem sleep when keeping alive, just refer to 2.2 .
Bluetooth requires a 32K external crystal oscillator.
There are many configuration items involved in Wi-Fi optimization, the more common ones are as follows:
After enabling automatic light sleep, you can turn on this option, so that the wireless digital circuit module will also be powered off correspondingly when the physical layer is turned off.
|Configuration item name||ESP_PHY_MAC_BB_PD|
|Configuration item path||(Top) -> Component config -> PHY -> Power down MAC and baseband of Wi-Fi and Bluetooth when PHY is disabled|
When the ESP32 communicates with the AP as a STA, it needs to wait for a period of time after receiving a data before turning off the RF. This time is called the Minimum active time, and the default value is 50 ms . On the basis of ensuring each data throughput, it can be appropriately Reducing this wait time reduces power consumption.
When ESP32 is in power save mode, it needs to periodically send a keep alive packet to AP to tell AP that it is still connected. The Maximum keep alive time is the time period for sending the keep alive packet. The default is 10 s . You can increase this parameter to reduce sending packets and reduce power consumption.
|Configuration item name||ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME|
|Configuration item path||(Top) -> Component config -> Wi-Fi -> WiFi SLP IRAM speed optimization -> Minimum active time|
|Configuration item name||ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME|
|Configuration item path||(Top) -> Component config -> Wi-Fi -> WiFi SLP IRAM speed optimization -> Maximum keep alive time|
Recommended configuration: Minimum active time = 15~20, Maximum keep alive time = 60.
After enabling this configuration item, the Modem sleep state can still be maintained when disconnection occurs.
|Configuration item name||ESP_WIFI_STA_DISCONNECTED_PM_ENABLE|
|Configuration item path||(Top) -> Component config -> Wi-Fi -> Power Management for station at disconnected|
|Configuration item name||ESP_WIFI_SLP_BEACON_LOST_OPT|
|Configuration item path||(Top) -> Component config -> Wi-Fi -> Wifi sleep optimize when beacon lost|
When the chip acts as an STA to establish a connection with the router, it will be informed of the DTIM of the router, that is, how often the router will send a beacon, and the STA needs to get up to receive the beacon at this time to check whether there is any information that needs to be processed by itself. The listen interval is the STA telling the router how long I need to get up to accept the beacon, that is, the former is determined according to the router, and the latter can be configured into the chip by itself. The time interval is the number of DTIM or listen interval * 100 ms, if DTIM = 10, that is, the time interval of each wake-up is 10 * 100 ms = 1 s.
Lower power consumption can be obtained by using an external 32 KHz crystal oscillator. There are mainly the following reasons:
The internal crystal oscillator is susceptible to interference. In contrast, the external crystal oscillator has higher precision and can be used in various sleep situations.
For applications that require high time accuracy, such as Bluetooth and Wi-Fi keep-alive, it is necessary to receive beacons at regular intervals. Once the clock drifts too much and the receiving point is missed, the waiting window for turning on RF will become longer, which greatly increase power consumption.
Enabling an external clock source requires the following configuration:
|Configuration item name||ESP32C3_RTC_CLK_SRC_EXT_CRYS|
|Configuration item path||(Top) -> Component config -> ESP32XX-Specific -> RTC clock source|
There are two types of external crystal oscillators. External 32 kHz crystal is an external passive crystal oscillator, which is also recommended most of the time. External 32 kHz oscillator at 32K_XP pin is an external active crystal oscillator, which is more expensive and will cause the bottom current to rise. The layout of the crystal oscillator You can refer to the hardware design guide corresponding to each chip.
The ESP32 has five low power modes: ESP32 modem-sleep, light-sleep, deep-sleep, hibernation, and power off.What devices are compatible with ESP now? ›
ESP-NOW is a wireless communication protocol defined by Espressif, which enables the direct, quick and low-power control of smart devices, without the need of a router. ESP-NOW can work with Wi-Fi and Bluetooth LE, and supports the ESP8266, ESP32, ESP32-S and ESP32-C series of SoCs.What is the power requirement of ESP8266? ›
Minimum voltage for stable operation is 2.5V and the maximum allowable limit is 3.6V. So for safely running an ESP8266 device, the battery voltage should be within 2.5 to 3.6V. An esp8266 chip can draw maximum 170mA current.How can I reduce the power consumption of ESP8266? ›
Deep-sleep. f you want to use an external power supply and save the most energy possible, go with the deep-sleep mode! The ESP8266 power consumption reduces in theory to 20µA * 3.3V = 66µW. Your external battery with 1000mAh will last a lot longer.What is the most efficient way to power ESP32? ›
The easiest way to power your ESP32 dev kit is via the USB port. Just plug one end of the cable into your computer's USB port or to a USB compatible power, the other end to the USB port of the ESP32 dev kit, and you're good to go.What is the best power for ESP32? ›
But first of all: what voltage do we actually need? A quick look at the data sheet of ESP8266 and ESP32 clarifies – the ESP32 needs a voltage of at least 2.3 to a maximum of 3.6 volts. The ESP8266 needs a minimum of 2.5 and a maximum of 3.6 volts. Recommended voltage: 3.3 volts.What is an ESP wireless device? ›
The ESP8266 is a low-cost Wi-Fi microchip, with built-in TCP/IP networking software, and microcontroller capability, produced by Espressif Systems in Shanghai, China.How do I connect my ESP to my computer? ›
Connect the ESP32 board to the PC using the USB cable. If device driver does not install automatically, identify USB-to-UART bridge on your ESP32 board (or external converter dongle), search for drivers in internet and install them.Can ESP32 run BLE and Wi-Fi at the same time? ›
Overview. ESP32 has only one 2.4 GHz ISM band RF module, which is shared by Bluetooth (BT & BLE) and Wi-Fi, so Bluetooth can't receive or transmit data while Wi-Fi is receiving or transmitting data and vice versa. Under such circumstances, ESP32 uses the time-division multiplexing method to receive and transmit packets ...How much voltage can ESP8266 handle? ›
The ESP8266's maximum voltage is 3.6V, so the Thing has an onboard 3.3V regulator to deliver a safe, consistent voltage to the IC. That means the ESP8266's I/O pins also run at 3.3V, you'll need to level shift any 5V signals running into the IC.
Some people state that ESP8266 is tolerant of 5 V logic levels on its GPIOs, while others vehemently disagree, pointing at the datasheet-stated 3.6 V maximum.What are disadvantages of ESP8266? ›
Memory limitations. Less powerful. Processing power is weaker than the microcontroller.How much power does ESP8266 use battery? ›
An ESP8266 on draws about 80mA while an ESP8266 "asleep" (waiting to wake up and "Do something useful") consumes only between 8 and 20µA (4000 times less).How do I control ESP8266 from anywhere? ›
The ESP8266 can be controlled from your local Wi-Fi network or from the internet (after port forwarding). The ESP-01 module has GPIO pins that can be programmed to turn an LED or a relay ON/OFF through the internet. The module can be programmed using an Arduino/USB-to-TTL converter through the serial pins (RX,TX).How do I reduce ESP32 power consumption? ›
The ESP32 sleep mode is a power-saving mode. When not in use, the ESP32 can enter this mode, storing all data in RAM. At this point, all unnecessary peripherals are disabled while the RAM receives enough power to retain its data.How much voltage can ESP32 handle? ›
The ESP32 does not tolerate voltages much greater than 3.3 V, and none of the pins from either device tolerate significant negative voltages.What is the lowest voltage for ESP32? ›
The ESP32's operating voltage range is 2.2 to 3.6V.How can I speed up my ESP32? ›
To increase speed of buffered reading functions like fread and fgets , you can increase a size of the file buffer (Newlib's default is 128 bytes) to a higher number like 4096, 8192 or 16384.How long can ESP32 run on battery? ›
The power consumption of the Firebeetle ESP32 board in Deep-Sleep mode is extremely low. It needs around 1.44 mΑhs per day if powered by 4 AA rechargeable batteries. So, in theory, this power bank which has a capacity of 2.500mAhs can power the board for almost 5 years if we put it in Deep Sleep mode!How much power does ESP32 ESPHome use? ›
In the context of smart home projects powered by ESPHome, for example, choosing an ESP8266 over an ESP32 could drastically reduce power usage when both devices are often in their full operating mode, as the ESP8266 draws around 120mA. In contrast, the ESP32 requires around 180mA when transmitting data over WiFi.
The ESP32 is better than ESP8266. It provides you with a faster processor and good memory size, which allow considerable larger projects to be designed on only one SOC. ESP32 provides you with reliable and hi-tech security.Is an ESP a Wi-Fi? ›
ESP-WIFI-MESH is a wireless communication network with nodes organized in a mesh topology using the simultaneous AP-STA feature on Espressif SoCs. It provides a self-forming and self-healing network, with ease of deployment.What is the range of ESP32? ›
The 802.11 LR mode is a patented custom mode that can achieve a 1 km line of sight range so long as both the station and the soft-AP are connected to an ESP32 device.What is the default IP address of ESP? ›
Access Point mode. To see if it works, open the Wi-Fi settings on your computer, look for a network called "ESP8266 Access Point", enter the password "thereisnospoon", and connect to it. Then open a terminal, and ping to 192.168. 4.1 (this is the default IP address of our ESP AP).How do I connect my ESP Wi-Fi module? ›
- Connect TX on the ESP8266 to TX on the Arduino Uno.
- Connect RX on the ESP8266 to RX on the Arduino Uno.
- Connect EN on the ESP8266 to 3.3V on the Arduino Uno.
- Connect 3v3 (or VCC) on the ESP8266 to 3.3V on the Arduino Uno.
- Connect GND on the ESP8266 to GND on the Arduino Uno.
- Step 1: Setting Up the Arduino IDE. Step 1 – The first thing we will need to do is add the ESP32 board to the Arduino IDE. ...
- Step 2: Arduino Webserver Code. ...
- Step 3: Find the ESP32 IP Address. ...
- Step 4: The DroidScript App. ...
- Step 5: Connect the Relay Module. ...
- Step 6: Test!
ESP32 supports a data rate of up to 150 Mbps, and 20.5 dBm output power at the antenna to ensure the widest physical range.How many Bluetooth devices can connect to ESP32? ›
When using ESP32 device as the server of Bluetooth® LE, how many client devices can be connected? ¶ The ESP32 Bluetooth LE supports up to nine client devices for connection. It is recommended to hold this number within three.Can ESP32 act as router? ›
The ESP32 can act as a Wi-Fi station, as an access point, or both. In this tutorial we'll show you how to set the ESP32 as an access point using Arduino IDE. In most projects with the ESP32, we connect the ESP32 to a wireless router (see our ESP32 web server tutorial).What is the voltage input of ESP? ›
The ESP recommended operating voltage is 3.3V, but it can operate with voltages between 3V and 3.6V.
An ESP8266-12E module, for example, consumes an average of 70.5 mA when it is fully on (that is, when its WiFi modem and microcontroller are both on) even when the transceiver is inactive (neither receiving nor transmitting).How many amps does ESP8266 draw? ›
The ESP8266 usually draws a peak current of about 250mA after it wakes up and then more or less constantly draws around 70mA before it goes back to sleep.How to increase ESP8266 Wi-Fi range? ›
ESP8266 WiFi extender arduino
It is a device based on the esp8266 that helps increase the range of your wifi network. Just connect it to your router via the web UI and connect your phone, PC or anything that uses internet and has WiFi to it and viola you have your WiFi extender working fine.
The ESP8266 is a 3.3V microcontroller, so its I/O operates at 3.3V as well. The pins are not 5V tolerant, applying more than 3.6V on any pin will kill the chip.How to power ESP8266 externally? ›
Power Required By NodeMCU
NodeMCU ESP8266 operates at 5V & 3.3V. It has an onboard LDO voltage regulator to keep the voltage steady at 3.3V. We can power NodeMCU using a Micro USB jack as well as a VIN pin (External Power Supply Pin).
It can be controlled with low voltages, like the 3.3V provided by the ESP8266 GPIOs and allows us to control high voltages like 12V, 24V or mains voltage (230V in Europe and 120V in the US).How to power ESP8266 without USB? ›
You can apply 5v directly to the VIN pin on your NodeMCU. Just don't plug the USB in when you're supplying power to VIN. Always do one or the other.What is the maximum Wi-Fi range of ESP8266? ›
The module has a wireless WiFi transceiver operating in an unlicensed frequency range of 2400-2484 MHz in the IEEE 802.11 b/g/n standard, with support for TCP/IP communication protocol stack and WiFi security including WAP3.How many clients can ESP8266 handle? ›
ESP8266 webserver allows only 5 clients .What is the benefit of ESP8266? ›
ESP32 and ESP8266 are very cost-effective Wi-Fi modules ideal for DIY projects in the Internet of Things (IoT) field. Both chips are 32-bit processors. The ESP32 is a dual-core 160MHz to 240MHz CPU, while the ESP8266 is a single-core processor that runs at 80MHz.
An ESP8266 in deep sleep mode (asleep, and waiting for something happen, to wake up and do it) can consume as little as 8 to 20µA (1 mA = 1000 µA) while a NodeMCU board with its ESP8266 in deep sleep mode consumes around 8-20mA.What is the sleep current of ESP8266? ›
Under normal operating mode, the ESP8266 NodeMCU draws about 80 mA of current. Here, you can also see the LED is ON. Once it enters Deep Sleep Mode after a delay of 5 seconds, the current draw drops down to approximately 10 mA. It stays in deep sleep mode for 5 seconds after which the ESP8266 is woken up by GPIO16 pin.How long can ESP8266 run on 18650? ›
The maximum you can make it run for is 2 years and nine months, providing you have high powered 18650 batteries, an the ESP is in deep sleep.How can I use ESP8266 without Internet? ›
- Step 1: Make a Esp Breakout Board of Your Own.
- Step 2: Connect the Relay Module to A0, A1, A2, A3 of the Arduino Board.
- Step 3: Download the Code Which I Given in the Attachment.
- Step 4: Open Your Playstore and Download the Socket Control Widget and Install It.
OTA programming lets you update/upload a new program to the ESP8266 over Wi-Fi without having to connect the ESP8266 to the computer via USB. The OTA functionality comes in handy when there is no physical access to the ESP module.Does ESP8266 have GPS? ›
After uploading the code, open Serial Monitor. The ESP8266 will try connecting to the WiFi Network. Once it connect to the WiFi Network, the GPS Module will start scanning the nearest Satellite.How do you power an ESP32 with a battery? ›
The lithium battery outputs 4.2V when fully charged. You need to use a low dropout voltage regulator circuit (MCP1700-3302E) to get 3.3V from the battery output. The output from the voltage regulator will power the ESP32 through the 3.3V pin.What power frequency for ESP32? ›
For ESP32, this value can be set to 80 MHz, 160 MHz, or 240 MHz. Requests the APB frequency to be at the maximum supported value. For ESP32, this is 80 MHz. Disables automatic switching to light sleep.What is the power input for the ESP32 cam? ›
The ESP32-CAM comes with three GND pins (colored in black color) and two power pins (colored with red color): 3.3V and 5V. You can power the ESP32-CAM through the 3.3V or 5V pins. However, many people reported errors when powering the ESP32-CAM with 3.3V, so we always advise to power the ESP32-CAM through the 5V pin.What are ways to reduce power consumption in an embedded system? ›
One major technique for reducing microcontroller power consumption is to reduce the voltage it operates at. As power consumption is directly proportional to voltage, reducing the voltage reduces the current in that circuit, and thus reduces the overall power consumed.
The ESP32 is in deep sleep mode now. You can wake it up by pressing the pushbuttons. Open the Serial Monitor at a baud rate of 115200. Press the pushbuttons to wake up the ESP32.How do you power ESP with a battery? ›
Power ESP32 Using a 6V/9V Battery
Any voltage connected across the Vin pin goes to the regulator first which reduces it down to 3.3V and after that fed to the ESP32 board peripherals. Using an external battery of 6V or 9V we can power ESP32 through the Vin pin by connecting the GND of ESP32 with the GND of the battery.
ESP32 supports a data rate of up to 150 Mbps, and 20.5 dBm output power at the antenna to ensure the widest physical range.Can ESP32 measure voltage? ›
Reading an analog value with the ESP32 means you can measure varying voltage levels between 0 V and 3.3 V. The voltage measured is then assigned to a value between 0 and 4095, in which 0 V corresponds to 0, and 3.3 V corresponds to 4095.How much power does ESP32 use without WiFi and Bluetooth? ›
ESP32 in Deep Sleep Mode
Also, WiFi and Bluetooth are completely disabled. Power consumption goes from 0.15mA to 10μA. Once this mode is active the CPU is shutdown, but the ULP coprocessor can read data coming from GPIO pins like sensor readings.
While the base clock APB_CLK used by Expressif's IDF uses a theoretical frequency of 80 MHz, the maximum PWM frequency set for ESP32 is 40 MHz with a duty cycle resolution of 1 bit.What voltage is ESP32 relay? ›
There are relay modules whose electromagnet can be powered by 5V and with 3.3V. Both can be used with the ESP32 – you can either use the VIN pin (that provides 5V) or the 3.3V pin.Is ESP32 input or output? ›
ESP32 Read Digital Inputs
digitalRead(GPIO); All ESP32 GPIOs can be used as inputs, except GPIOs 6 to 11 (connected to the integrated SPI flash).
The ESP32-CAM can be powered via the 3.3V or 5V pins. Since many users have reported problems when powering the device with 3.3V, it is advised that the ESP32-CAM always be powered via the 5V pin. The VCC pin normally outputs 3.3V from the on-board voltage regulator.