To test this method, wire a pushbutton to the RST pin. The ESP8266 resets when the RST pin goes LOW. It can be the press of a pushbutton or a magnetic reed switch being close, for example. So, we can wire something to the RST pin and use it as an external wake up. If we put the ESP8266 in deep sleep for an indefinite time, it will only wake up when something resets the board. But, there is something we can do about that. The ESP8266 doens’t support external wake up like the ESP32 does. Learn more about the ESP8266 GPIOs: ESP8266 Pinout Reference: Which GPIO pins should you use? However, the pins are so tiny that it is really hard to solder a wire like that to the GPIO 16 without damaging the chip. That tiny pin in the chip is GPIO16 and it needs to be connected to the RST pin. If you want to make a similar setup with an ESP-01 board, you need to solder a wire as shown in the following figure. This proccess is repeated over and over again. Then, it goes to sleep for 10 seconds, wakes up and runs the code again. DemonstrationĪfter uploading the code and connecting GPIO 16 (D0) to the RST pin, the ESP8266 should blink the on-board LED and print a message in the shell. Important: if you don’t connect GPIO16 to the RST pin, the ESP8266 will not wake up. If you don’t know how to upload the script follow this tutorial if you’re using Thonny IDE, or this one if you’re using uP圜raft IDE.Īfter uploading the code, you need to connect GPIO16 (D0) to the RST pin so that the ESP8266 can wake itself up. Uploading the CodeĬopy the code provided to the main.py file and upload it to your ESP8266. One of the easiest ways is using the following function in your code.Īfter 10 seconds, the ESP8266 wakes up and runs the code from the start, similarly of when you press the RESET button. There are slightly different ways to wake up the ESP8266 with a timer after deep sleep.
![esp32 exit deepsleep esp32 exit deepsleep](https://content.instructables.com/ORIG/FPR/NYJB/JK10UIP9/FPRNYJBJK10UIP9.png)
We were able to build a weather station data logger with the ESP8266 using MicroPython that only consumes 7uA when it is in deep sleep mode: Low Power Weather Station Datalogger using ESP8266 and BME280 with MicroPython Timer Wake Up However, you should keep in mind that in an assembled ESP8266 board, it consumes a lot more current.
![esp32 exit deepsleep esp32 exit deepsleep](https://i.pinimg.com/originals/07/91/ca/0791ca417af7ef7aac260819705cd37f.jpg)
In deep sleep mode, the ESP8266 chip consumes approximately When the ESP8266 is in deep sleep mode, everything is off except the Real Time Clock (RTC), which is how the ESP8266 keeps track of time. Flash/Upload MicroPython Firmware to ESP32 and ESP8266.Install uP圜raft IDE ( Windows, Mac OS X, Linux).Flashing MicroPython Firmware with esptool.py.Installing and getting started with Thonny IDE.We suggest using Thonny IDE or uP圜raft IDE: You also need an IDE to write and upload the code to your board.
![esp32 exit deepsleep esp32 exit deepsleep](https://jshbe.best-computers.pl/templates/f16dc396e088c7c707eabe9d7479e7a2/img/ce0eec3d60708e7db292151db1d01ac7.jpg)
To follow this tutorial you need MicroPython firmware flashed in your ESP8266. If you have an ESP32, we recommend reading our MicroPython ESP32 Deep Sleep and Wake Up Sources Guide. This guide shows how to use deep sleep with the ESP8266 and how to wake it up with a timer or external wake up using MicroPython firmware.