ESP32 Deep Sleep Tutorial for Low Power Projects
Ғылым және технология
Welcome to this ESP32 Deep Sleep tutorial with the Arduino IDE! Today we are going to learn how to put the ESP32 chip into the Deep Sleep mode in order to conserve power and make our projects battery friendly. Subscribe for weekly videos ▶ bit.ly/33KIQ09
The ESP32 chip is a fantastic new chip with great features. It offers a lot of processing power, two 32 bit cores, a lot of memory, Bluetooth and WiFi in a small and easy to use chip. One of the most interesting things about the ESP32 chip is that it offers a low-power deep sleep mode which is very easy to use. Let's see how to use it.
Inside the ESP32 chip, we can find the two processing cores, the RAM and ROM memory, the WiFi module, the Bluetooth Module, a hardware acceleration module for cryptographic applications, the RTC module, and a lot of peripherals. Inside the RTC module, we can find a PMU (Phasor measurement unit) a small and very low power 32-bit co-processor, and 8Kbs of RAM memory. This small amount of memory is very useful as you are going to find out in a moment. Also note, even the RTC memory of the ESP32 chip is 4 times larger than the memory of the Arduino Uno.
The WiFi modules, the Processing Cores, and the Bluetooth module require a lot of current to operate. So, if we want to conserve power we have to disable them when don't use them. This is what we are going to do now. We are going to put the ESP32 to Deep - Sleep mode where it disables everything except the RTC module. There is a light sleep mode and the Deep - Sleep mode. In Deep Sleep mode the ESP32 offers the lowest power consumption. It just needs 0.01 mAs of current in Deep Sleep mode and that's why we are going to try today.
💻 Code & Parts: educ8s.tv/esp32-deep-sleep-tut...
👨💻 Check my new KZread channel: bit.ly/3tku2n0
🎮 My Android Game: bit.ly/QuizOfKnowledge (👍 I am sure you are going to have fun and learn something!)
Пікірлер: 146
that background music is so catchy. i keep hearing it after the video has finished
Non-stop informative and amazingness - LITERALLY !
Great video! Thanks for providing more info on the esp32. There are not enough videos about this amazing chip on KZread. Would love to see more! 😀
@Educ8s
6 жыл бұрын
Thank you, Robert! The ESP32 is a great chip! It offers everything a maker wants!
my first video on your channel, watched, subscribed, awesome
This is really great. I've been planning on making a video for the esp32 and Arduino line for my channel. Good to know some of these tricks and challenges.
I learn something new with every video you put out. Didn't know about the bug or the work-around in deep sleep mode. I hope its a software bug. Hardware is bad news for those who have already bought a few boards.
Thank you for the video!
What a great video! thank you so much!
Very helpful! thankyou sir!
Good information, thank you for the tips and tricks 👍
Thank's for the video sir
Hello from Brazil! Very nice explanation!!
Eres inmenso. Gracias. No sabes lo que me estas ayudando.
Very good video!
This is a really interesting video. Always good to find ways to save power.
@Educ8s
6 жыл бұрын
Thank you, Greg! The power savings we can achieve using the Deep sleep mode are huge! Now the only thing that remains is to be able to program to Ultra Low power co-processor with the Arduino IDE for even better battery life.
we have about 20 temp sensors in green houses - but can only monitor where we have power because deep sleep is so dysfunctional on most ESP8266. Seems like the MFGR would put more attention into deep sleep. It opens up huge options. Thanks for the vid and firebeetle idea.
wonderful video..and interesting to know that power consumption depends from the development board because i was thinking im doing something wrong. Just as a reference i measured esp32-wroom (the cheap Chinese version of esp32) and the deep sleep consumption is ~10mA, and esp32-cam is around ~6.3mA. I guess esp32-cam has no onboard leds so its more power efficient..
I hope you took away lots from this video and you managed to get your ESP32 to get to sleep. Let me know below! PS. WANT TO LEARN CODING? CHECK MY NEW KZread CHANNEL! bit.ly/3tku2n0
@TheAscBroth
6 жыл бұрын
Awesome, how did you make it :D?
@DavidLeeMenefee
6 жыл бұрын
@educ8s.tv: FYI; at Kevin Darrah's youtube channel he has invented a board that consumes 0.2uA of current in deep sleep. See here: (( kzread.info/dash/bejne/oaKmrtuNkbjXkto.html )). Keep up the good work...PEACE
@shinigamilee5915
6 жыл бұрын
Thanks so much for getting me interested in doing some Hardware projects once again.
@Educ8s
6 жыл бұрын
I used Android Studio to develop it and Java. Cheers!
@Educ8s
6 жыл бұрын
You are welcome! I am glad you are making stuff again!
When I design low power I use a trick: I power external devices (like small LCD) directly by the GPIO of the microcontroller, so I skip enable transistors/mosfets. Of course current of those should be lower than the ABS max rating for the GPIO Many thanks for the good video, subscribed!
Nice video and I noticed the DFrobot firebeetle you showed has a 32.768kHz xtal which if enabled for the RTC circuitry saves more energy and also keep the timer far more accurate than the default 150kHz RC oscillator. Have you tried enabling the external Crystal and testing?
Hi! Good video! lots of useful information! Good luck in your business!
@Educ8s
6 жыл бұрын
Thank you very much, my friend!
καλησπερα Νικο.Καταρχας συγχαρητηρια για την πολυ καλη δουλεια που κανεις, συνεχισε ετσι.Εχω μια ερωτηση. τι ειδοσ καλωδιων χρησιμοποιεις στο συγκεκριμενο προτζεκτ?
Wow, thanks for sharing :-)
@Educ8s
6 жыл бұрын
You are welcome! Cheers!
Great!!
Watched Subscribed Saved Another fantastic video, thank you. I am looking ing into the best Deep Sleep board I can find for a weather station project. may I ask, will the sensors continue to draw power even during Deep Sleep? I am thinking of using the RTC to wake up the Arduino once an hour, but want everything to use as little power as possible between times.
You have Great talent in video making and electronics
@Educ8s
2 жыл бұрын
Thanks for your nice words!
Really cool addition would be to add solar power to use the esp32 to measure temperature outdoor. I would like to do that, but not Shure how to add solar panel to the circuit. What is required. Probably you could do an additional video :)
Are there gonna be a video about ULP? I am interested how we can use it with deepsleep mode. Thanks!
great channel, have you measured the power consumption of the WEMOS D1 Mini boards?, those are ESP8266 ESP-12 modules, please reply :)
Great video... can we disable the onBoard LED this consumed also energy. Thanks!
Great video! Is it possible to make it deep sleep infinitely?
That's Great can you tell a good pcb milling manufacturer as i want a custom pcb with esp32 using deepsleep and use it to make a landfill monitoring device
Hey, can you recommend a cheaper digital Multimeter to do the same as what you are doing with the Mastech one you use in this vid? Thanks.
Very nice
hello, did you find an alternative for the firebeetle, or is that still the one that has the lowest consumption. thank you!
Hey Nick, did you have to download The cp2102 USB to serial driver for windows or was it inbuilt
nice sir & thanks
@Educ8s
6 жыл бұрын
Thanks, you are welcome!
I forgot to see THIS AWESOME VIDEO, I like so much your videos, normally i dont like so much english videos because they speak so fast and i cant understand, because im a spanish, BUT IN ALL THE VIDEOS I SAY THE SAME, BECAUSE ARE REALLY GOOD!!!, PD: i want if you can do more of telephone satelite location, stuff like that are MUCH interestering Thanks a lot!!!
@Educ8s
6 жыл бұрын
Thank you very much Antonio! I appreciate your nice words!
@asunasan2220
6 жыл бұрын
Thanks! me too
Excellent very educational video. Could you please make another one with the thermostat function. Using ESP32 Rainmaker With DS18B20 and also with DHT11 I thank you in advance
I've just tested with an AZ Delivery Wroom-32: 2mA in DeepSleep. With another Wroom-32 (forgot the board brend)- : 5 mA ; after removing the power led which remains on during DeepSleep on this board) : 4 mA. I tried 3v input : very surprising: far more consumption.
Can you do a video in which you wake the ESP32 from modem sleep mode and turn on ESP32 using DTIM beconing mechanism.
Hi I like your video
@Educ8s
6 жыл бұрын
Thank you my friend!
Hi put my esp32 into deepsleep and then measured the current going to a dht22 temp sensor. Multimeter reads 3.3v as the voltage going to the sensor, is this correct? I may be confusing amperage and voltage but thought in deepsleep mode the 3.3v output would be reduced too.
Hello I have one question and a request I have a sketch with esp32 that performs weight measurement, the whole system also has an sd card where it records all that and measures the weight and bme280 parameters. in the sketch there is a command deep sleep but when it is activated then the whole system forgets all the measurements and resets the weight to zero and that does not suit me can you rework my sketch and go into deep sleep mode but when I wake up I have available measurements of weight and bme parameters i hope google translates well greetings and thanks in advance
Hello I made the program to turn on and off an LED by Bluetooth in this case I use the same LED that has the ESP32 in pin2, I added a stretch of code for the ESP32 to enter a state of deep sleep. Well, when I send the 'A' the LED will turn on and off and when I send the 'B' it goes into deep sleep, however, I still consume the same as I could send the program to see where the error is.
using the DOIT ESP32, I Remove the AMS1117 and the led, directly powering the with dswy2596 (led removed) DC DC 6v battery. Whit timer and GPIO EX1 interruptions got a power consuption of 72mW :)
@jbrepoyt
4 жыл бұрын
72mW divided by 6V is 12mA, that is not impressive. Theoretically you should be able to achieve 72uW...
Look at Kevin Darrah's trigboard, 1uA standby current!
I think that the only reason it draws 20 mA in deep-sleep is because the red power LED is always on, and LEDs draw 20 mA of current. Desoldering it should do the trick and reduce it to 10 uA.
Remove the LED form the board. That should reduce the deep sleep power consumption alot. The fire beetle board doesn't have an LED.
I have a system of ESP32s as an air data monitoring system. I have a central server which publishes to an MQTT topic, which the ESP32s answer with their readings. Also, one of the sensors needs to be continuously told to refresh every 1 second. Is it reasonable to have it deep sleep, wake up every second, refresh that goofy sensor, check to see if there's a message waiting, then go back to sleep for the remainder of a second? Most of the time the boards aren't doing anything.
Thank you, I love your approach -- when faced with a bug, find a workaround. Your videos make me smile, you do a great job. Also: normally I watch at 2x, had to slow you down to 1.75x. :)
Hi, in a project of mine, I am trying to get my ESP32 to wake up from deep sleep mode and to wake it up I have assigned several GPIOs, the issue is I am trying to connect the bluetooth through a function which I do it by assigning it to a GPIO pin 36 that if HIGH it should go inside and execute the Bluetooth function, but it just simply brushes past it and rather without connecting tries to again go into the deep sleep. What would be the best way for me to utilise the digitalRead HIGH to go into Bluetooth or any other function which then should only execute after they have been completed? Or is it not my fault? I have tried to look at good examples but can't seem to find a solid rock.
Great video. Do you know if the random inability to wake from deep sleep bug has been fixed (as of 10-1-19)?
@jbotnik
2 жыл бұрын
I’d like to know this too
But what if you want to make a wifi access point and also have deep sleep when no one is connected? How would you check regularly then like every minute if someone wants to connect or how would you do it?
Is there a "deeper" sleep mode where it disables the RTC block and the only way to wake up is via a hard reset?
What can I do if I want it to stay always on? I want it always on, ( I connected it to the wall power source) so I want the WiFi module always operative and ready to work
hola tengo un sp32 con un sensor dht22 que envía datos a ThinkSpeak cada 30 minutos, podría mientras mantenerlo es deep sleep? gracias
Hi Thank you so much for your great info. I have one doubt. I have connected a DHT11 sensor. It has an inbuilt LED. During deep sleep that LED of sensor is not switched off. It seems the power going to sensor is not cutoff. is it possible to do that?
@MarcusBehrens
5 жыл бұрын
yes, simply put the vin of the dht11 on one of the gpis and turn it low before you go to sleep
Please try TI MSP432 P401R
Hi can u explain how you did the measurement for the difference in the power consumption, from active mode to deep sleep mode. thanks.
@gritnix
4 жыл бұрын
Use a multimeter that can measure milliamps. Usually the black wire stays in the same jack in the meter but the red wire goes to a different jack from the one used to measure voltage. Hook the red side of the meter to the red side of the battery pack. Hook the black side of the meter to the + input on the board. The black from the board goes to the black of the battery pack. The current then flows through the meter to get to the board and the meter displays how much is flowing.
Hi!!! Educ8s tv!!! i'd like if possible, some video explanning step by step how to connect esp32 with Nextion Touch Screen of ITEAD, the changes needed to be done on libraries, and an example of inputs and outputs, like screen button to activate a led or analog's read input, like potentiometer or others!!! Thanks!!!
i have like 70 esp8266 12f modules and all uses 150ma when in normal mode and 80-82ma in deep sleep. could you help me identify is it due to the schematic or i got fake ones? (paid same amount for what original goes.)
Wemos lolin32 is a great board too!!!
@Educ8s
6 жыл бұрын
Yes, the Lolin32 is a great board! There is also a Lolin32 lite board which looks very interesting as well.
I tried the deep sleep on xiao esp32 c3 board and it worked but when I try to upload new code then there is no port shown
Hi Nick! with your deepsleep current testing sketch my recent TZT ESP32 WiFi & BLE battery board (TZT store Ali), I measured 57.2 mA in the active mode and 9.5 mA in the deepsleep mode. It is still far from beeing optimized . Thanks for sharing!
was the deep sleep mode fixed?
Hello, thank you for perfect video. Is the bug solved? Please, what errata's issue describes the bug?
@Educ8s
Жыл бұрын
Yes this bug is now solved. It was a hardware bug of the rev0 chips.
Hello, if I sleep my esp32 for more than 35 minutes it wakes up instantly. Below that number works fine. any ideas?
For a year of battery life you have also to consider the self discharge of them.
@Educ8s
6 жыл бұрын
Yes, that's correct!
My 32devkit board was drawing 10ma extra before cutting that red power LED.
how much current reduced if desolder esp32 power led
I have a problem my device goes onto deep sleep mode then it runs setup without waking up.
What if I want to communicate to the board via WiFi or BT? Would waking the radios e.g. Every 5 secs for just 100 ms work and if it detects a connection attempt it would postpone the sleep until the inquiring device would disconnect? Could this work and how to implement it?
@SanketThodge
5 жыл бұрын
Have you tested this thing? I am about to have a similar use case. Thanks in advance. :)
@dhavalshukla6615
2 жыл бұрын
Same, have any of you found a way? I am trying to do the same.
My question is how to make esp32 read internal Voltage
Hi, where can I find the manual of this library?
@Educ8s
6 жыл бұрын
Google ESP32 Deep Sleep API
isn't 20ma because of the red led indicator? because i don't see led in in other board
@Educ8s
6 жыл бұрын
Yes, that's correct. the led draws some current but not 20 mAs.
@yudhahamdiarzi5553
6 жыл бұрын
it's hard to design low power and cheap too :D. Thanks for the video!
What could you do for a Bluetooth project where we need the esp32 to sleep until he receives a Bluetooth command? Can we put all in deep sleep but the Bluetooth?
@olafschermann1592
Жыл бұрын
Enabling the radio module consumes 100x the power as without. The only viable solution is to deepsleep for 10min then wakeup and poll for new messages via wifi or ble.
Does anybody know how to reconnect to a WiFi net after waking up from deep sleep? I'm using an ESP32
I am now wondering what if I have my ESP32 configured to use smart config (docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_smartconfig.html) and I put it into a deep sleep for 30 seconds. Once it wake up, would it connect automatically to the WiFi or I would have to use SmartConfig application once again on my mobile device to enable WiFi?
@ishdemon_
3 жыл бұрын
Save the Wifi credentials in RTC, it survives deep sleep
Bien jouer gros
Can I use 5v for vin?
@RakshithPrakash
5 жыл бұрын
Yup it goes into a regulator so voltages even little more than 5 should be fine
You should make a pause between phrases. Speaking English (which isn't my mother tongue, either) doesn't mean to speak as fast as possible.
Can you give me an idea for a GPS locator with long lasting battery for my automobile I don't want it to be connected to my battery of my automobile can you share some insight
@ottohorst9127
6 жыл бұрын
kevin david you Could connect your GPS to an external battery like it is done in Watches to keep the time.
@goofydavid100
6 жыл бұрын
Yea I want it in a small package I heard GPS locator takes a huge amount of battery I need it in a 7*7 cm package board
@ottohorst9127
6 жыл бұрын
kevin david you could also use a small lipo and recharge it with the powerboost 1000c. Watch some gps tutorials at adafruit.com
@goofydavid100
6 жыл бұрын
Otto Hörst thanks for the information man if was so helpful cheers
@Educ8s
6 жыл бұрын
Yes, small lipo battery and low power board like the ESP32 is a good start.
Would it be possible to sleep for hours?.I have tried this: #define uS_TO_S_FACTOR 1000000 #define TIME_TO_SLEEP 3600 /* Time ESP32 will go to sleep (in seconds) */ but the ESP32 restarts all the time
@serialxnet
5 жыл бұрын
Change 1000000 to 1000000LL and 3600 to 3600LL
@rigel_emg
Жыл бұрын
@@serialxnetThank You, man! Thank you so much!
hello
I Bet That A NodeMCU-32S Takes Small Amount Of Power
18'С very cold. why are you working in such a cold.
@GreenCappuccino
6 жыл бұрын
it feels like a constant breeze in a equator city. not bad
@cappie2000
6 жыл бұрын
18 degrees for someone that is physically handling things is actually quite comfortable.. 22 degrees and up can be really tiring..
Was the bug fixed?
@Educ8s
Жыл бұрын
Yes, it was a hardware bug which is now fixed.
Can I power this ESP32 board www.amazon.com/dp/B0718T232Z/ref=cm_sw_r_cp_apa_fab_qYoCFbKQHPMVG with two 1.5 volt Energizer Ultimate Lithium batteries like these www.amazon.com/dp/B00EAKP8S0/ref=cm_sw_r_cp_apa_fab_k2oCFb14S8G9F ? If so, would it be better to use two of these batteries through the 3.3 volt pin, or 3 (or 4?) of these batteries through the 5 volt pin ?
Arduino game console please! Maybe check out the Arduboy?
@Educ8s
6 жыл бұрын
Yes, I will take a look
Can we use it to make a wrist watch with e paper display pls pls pls pls pls pls pls pls pls pls pls replay or make one pls pls pls pls pls pls pls pls pls...
Hi, On ESP8266 i can reduce sleep power. I get over 50uA and i think that it is possible reduce it a little more. It´s importat use a good LDO regulator. I share my project hardware on Github: github.com/grafisoft/SpainLabsIoT2018 I have some board without components that i can send. It is possible that i do a new board using ESP32, but i will wait more, ESP32 is young. Regards.
He makes good informative videos,but hey....can't he sliw down his stress speaking please.
@Educ8s
2 жыл бұрын
Yes, you are right! I was speaking very fast at that time. I think my latest videos are better at this. Thanks for the feedback.
Plz speak slowly
I like your video but you talk way too fast for me to sub.
By the way, 10 mA is not so good result for power saving project. Was tested and found absolutely unusable. Dislike. Don't wast your time.
don't speak so fast. You are very difficult to listen to. Words merge into one incomprehensible sentence.