In Deep-sleep and Light-sleep modes, the wireless peripherals are powered down. This will allow the system to wake up from sleep automatically when required by the Wi-Fi driver, thereby maintaining a connection to the AP. If Wi-Fi connections need to be maintained, enable Wi-Fi Modem-sleep mode and automatic Light-sleep feature (see Power Management APIs). At this point, the hardware will be configured according to the requested wakeup sources, and the RTC controller will either power down or power off the CPUs and digital peripherals. ![]() Once wakeup sources are configured, the application can enter sleep mode using esp_light_sleep_start() or esp_deep_sleep_start() APIs. Wakeup sources can be configured at any moment before entering Light-sleep or Deep-sleep mode.Īdditionally, the application can force specific powerdown modes for RTC peripherals and RTC memories using esp_sleep_pd_config() API. Next section describes these APIs in detail. Wakeup sources can be enabled using esp_sleep_enable_X_wakeup APIs and can be disabled using esp_sleep_disable_wakeup_source() API. These sources can also be combined so that the chip will wake up when any of the sources are triggered. You can use the battery voltage level to adjust the data collection and transmission parameters and maintain high uptime levels.There are several wakeup sources in Deep-sleep and Light-sleep modes. Now, after 15 minutes has passed, your ESP32 board will “wake up,” meaning that the board restarts itself and your program begins again with app_main() where it will reconnect to WiFi, read the battery voltage, report that value via MQTT, and then go back to sleep.Ĭollecting just battery voltage alone doesn’t have much meaning on its own, but this combined with other information like GPS coordinates or air quality can be the start of a solar-powered IoT application. When in Deep Sleep, the ESP32 uses the Real Time Clock to keep track of how much time has passed. Next we start WiFi, then start the MQTT connection, and then call the read_bat_and_publish function to read the battery voltage and publishing the value to an MQTT topic.įinally we set the length for how long we want the Huzzah32 to sleep, and then go to sleep with esp_deep_sleep_start(). In this main function, we are outputting some information about the device we are using, and then setting the log levels. ![]() In this example, we’ll be using the MQTT Broker provided by the Losant IoT Platform. So, for this example, we’ll check the voltage of a battery and send it to an MQTT Broker. By having a device make its connections, send its data, and then go to sleep, you can greatly reduce the total power consumption for your IoT solution and extend battery life. Customers have used battery measurements to have end users re-orient solar panels to the South and increase power production.Ĭonnecting and maintaining a WiFi or cellular connection, an MQTT connection, and sending messages are power-intensive processes. If the battery reaches a low capacity threshold, you can reduce the measurement and transmission duty cycle or identify potential problems in the field. In solar-powered use cases, it is often important to know the current status of your battery. ![]() The RTC timer or the RTC GPIOs can wake up the chip from the Hibernation mode. Only one RTC timer on the slow clock and certain RTC GPIOs are active. Hibernation mode: The internal 8-MHz oscillator and ULP co-processor are disabled. Wi-Fi and Bluetooth connection data are stored in the RTC memory. Any wake-up events (MAC host, RTC timer, or external interrupts) will wake up the chip.ĭeep-sleep mode: Only the RTC memory and RTC peripherals are powered on. The RTC memory and RTC peripherals, as well as the ULP co-processor are running. ![]() The Wi-Fi/Bluetooth baseband and radio are disabled. Modem-sleep mode: The CPU is operational and the clock is configurable. The chip can receive, transmit, or listen. RTC below stands for “Real Time Clock” and ULP for “Ultra Low Power.”Īctive mode: The chip radio is powered on. The different sleep modes have different functions. The ESP32 Datasheet explains the different sleep modes available, and provides a great table explaining the power consumption of those different modes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |