Shenzhen Xin Yuan Electronic Technology Co., Ltd.
 
手机官网
 
关注我们微信公众号
购物车图片 购物车 ( )
找服务 找新闻
The recommended reading
Hot label / Products

ESP32 Deep-Sleep

Author:
Time: 2017-08-02
Clicks: 557

The ESP32 is the successor of the famous ESP8266. It has much more features like Bluetooth. This instructable shows you, how to deep-sleep the ESP32 and wake it up using different sources.


Step 1: Watch the Video

If you want more details, please watch this video:

Step 2: ESP32 Block Diagram and Pins

ESP32 Deep-Sleep

But first, let’s get an overview: The ESP32 chip has 2 processor types, the main, and the ultra-low power, or ULP processor. And it has plenty of pins, which can be used by these two processors. Most of the ESP32 pins have many different functions, which can be quite confusing if you look at the data sheet. Here is an excel sheet for an overview of the pins of the WROOM-32 module:

https://github.com/SensorsIot/ESP32-Deep-Sleep/blo...

17 pins can also be used by the ULP processor, they are called RTC_GPIOs (RTC_GPIO1 and 2 are not available on the WROOM-32 module).
There are also 10 touch sensors. And they are also connected to the ULP area. These pins will be used later on.

Step 3: Wake-Up Sources

ESP32 Deep-Sleep

The ESP32 supports five different modes from active where everything is “ON” to hibernation, where everything is “OFF”. Today, we concentrate on two modes: Active and deep-sleep. And we see, that even during deep-sleep, the ULP processor can be kept on. Cool. But how much current does the module consume in this state? According the Data sheet, it is 0.15 mA or 150 µA. But how can we wake the ESP32 up from its deep-sleep? With the ESP8266 we basically had two possibilities: Either reset the chip from an external source or connect GPIO16 to the reset pin for a timed wake-up. And, with the timer, we were only able to sleep for about one hour. The ESP32 has four different wake-up sources:

  1. The timer

  2. Two possibilities of external Wake-ups

  3. The touch pads

  4. ULP coprocessor wake-up

Step 4: Timer Wake-Up

ESP32 Deep-Sleep

The ESP8266 is only capable of sleeping for one hour.The ESP32 can sleep many years before it wakes-up. And it is no more necessary to connect pins to use the timed wake-up. Everything is internally connected.

We start the deep-sleep with esp_deep_sleep_start(); The sketch never reaches code after this statement, because, after wake-up, it starts with the execution of setup().

We also get good information on the boot procedure (e.g. reset cause).

Step 5: External Wake-Up

ESP32 Deep-Sleep

The next is wake-up by an external source. This was also possible with the ESP8266 by resetting the chip. Here, we get much more possibilities: We can wake-up the chip by one particular pin only. To do this, we have to select the ext0 mode and tell the chip, which pin is connected to the button. And in addition, we can decide, if we want to trigger the wake-up by a low or a high state of the pin. To find-out the pin number is a little tricky: We have to use the GPIO number of the pin, not the RTC_GPIO pin number. Fortunately, we still have our Excel sheet and we can see, that RTC_GPIO00 and GPIO36 are connected to the same pin on the WROOM-32 module.

One thing is important: You have, depending on the interrupt polarity, to connect an external pull-up or down resistor to the pin. I used a 100k resistor and it worked.

But what, if we would like to have several buttons for the wake-up? Also here, our new toy offers an elegant solution: we use the ext1 wake-up source. In this mode, we can use several pins for wake-up. Because we can declare more than one pin, we have to define a so called “mask” instead of only a pin.

Step 6: Touch Pin Wake-Up

ESP32 Deep-Sleep

The last one is the touch wake-up. Also this wake-up works somehow similar. The deep sleep is started with the same command, and after deep-sleep, the ESP32 also starts with the execution of setup(). The definition of the touch pin, however is different: This source uses touchInterrupts() and you attach the interrupt of each touch sensor you want to use to a “callback function”. If you do not attach the interrupt, this sensor is inactive. In addition, you have to enable touch pad wake-ups.



 

 

 

 

 

 

 

 

Share to:
Related recommendations
2019 - 08 - 05
点击次数: 11
August EventCheaper priceFree shipping for specific productsFull reduction activityCouponhttps://www.aliexpress.com/store/2090076?spm=2114.12010615.pcShopHead_1...
2019 - 07 - 09
点击次数: 51
Type:1.T-Watch SIM800L Bottom PCB Board SIM Card:ESP32AttributesDescriptionGPIO33TXSIM Card,UART_SIM_TXGPIO34RXSIM Card,UART_SIM_RXGPIO14RSTSIM Card,SIM_RSTGPIO15PWKEYSIM Card,SIM_PWKEYGPIO04BOOS...
2019 - 06 - 18
点击次数: 34
https://www.aliexpress.com/store/2090076/pages/promotion-20190618.html?spm=a2g1y.12024536.pcShopHead_11037743.2
2019 - 06 - 13
点击次数: 22
The emergence of T-WATCH brings us much fun, we want to share with everyone and hope it can be used ...
  • 资质认证

    服务商100%实名审核认证

  • 支付安全

    明码标价支付及信息安全

  • 专人服务

    服务全程进行信息化监控

  • 售后无忧

    服务出问题客服经理全程跟进

The unified hotline:
0086 13928411439
skype:seatechnolgy
@outlook.com


邮编:330520
  • Aliexpress

  • ebay

  • "Sweeping" attention to us, more activities, surprise waiting for you
    E-mail: lily@lilygo.cc       Wechat: 13928411439       QQ :3004603945       Facebook:lily@lilygo.cc
     

    Copyright ©2005 - 2013 Shenzhen Xin Yuan Electronic Technology Co., Ltd.
    犀牛云提供企业云服务