This was gold. My project needs both lower power consumption and offline storage. It had completely slipped my mind that EEPROMs have a write cycle limit, and I was going to treat it like a cache.
@@AndreasSpiess That is my plan as well. I have a sql server with a php script that receives data via POST. My thought was to have onboard storage in case the server went offline.
+norm1124 Danke für deinen Kommentar betreffend "Ende". Ich kriege ja eine Statistik und die sagt, dass meine Videos durchschnittlich während 3 Minuten angesehen werden. Diese Zahl ist sehr konstant seit Beginn. Das war der Grund für meinen Kommentar ;-)
Thank you. A very interesting breakdown. I'm still new to arduino but it's deep dives like this make me appreciate what goes into hardware design. You video was simple and very easy to follow.
As usual, you are rock star. Thank you. One suggestion, always connect GPIO2 and GPIO 0 to Vcc with 4.7K resistor. Because sometimes the ESP won't wake-up properly from deep sleep and it is termed as zoomie mode (deep sleep wakeup)
+Venkatesh E Thank you for your comment. There are many different opinions concerning how to to connect the different pins to Vcc and whether it is necessary. Pin 2 definitively has to be high according to the datasheet, but so far, I never pulled it up and had no problems. Just a remark: During boot, pin 2 also sends some information on 75000 baud...
+Andreas Spiess thank you. Even I heard that there is something goes out on Pin 2 (TX1). Some guy connected LED to Pin-2 and keeps blinking at startup which he is not expecting that. From that I found there is something is going on, but I am not sure what it is. The 75000 is the super hint here. Thank you once again. Waiting for next video. Good Luck.
+Andreas Spiess So regarding pulling GPIO-0 (zero) high, do you think a bad power supply can cause the ESP stuck in zombie mode. Your's seems to work without that one. Please let me know if you have any information on this. Thank you once again.
Great video. I keep coming back to this to improve my understanding of esp8266 power modes. My thought here is to build a neat GPS data logger. Boot into the low current 15mA mode when recording a track out in the field. Use some of the flash or an sd card to log. Then flick a switch and reboot into wifi mode when at home and download the nmea or kml data from a http server running on the esp8226. Would be a neat project I think. Now to find the time to make it a reality... Keep up the great work with the videos Andreas.
+Luc Small I think, this should be possible. You can record a long trip on the SPIFFS file system in on the module itself if you set it to 3GByte. Then you do not need an SD card. And if you do not move fast, you might set it to sleep for 70-80% of the time to save even more "juice". I am not sure if you lose the content (or the pointer to the content) if you reboot, because I never worked with SPIFFS so far.
Hello Andreas, Thanks for all your work and sharing. I'm going to program my Google Home so it will fire up my soldering station as soon as it hears English with a Swiss accent :) Thank you so much. Your video's are of high quality and you have excellent skills. Also didactical. Keep up the good work! Regards,
Thanks for the deep sleep explanation. I plan to create some humidity monitors, each using a DHT22. Now I know how to save battery power draw from my ESP8266.
Then you have to connect pin GPIO16 with the reset pin. But only after upload (otherwise you might have problems with the upload iof the sketch). This connection is necessary to restart the module after deepsleep.
I could not for the life of me figure out why my Adafruit Feather Huzzah would not wake up. The key piece of information I was missing was at 7:35 - you have to jumper RST pin to GPIO16. Thank's for the great video!
what a brilliant video. than you so much, ive been having trouble with one of my projects and your video showed me how to sort it out so thank you from me and my brain(which was really hurting lol). :)
Thank you for your very informative videos. Did you use the 10mH inductor in combination with a de-coupling capacitor to Vcc? If so, what was the capacitor's value? If not, how was the inductor connected?
Very informative thanks. I have a slightly different situation where I have an ESP8266 connected to an Arduino Pro mini. I use the pro mini for various reasons and can get it's power extremely low. The ESP is programmed with AT Command firmware and I can put it into SLEEP and DEEP SLEEP. I plan to have the pro mini trigger the RST or CH_DP pins
Finally got it working on ESP. By the way, to fix the "Unable to load issue, It seems a resistor goes between IO16 and Reset. If you use a link(as I did) you can't program the chip unless you remove the link. I am using a 1K. Lower resistors should work as well. Thanks again for your Vids Andreas.
One thing you missed is modem sleep. It allows wifi to stay connected. Just use wifi_fpm_set_sleep_type(MODEM_SLEEP_T); then a delay(1000) in your main loop. For me this uses between 15ma and 70ma but I don't have an accurate way to measure it
I never used modem off so far, because I had no need for it. It does not save enough for battery powered devices and current consumption does not matter too much for devices connected to mains.
I highly doubt it'd look the same, but I also can not disprove it. The battery would behave more closely to a capacitor, thus smoothing the peaks ... at least that's what I think it'd look like.
@@josuaschmid501 The current flow is decided by the ESP (the load). If the ESP does not get the required current, the voltage will drop (ohms law), and the ESP usually crashes. A well-known problem. The best is you try. No need to believe me.
Congrats for all your videos. Still prefer esp8266 to ESP32 for most applications. Hope that you will continue those interesting videos on this chip. Bye.
Most of my videos are not chip specific.I sometimes use an ESP8266 because I still ahve lots of them laying around and they are good enough for most applications.
Andreas another great video. Thank you. Have you ever considered or tried using a MOSFET to bypass the regulator under ESP control? The idea wouldl be that when the battery voltage was low enough the regulator could be shorted out by applying a GPIO signal to a FET. Then the full battery voltage would be available to the system, and the regulator losses would be eliminated. In a deep sleeping system, the fact that the battery voltage was low enough to allow regulator bypass could be saved so that it woke up that way. Just an idea.
This is possible, but quite complicated. And you lose your only ADC on the ESP. I did not test, but the last few mV are not very valuable because at the end, voltage drops quite fast. Also dropout voltage of a HT7333 3.3V is only 150mV. I also not tried the accuracy of the ADC of the ESP at variable Vcc. The Arduinos use Vcc as a reference. So, the ADC readings are not very stable when you change Vcc (video #10 shows that plus a trick).
Interestingly many people recommend to use a low ESR type capacitor to reduce brown out risks. However I see the problem of high leakage currents with low ESR capacitors (>200 uA depending on capacity) which is really bad for battery powered applications. Normal capacitors seem to be quite ok and give the same results for me, with a leakage current of 60 minutes as leakage current drops after time)
Very informative, I have been using the esp8266 for some sensors and experienced exactly what you show here, I do not have an oscilloscope so it was (not) great to see those spikes. Another obvious power saver is to switch it on when needed ie pressure on a scale, external switch etc. Have you looked at the meshing the esp yet? that might be useful for larger deployments maybe?
+Peter 1. Retief Swich it on and off is good if you want to use it on battery and only switch it on once a day or so. Videos about that are in the works... 2. No, I did not look into meshing it (i understand mesh as a network of many ESPs). I think, 2.4GHz is great if you have a WiFi network around. For independent sensor meshes I prefer for the moment sub GHz RF modules. Also there, a video should come in summer (it is a lot of work...)
Awesome video, and well explained! It is a pleasure to watch your videos. I am currently thinking about buying a digital oscilloscope for tinkering around with ESP8266. I see that you use a SDS 2012. Do you think that 1GB sampling rate with 70 MHz gives a sufficient resolution to see the power spikes? Thanks for your great contributions!
+Thomas Mittag Thanks for your comment! The spikes were not complicated to see, they are about 1 microsecond, if I remember right. Concerning the oscilloscope: I bought mine three years ago (it is actually a SDS 2102) and I bought the best I was able to get for my budget (1000$) then. Since I am a tinkerer, not a professional with a project I had no idea what I will need in the future. So, the budget was the deciding factor for me. So far, I am happy with the Siglent brand. I just bought a spectrum analyzer and a waveform generator from them.
Thank you for the very informative videos Andreas. You mention below that you used a 10mH inductor with the same effect of the 1000-2200uF cap. How did you connect the inductor (in addition to a cap or from supply+ to Vcc alone)?
If I remember right, I used the inductor instead of the capacitor. The inductor has to be connected in series in the power line either in the plus or the minus cable. It does not matter which. Maybe a combination of both would be the best solution, but I did not check.
Thank you for a wonderful and informative channel. I have subscribed. One question I have on "deep sleep" - the sensors themselves also draw current, correct? I've seen a lot of focus on how to get our MCUs to behave, but what do we do about the sensors themselves? For example, a simple capacitive soil moisture sensor datasheet mentions 5mA current. Some of these sensors even have their own voltage regulators, drawing extra current. If we bully our poor ESPs into the micro-ampere sleep states, this does not help if our sensors still drain our batteries. Do you have a video on workarounds for this? I'm still starting going through all your posts, so maybe there is, but I've not found it yet. Thanks in advance, and thanks again for the great channel.
Keep up the good work Andreas! Just one small pronunciation thingy: wifi is pronounced more like weyefeye /ˈwaɪ.faɪ/ (like hi-fi) and rhymes with things like pie and dye :)
Ah I see, well you sure do make great video's. Really interested in everything there is about the ESP8266 at the moment and subscribed to your channel ;)!
Mr. Andreas, first, thank you for sharing your knowledgement and I like your peculiar way of teaching, it´s very clear and understandable. Second, can you help me in a doubt ? Have you ever measured the amps consumption of an ESP8266 with a decoupling capacitor of 1000uf 6v in deep sleep mode ? And then, take the capacitor out and measure again... Can you do this test for me ? Because I did, and with the capacitor even in deep sleep it draws 150uA... With out the capacitor it draws 3uA. Can you confirm that ? is there a way to use the capacitor, but keeping the consumption in 3uA ? PS: I am powering ESP with two AAA batterys... Thank you very much !
I am travelling and have no module and capacitor handy. You can do this yourself by just measuring the capacitor without a module. If it uses the difference, then it is the cause. Pay attention that you wait a long time before you measure, because the capacitor is loaded over an exponential curve and this takes long. It is possible that you just measure some loading current. If the capacitor does not take the current, write a sketch which leaves the esp in deep sleep for one hour and measure.
+Eduardo Zola you decide with the calls you described in which mode the Esp will wake up. So, you know. The Esp should not chang this mode itself. I do not know of such a function. If you are in doubt if the calls really work, measure the current.
Thank you Andreas, great Video. is the current consumption same when using ESP.deepSleep(x,WAKE_RF_DISABLED) and ESP.deepSleep(x,WAKE_RF_DEFAULT).? if not please mention the current consumption for both these modes.
You are great, thanks. I love your video about powerconsumption and bateries. I hav a project with NodeMcu 12E and in deep sleep I still use about 70mA, so my batery lasts about 4-5 months and it shoul last much more in deep sleep because I do work every 20minutes, send data tu database and then go to deep sleep 20minutes. I simpley cant have about 20 micro ampers. I connect GPIO0 to 3.3, GPIO15 to GND, RST pin and EN pin connected to Vcc, GPIO16 to RST. Can you please help. Thanks
So if you use a large capacitor to reduce the current spikes in order to be able to use a lower current regulator, how do you deal with the inrush current when the capacitor is initially charging?
A small regulator usually cannot deliver a high current (because it has a high internal resistance or a protection circuit), that is the problem I want to solve with the capacitor. So, I think, the inrush current will be limited by this fact.
It won't damage the regulator? I'd like to use a MCP1700. Datasheet shows max output current at 250mA, but output short circuit current at 408mA, which is way above the 250mA spec.
be careful when using big capacitors (>1000 uf depending on your max current and wire dimensions) which leads to slow VCC rampup. It happened to me that at powerup the rampup of the 3.6V VCC voltage was so slow that the ESP startet without WIFI properly working. The reason is that when rampup is too slow due to limited inrush current, the ESP core starts running (e.g. at 2.5V or even lower) but WIFI cannot initialize correctly at that time because it needs higher voltage for calibration. It is not always "the more the better" :-)
Great video. It got me going on my first ESP project. I got WiFi sleep to work. turning it off and then on again and getting 18mA average draw. I would like to get light sleep to work and half that draw again. I am polling a sensor every 10 seconds, and deep sleep isn't the best way to tackle that. WIFI sleep code: #include void setup() { wifi_set_sleep_type(MODEM_SLEEP_T); } void WifiStart(){ WiFi.forceSleepWake(); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); } void WifiStop(){ WiFi.disconnect(); WiFi.mode(WIFI_OFF); WiFi.forceSleepBegin(); }
Hi. WiFi.mode(WIFI_OFF); and WiFi.forceSleepBegin(); both worked with an active connection for me. WiFi, pronounced WhyFiii (iii, as in I), not WhyFeee ;) Cheers for the informative videos!
Andreas - Excellent Video and Loved your thorough explanations... I have tried this with an ESP8266 - 01, however, it seems I over-looked the need for access to GPIO16... Doesnt seem available.. My experiment was to place these in a wearable package for my pets to track them through the day... Using Signal Strength and several other ESP8266s thoughout the house...but, battery consumption is a problem, it seems the 12E is the only option, correct? Or do you have an idea on how to better track a pet through the house...
Hello Andreas, I tried the Deep Sleep, but I am not using 12E, using the ESP8266 - 01 Module, but maybe need to order a couple of the 12E versions,,, Since GPIO16 is not accessible on the Module..
Hello Andreas, I didn't understand exactly how you connected the Capacitor. Is it between max 4.2 and ground from the battery or between VOut of the LDO and ground? Where did you solder + of the capacitor If it's between the LDO Vout and ground?
Thank you for all of your video's. They explain all details very well. One question though on deepsleep. I'd like to wake my esp8266 from deepsleep from an external interrupt (button press). I thought I could just connect vcc via a resistor with a button to ground and T from between the resistor and button to the RST input to put an interrupt event on the RST input. But that does not seem to reset the device. Is the D0 - RST connection still needed in that setup? Any thoughts on that?
If you pull the RST pin low and high again, the ESP boots. I just tried it with my NodeMCO board. So, you connect a 5-10k resistor from VCC to RST to keep it high and a push button between RST and GND. Then, you should get what you want. Just connect serial monitor to check. The module always have to be powered.
It seems to have been a case of the syndrome that you can look at a situation for a long time, but don't spot what you've done wrong. I now see that I had the resistor connected to GND as well. Thank you very much!
+Andreas Spiess I think I can speak for everyone, we are just very grateful for the time and effort you put in all your videos. Video editing is a lot of, sometimes frustrating, work. So thanks again and keep up the good work!! Kudos!
Hey Andreas! Very interesting video. For my project i need a sensor to wake up the ESP from deep sleep. Is this also possible? Or is timing the only way to handle it?
Thanks for the deep sleep explanation. Is there any video explaining Light Sleep in detail? I am new to ESP so I have few questions. If ESP8266 does Light Sleep automatically or if we have to do it manually with WiFi.forcedSleepBegin()? If it is useful to use forced light sleep or should I go with deep sleep always?
I never used the light sleep and I do not know, if it works. A few mont ago, I read, that it did not work properly. Its effect on power consumption is also not that big, similar to switching off the WiFi.
Thanks for replying. Another thing, if I use ESP.deepsleep(time,WAKE_RF_DISABLED) then on reboot, my wifi will be OFF. Right ? then how can I enable it again ? for example, 1 out of 10 times I want to enable Wifi.
That is not trivial. Because the ESP boots after deepsleep, you lose all your varialbes, also your counter. In some of my videos I solved this problem using the RTC memory. But I would start first simple and add complications afterwards
Hi Andreas, Interesting tutorial. I measured current comsumption in an ESP-12F and detected picks of 500mA. Have you ever tested this model? It's rather weird, because I did not find any reference about diferent current consumtion among esp8266 models.
No, I do not own one. And I am also not completely sure if I measured the the real peak current of the 12E's correctly. I was satisfied with the results then. How did you test?
That was really helpful. Thank you alot. I am running a NodeMCU 12E from a Li-ion 3.7 battery. First I connected the battery directly to 3.3 pin and the deep sleep works and cosumes 115 micro ampere current. Then I stepped down the voltage form the battery using mcp1700 votlage regulator which has a quiescent current 1.5 micro amp but the promblem is that in deep sleep mode the consumed current rises to 1.5 mili amps. Then I tried to run the board from the Vin pin which is 5v in my board but it did not work at all. Any help or advice to reduce power cosumption during deep sleep would be appriciated. Thank again for your effort on your videos.
Most development boards cannot be used with deep sleep because their power consumption is too big. This is why I used a barebone module. Some ESP32 boards are a little better. I made some test videos.
I was looking at the function of CH_PD pin, CHip select Power Down a pin that active low brings the who chip in a restart mode. It seems that this pin reduces the current till micro amps. It seems to be similar to deep sleep mode.
Hello I am measuring the current consumed by a NodeMCU (module ESP-12E), connect a resistance of 1 ohm in series with the power supply and 200mV peaks appear every 100ms that these peaks are due.
Thank you for great videos on the ESP8266. Have you found a way to enable RF after waking up from ESP.deepSleep(microsec, WAKE_RF_DISABLED)? Seems like forceSleepWake() does not do the trick. The only way I can get wifi working again is to do another deep sleep with RF_CAL, which is not optimal.
The only way I've found to get it to use the modem after deepSleep(..., WAKE_RF_DISABLED) is these 3 commands before WiFi.begin() inside the loop() of the sketch: WiFi.forceSleepBegin(); delay(100); WiFi.forceSleepWake(); ... do something ... I have several println here WiFi.begin(... If I try just the WiFi.forceSleepWake() it does not work. Hope that helps. I found this through trial and error.
Hi Andreas! I run more and more ESP's on 5V now, especially since Espressif made their comment regarding 5V tolerance. Have you ever tested what happens to the current spikes when running an ESP-12, ESP-01 or similar on 5V?
I hope you mean on the input pins, not on Vcc ;-). Because the statement of Espressif was only for these pins. Input pins should not produce any current spikes.
Thank you for your reply Andreas! No, running *many* devices on 5V (VCC). Even running them om 5.2V. And, yes, ESP-01, ESP-07 and ESP-12 VCC (no regulator). Guessing then that you have not tested this on your oscilloscope? Cheers, Mike!
And I probably will not test it because I do not see a reason to violate manufacturers recommendation here. Vcc max for the ESP chip itself is 3.6 volt. But it is good to know that it also runs on 5.2 volts...
Good walk through. I have an odd experience with a bare ESP12E, I haven't connected RST and GPIO16 as i want it to go to sleep until it will be power cycled. but after the sleep-time ran out, it blinks the blue led and draw 8 mA?? if i use ESP.deepSleep(0); it dosn't wake up, but then you can ONLY wake it by reset. Quistion: When it wakes up, i can see it is booting @74400baud, but it doesn't run my code, so what are it doing?
1. Maybe you watch my video #108. 2. The ESP always runs your code if you reset it. the messages @ 74400 are not important. It has nothing to do with deepsleep
Andreas, may I ask how you setup your scope to measure current. Do you require different probes? Are there any dangers to measuring current? I have recently purchased a rigid Ds1104DZ and still learning the basics. Your direction would be gratefully received. Thank you
+Dean Greenhough It is quite easy: As you see in the video I put a 1 Ohm resistor in the GND line. With the oscilloscope you just measure the voltage on that resistor and calculate the current according ohm's law. Maybe you watch the video again with this explanytion you will see the explanation. There is a danger of a shortage: Your oscilloscope has usually GND connected to Earth. If your device has also a connection to earth you can create a shortcut in your device. This is why I put the resistor in the GND line. Then I can connect GND of the oscilloscope to GND of my bench power supply. No problem. You will also have no problem if you power your device from battery because then you have no connection to earth. This danger exist always, not only during measurement of current! Hope, this helps.
+Andreas Spiess my apologies for writing a post, before I re watched your video. Your explanation is clear and I have reached a better understanding, thank you. I do have one question: The 1ohm resistor, I assume I will need a resistor like this? I assume this will get pretty warm. Do you advise only running this for a limited amount of time? Thank you so much for your time www.ebay.co.uk/itm/like/391374624389?limghlpsr=true&hlpv=2&ops=true&viphx=1&hlpht=true&lpid=122&chn=ps&googleloc=1006959&poi=&campaignid=207297426&device=c&adgroupid=13585920426&rlsatarget=pla-142405555266&adtype=pla&crdt=0&ff3=1&ff11=ICEP3.0.0-L&ff12=67&ff13=80&ff14=122&ul_noapp=true
+Dean Greenhough The power dissipation of a resistor can be calculated by the formula: P = I x I x R. If yor device draws a current of 1A the power rating for the resistor is: 1A x 1A x 1 ohm = 1 Watt. Normal resistors are 1/4 Watt and therefore should be good for 0.5A. So, yours is ok for quit big currents.
This video has absorbed me for the whole weekend, I have learned so much, but aware of just how much I don't know. Thank you Andreas for your guidance and patience. I am awaiting a 1ohm power resistor so I can replicate your work on the ESP.
Great great great tutorial ! Worked pretty well for me but I still have kind of 0.5mA in Deep Sleep do you have any idea from where it could come from ? Thanks again so much for what you're doing !
Hi Andreas, thanks a lot for your quick answer ! Actually I use the same chip than yours, this is why I found it ackward, a classic esp8266 esp12e. I will open the metaliic case of a broken one. I just feel it's in Light Sleep when I ask a Deep Sleep. Do you have any idea on how to stop the CPU by hand ? ( by command in fact ) Thanks a lot !
Hi Andreas ! I'm actually checking the amperage going out from an arduino UNO 3.3 Volt output,it was the only thing I had under my hand. I've put a capacitor and it worked fine, but when I tried withtout, I had the luck to hear a small "gritziik" which told me I had to try with another board. I'll try with a real power supply tomorrow. I definitely believe that a low power consumption timer should exist in another way ! I'll keep you informed in anyways, thanks so much for your answer
Anyone have an idea why deep sleep would cause erratic behaviour? I'm using a Wemos D1 mini wich is based on the esp8266, and when I use deep sleep the timing at wich thingspeak receives data becomes randomised to a certain extent, without deep sleep the transmission delay is a very tight 30 seconds but with deep sleep theres suddenly a 5 second variance. It also seems after every 3-4 transmissions the data gets messed up because thingspeak receives an entry but it's not displayed on the chart. Any ideas would be greatly appreciated!
1. Because the ESP boots after deep-sleep it has to connect to WiFi. Which takes sometimes longer. 2. Look at the maximum posting rate of Thingspeak. Maybe 5 seconds are not allowed in the free plan.
Grüß Gott Andreas, with reference to the scheme @ min 7'40", how is the switch at GPIO0 operated (to flat firmware or to upload a sketch)? I mean, when is the pulp or pull down activated? There is a bit of confusion out there, perhaps because "pin" and "GPIO" are used interchangeably. Happy and creative 2018
GPIO means General purpose Input/output. These are pins which can be used for this purpose (other than Ground or Vcc pins). During power-up, GPIO0 pin has to be high (3.3 volts) if you want to run the sketch. If it is low, the ESP programs its flash memory. To be sure it really is 3.3 volt, we use pull-up resistors to 3.3 volts. A button switch shortens the pin to ground for programming.
Yes I did. I saw power consumption goes down after reset, but sketch can't restart again. ************************************************************ Begin Loop1 {l$ÜŸ|{l$ÜŸ|{l$ÜŸ|{l$ÜŸ|{l$ÜŸ| bla bla bla and here comes nothing. ************************************************************ I tried all module in my hand and I've got same result all of them (Even original ESP-WROOM-02 Espressif module). I can't understand is it version issue or serial adapter FT232
Everything works as you advised in your sketch. if you work with deep sleep. you do not need to have anything in loop. After deepsleep. the ESP sleeps and starts with a reset at the beginning of setup. So, it never reaches delay(100);
I'm terribly sorry about that. But the problem is my Tantalum Capacitor. I think the capacitor datecode is too old. I change the capacitor and everything is fine. Thanks a lot and sorry about that. :(
Hello Andreas. Quite old topic but I followed this exercise to reduce current peaks. But having 5x1000uF (electrolitic polarised) I could reduce only to 180mA. Any tips you may have?
If you connected the capacitor very close to the power pins of the ESP there are two possibilities: 1. Your measuring method or crappy capacitors. I only use one 1000uF capacitor
how do you get an esp back to live, when he, for example, isnt´ programmable anymore because of the last sketch uploaded to him contained deep sleep: "warning: espcomm_sync failed error: espcomm_open failed error: espcomm_upload_mem failed error: espcomm_upload_mem failed"
So I followed your video on deepSleep , I like your explanation but for some reason I have not seen my ESP8266 development board go into deep sleep. If I put my Fluke 87(older meter) in series with the 5v line I see .20uA , copied the sketch you posted and watched the readings. It was in Loop1 , never showed less than .20uA .So first off the math,10000000 if I reduce this number to a lower number will I see the loop2 come on sooner and then see the drop in uA ?I assume I wasn't watching the meter long enough or is there some other reason that I am missing, thanks. So I read some of your replies to others and I think I know the answer now. I am using a 12F development board and you are using a bare chip so maybe that's why I am not getting into deepSleep? Also you mentioned a cap , I did not install that either.
Andreas Spiess Tbh - The board comes with one build in. Im building a batterypack for the device, and I’d like to have a higher voltage on the batterypack. It will shorten charge time for the same amount of money. The project is for my school. I’m making 10 letters that each light up and each have 6-10 SW2812. (Along with 6x 2Ah 3,7V 18650) I’ll make it start at around 6pm and turn off at 2am. Each day with a new color. Won’t need WiFi (unless I want to turn it into a party light later haha)
Dht22 and deep sleep does not work very well. After a few cycles, the esp can no longer read the signal from the DHT22 sensor. This also happens irregularly. Do you know the problem?
Do you switch the DHT22 off druring deepsleep of the ESP? How do you power the DHT? It absolute minimum is 3.3V. Did you see this text " don't send any instruction to the sensor within one second to pass unstable status" in the data sheet of the DHT22 and is your sketch programmed like that?
Following lines before "deepsleep" seems to help: " pinMode(DHTPIN, OUTPUT); digitalWrite(DHTPIN, LOW); ESP.deepSleep (XXX); Power is stabel. I found this in the Adafruit lib in DHT.cpp: "// Now start reading the data line to get the value from the DHT sensor. pinMode(_pin, INPUT_PULLUP); delayMicroseconds(10); // Delay a bit to let sensor pull data line low." Maybe the error is here located?
Just tried the first option (was too hast to watch the whole video) and in works nicely now on Wemos D1 mini 3.0.0 - switching between 80mA and 20mA with WiFi.forceSleepBegin(); and WiFi.forceSleepWake(); both followed by delay(100), it nicely reconnects to wifi. I suppose the library and maybe something in HW was improved.
@@AndreasSpiess Yep clear thing, please do not take my comment personally (I wan never meant as criticism), I just go to your videos for help a lot and I guess I am not the only one. So wanted to help the others if they need active MCU and WiFi only once in a time. I was searching a lot and the information was somehow mixed, because of the probable change in SW or HW.
I got only 7 days from deepsleep getting The temperature outside each 10 minutes with a 18650 battery. Is there a way To extend battery Life ?? Thank you. Have a Nice day. Marc.
This is, what I thought. These boards use a lot of energy because: 1. They have a USB to Serial chip which is only used for programming 2. They usually have an AMS1117 voltage regulator which uses way too much energy during deep sleep. You need a plain ESP-12E board with a good LDO regulator. Maybe it is good to watch my video #91. And there are some other related videos in my ESP8266 playlist.
Hi, thank you for the video and the relation between the supply votlage and the deep sleep current. I'm wondering if you already test deepsleep with ESP01. Because on the web i found a deep sleep current of 78µA but with your code i have a deep sleep current of 250µA @ 3.3V and 520 µA @ 4.9V and i don't know why...
ESP01 like this: tim.jagenberg.info/files/2015/01/PTIM9823.png (512Ko) from FYI here is the hack to allow deepsleep on tim.jagenberg.info/2015/01/18/low-power-esp8266/ No voltage regulator, only a DC lab supply and a capacitor of 100µF on the supply Current measurement are performed with a multimeter AMPROBE AM-510-EUR with a accuracy of ±(1.0% Rdg + 2 LSD)
The hack is not for deep sleep, but for wake-up. Are you sure your ESP is in deep sleep? How do you check? I do not remember if the ESP-0 has a LED. There is a circle on one of the pictures you sent me. You have to remove the LED if it is always on. Otherwise I have no idea.
Sorry for the sentence, yes it is for the wakeup. I'm sure the esp is in deep sleep while it reboots and stay in sleep during the correct sleep time (and reduces the current). I have already remove the led. Perhaps it is the other black component (i don't know what it is) which has a higher sleep current than the esp8266.
when I connect D0 to RST, deep sleep mode is successfully entered & automatically wake up. it's good. but there is a problem. normal Reset is not working. for example, ESP.reset() or system reset by watchdog's bite is not working. I think Not working wdt reset is a serious problem. Do you know how to solve this?
Hi, could you check with ceramic capacitors? Electrolytics have relatively high ESR when comapred to ceramics. Could make a big difference. Maybe just 300uF ceramic would be sufficient.
+helloworld Unfortunately, I do not have such big ceramic capacitors. The biggest is 10uF. I just checked with Aliexpress. There, 220uF were the biggest I found. But they were very expensive (compared to the tantalums I use). I am also not sure if the charge of such a capacitor would be sufficient, because the peaks have a certain duration. But I am not a specialist in capacitors...
Hello Andreas, thanks for the video! Will you make another video with ceramic caps? Where exactly have the caps to be in the layout? Between VCC and GND near ESP?
Is there any way to reduce the amount of time it takes to start running a program from Flash memory after waking from deep sleep? I'm getting a delay of about 230 ms.
Hello! I need some help with a project. At first is it possible or not? ESP12f and others have a deep sleep mode. That's right! I want him to wake up every minute. To be able to connect to the server and check if I have set it to stay working or if I have not set it to work the given relay switch should continue to sleep. if I set it to turn on it turns on and runs until I turn it off. just to check every minute. The goal is to have a security camera off, but have it ready. in case I had to turn it on to have a link to it. but to save energy. If there is any other way how to do it, I would be glad if someone could share. Thanks in advance!
Remotely switching devices on and off is possible. You find a lot of useful information for your project on UA-cam. Maybe you create a diagram and search for each part independently?
Thank you so much for the response. I'll have a look on their website. I'd like to find the exact list you're using in the video as I'm working with Arduino myself.
i'm powering the board with a 3.3v power supply directly is the ams1117 stil drawing current then? What about the cp2102 is that drawing a lot of current?
Just as an update. It turns out a 12K resistor is insede the ESPs other than type S ESPs. Ie ESP8266 12E and 12F have a 12 K internally between enable ind Vcc. Out a meter on the two pins and you will see 12K. Undocumented. Sadly.
Does RTC RAM even exists? Because he(RainerOchs) is writing to the same memory offsets as you (65+). I think it's he's referring to RTC EEPROM when he says "RTC RAM". Am I correct?
Oh, ok. Thanks! Now I see... I got confused when you talked about EEPROM (emulation) on you're video #60. Then I thought that the RTC memory was in fact EEPROM. So no wear on RTC memory, great! I made a ESP clock with MAX7219 led matrix but now I want it to sleep between updates but also keep the dots blinking :) Thanks again!
+Andreas Spiess Yes, I know. I got some parts from that project :) mainly because of the rotated display. I also use those with 4 matrix on a single PCB. I'll check it out. I didn't have some of the debug functions defined so I didn't use your code (didn't bother to fix it...). But your code architecture is good.
Thanks for posting this and going into so much HW detail in your videos. Awesome work for the community.
You're welcome!
lol, I was just watching this video since I'm trying to sleep the ESP8266... then I saw my face!
Yea, you are a famous person... I learned a lot from your videos!
Thanks Andreas. Even though its 7 years old, your information here was exactly what I needed for a project I am resurrecting.
Glad it helped!
Andreas, another awesome video! Interesting AND useful! Thank you for sharing your research and discoveries.
+Hari Wiguna Thank you for your supporting comment. You as a youtuber know, how much work is in a video. And comments like yours help to keep on!
This was gold. My project needs both lower power consumption and offline storage. It had completely slipped my mind that EEPROMs have a write cycle limit, and I was going to treat it like a cache.
With the ESP chips I often transfer the data over the internet and do not save them on the chip...
@@AndreasSpiess That is my plan as well. I have a sql server with a php script that receives data via POST. My thought was to have onboard storage in case the server went offline.
I use MQTT. It should keep the messages if it cannot deliver. But I never tried how many...
Danke für die solide Faktenerhebung und natürlich schauen wir bis zum Ende (oder springen mind. schrittweise dorthin). Merci Andi
+norm1124 Danke für deinen Kommentar betreffend "Ende". Ich kriege ja eine Statistik und die sagt, dass meine Videos durchschnittlich während 3 Minuten angesehen werden. Diese Zahl ist sehr konstant seit Beginn. Das war der Grund für meinen Kommentar ;-)
I love your english, I can understand most you say while somoone with british accent is hard to understand. Helpfull tutorial
Thank you!
Thank you. A very interesting breakdown. I'm still new to arduino but it's deep dives like this make me appreciate what goes into hardware design. You video was simple and very easy to follow.
+northshorepx Thank you for your comment. This is exactly what I want. Not trivial things made easy.
As usual, you are rock star. Thank you. One suggestion, always connect GPIO2 and GPIO 0 to Vcc with 4.7K resistor. Because sometimes the ESP won't wake-up properly from deep sleep and it is termed as zoomie mode (deep sleep wakeup)
+Venkatesh E Thank you for your comment. There are many different opinions concerning how to to connect the different pins to Vcc and whether it is necessary. Pin 2 definitively has to be high according to the datasheet, but so far, I never pulled it up and had no problems.
Just a remark: During boot, pin 2 also sends some information on 75000 baud...
+Andreas Spiess thank you. Even I heard that there is something goes out on Pin 2 (TX1). Some guy connected LED to Pin-2 and keeps blinking at startup which he is not expecting that. From that I found there is something is going on, but I am not sure what it is. The 75000 is the super hint here. Thank you once again. Waiting for next video. Good Luck.
+Andreas Spiess So regarding pulling GPIO-0 (zero) high, do you think a bad power supply can cause the ESP stuck in zombie mode. Your's seems to work without that one. Please let me know if you have any information on this. Thank you once again.
Great video. I keep coming back to this to improve my understanding of esp8266 power modes.
My thought here is to build a neat GPS data logger. Boot into the low current 15mA mode when recording a track out in the field. Use some of the flash or an sd card to log. Then flick a switch and reboot into wifi mode when at home and download the nmea or kml data from a http server running on the esp8226. Would be a neat project I think. Now to find the time to make it a reality...
Keep up the great work with the videos Andreas.
+Luc Small I think, this should be possible. You can record a long trip on the SPIFFS file system in on the module itself if you set it to 3GByte. Then you do not need an SD card. And if you do not move fast, you might set it to sleep for 70-80% of the time to save even more "juice".
I am not sure if you lose the content (or the pointer to the content) if you reboot, because I never worked with SPIFFS so far.
Hello Andreas,
Thanks for all your work and sharing. I'm going to program my Google Home so it will fire up my soldering station as soon as it hears English with a Swiss accent :)
Thank you so much. Your video's are of high quality and you have excellent skills. Also didactical. Keep up the good work!
Regards,
Sounds like an interesting project ;-) Thanks for your nice words!
Thanks for the deep sleep explanation. I plan to create some humidity monitors, each using a DHT22. Now I know how to save battery power draw from my ESP8266.
Good luck with your project!
I tried the same thing, but my ESP never wakes up again... can you post your code? Thanks...
Did you connect D0 with the RST pin?
What is D0? WTD0? I have a ESP03... does it work with this board?
Then you have to connect pin GPIO16 with the reset pin. But only after upload (otherwise you might have problems with the upload iof the sketch). This connection is necessary to restart the module after deepsleep.
Great explanation. I’ll implement it as soon as I get the WiFi working. Thanks for your clear and detailed explanations.
You are welcome!
I always enhance my knowledge through your video. You people are real guru for me. God bless you...
Thank you!
I could not for the life of me figure out why my Adafruit Feather Huzzah would not wake up. The key piece of information I was missing was at 7:35 - you have to jumper RST pin to GPIO16.
Thank's for the great video!
You are welcome. Glad it helped.
Thank you for this and all your videos. I love your channel, your videos are great and full of needed information!
+Martin Taťák You are welcome. A new video about the sleeping ESP is in the works...
what a brilliant video. than you so much, ive been having trouble with one of my projects and your video showed me how to sort it out so thank you from me and my brain(which was really hurting lol). :)
Glad it helped!
2200uF is the best ESP8266 trick ever !
+Wild in the jardin Thanks! By the way: I used a 10mH inductor andgot the same effect.
Thank you for your very informative videos. Did you use the 10mH inductor in combination with a de-coupling capacitor to Vcc? If so, what was the capacitor's value? If not, how was the inductor connected?
Very informative thanks. I have a slightly different situation where I have an ESP8266 connected to an Arduino Pro mini. I use the pro mini for various reasons and can get it's power extremely low. The ESP is programmed with AT Command firmware and I can put it into SLEEP and DEEP SLEEP. I plan to have the pro mini trigger the RST or CH_DP pins
You could also use the Arduino to cut the power of the ESP to save even more (with a FET transistor)
Danke für Ihre professionellen Videos!
Bitte, gern geschehen!
Finally got it working on ESP. By the way, to fix the "Unable to load issue, It seems a resistor goes between IO16 and Reset. If you use a link(as I did) you can't program the chip unless you remove the link. I am using a 1K. Lower resistors should work as well. Thanks again for your Vids Andreas.
This connection resets the chip which makes that the whole chip is disabled
One thing you missed is modem sleep. It allows wifi to stay connected. Just use wifi_fpm_set_sleep_type(MODEM_SLEEP_T); then a delay(1000) in your main loop. For me this uses between 15ma and 70ma but I don't have an accurate way to measure it
I never used modem off so far, because I had no need for it. It does not save enough for battery powered devices and current consumption does not matter too much for devices connected to mains.
Thanks for the Video! For me, it would have been interesting to see the peaks with a common battery type.
They have to be the same. Otherwise the ESP would crash.
I highly doubt it'd look the same, but I also can not disprove it. The battery would behave more closely to a capacitor, thus smoothing the peaks ... at least that's what I think it'd look like.
@@josuaschmid501 The current flow is decided by the ESP (the load). If the ESP does not get the required current, the voltage will drop (ohms law), and the ESP usually crashes. A well-known problem. The best is you try. No need to believe me.
Awesome videos Andreas. Thanks for sharing your knowledge.
You're welcome!
Congrats for all your videos. Still prefer esp8266 to ESP32 for most applications. Hope that you will continue those interesting videos on this chip. Bye.
Most of my videos are not chip specific.I sometimes use an ESP8266 because I still ahve lots of them laying around and they are good enough for most applications.
Andreas another great video. Thank you.
Have you ever considered or tried using a MOSFET to bypass the regulator under ESP control? The idea wouldl be that when the battery voltage was low enough the regulator could be shorted out by applying a GPIO signal to a FET. Then the full battery voltage would be available to the system, and the regulator losses would be eliminated.
In a deep sleeping system, the fact that the battery voltage was low enough to allow regulator bypass could be saved so that it woke up that way.
Just an idea.
This is possible, but quite complicated. And you lose your only ADC on the ESP. I did not test, but the last few mV are not very valuable because at the end, voltage drops quite fast. Also dropout voltage of a HT7333 3.3V is only 150mV.
I also not tried the accuracy of the ADC of the ESP at variable Vcc. The Arduinos use Vcc as a reference. So, the ADC readings are not very stable when you change Vcc (video #10 shows that plus a trick).
OK thanks
Interestingly many people recommend to use a low ESR type capacitor to reduce brown out risks. However I see the problem of high leakage currents with low ESR capacitors (>200 uA depending on capacity) which is really bad for battery powered applications. Normal capacitors seem to be quite ok and give the same results for me, with a leakage current of 60 minutes as leakage current drops after time)
You are right. I learned about this fact after I made this video.
This is a fantastic video! Really helped me with a project.
Great explanation! Thanks you very much!
Really great and professional review. thank you!
You are welcome!
It would be interesting to see the esp8266 used in old weather applications. I wonder how - 20 Celsius would affect it's performance
I once planned to test the ESP in cold and warm conditions. Winter is coming fast here. Maybe I find once the time to do it...
Very informative, I have been using the esp8266 for some sensors and experienced exactly what you show here, I do not have an oscilloscope so it was (not) great to see those spikes. Another obvious power saver is to switch it on when needed ie pressure on a scale, external switch etc. Have you looked at the meshing the esp yet? that might be useful for larger deployments maybe?
+Peter 1. Retief Swich it on and off is good if you want to use it on battery and only switch it on once a day or so. Videos about that are in the works...
2. No, I did not look into meshing it (i understand mesh as a network of many ESPs). I think, 2.4GHz is great if you have a WiFi network around. For independent sensor meshes I prefer for the moment sub GHz RF modules. Also there, a video should come in summer (it is a lot of work...)
Andreas, thank you for this video!
We do get it:) You seem to really like playing with your wifey :)
Awesome video, and well explained! It is a pleasure to watch your videos. I am currently thinking about buying a digital oscilloscope for tinkering around with ESP8266. I see that you use a SDS 2012. Do you think that 1GB sampling rate with 70 MHz gives a sufficient resolution to see the power spikes? Thanks for your great contributions!
+Thomas Mittag Thanks for your comment! The spikes were not complicated to see, they are about 1 microsecond, if I remember right.
Concerning the oscilloscope: I bought mine three years ago (it is actually a SDS 2102) and I bought the best I was able to get for my budget (1000$) then. Since I am a tinkerer, not a professional with a project I had no idea what I will need in the future. So, the budget was the deciding factor for me. So far, I am happy with the Siglent brand. I just bought a spectrum analyzer and a waveform generator from them.
This helped a lot. Thank you.
+LaLaObeRoT you are welcome!
When learning about the ESP8266 I keep ending up at your videos. They seem to cover everything I search for.
+Tim Jadeglans Thank you for your compliment!
Great work! have you decided on a specific regulator to use in conjunction with the 1000-2200uF caps?
Thank you for the very informative videos Andreas. You mention below that you used a 10mH inductor with the same effect of the 1000-2200uF cap. How did you connect the inductor (in addition to a cap or from supply+ to Vcc alone)?
If I remember right, I used the inductor instead of the capacitor. The inductor has to be connected in series in the power line either in the plus or the minus cable. It does not matter which.
Maybe a combination of both would be the best solution, but I did not check.
Thank you for a wonderful and informative channel. I have subscribed.
One question I have on "deep sleep" - the sensors themselves also draw current, correct? I've seen a lot of focus on how to get our MCUs to behave, but what do we do about the sensors themselves? For example, a simple capacitive soil moisture sensor datasheet mentions 5mA current. Some of these sensors even have their own voltage regulators, drawing extra current. If we bully our poor ESPs into the micro-ampere sleep states, this does not help if our sensors still drain our batteries.
Do you have a video on workarounds for this? I'm still starting going through all your posts, so maybe there is, but I've not found it yet.
Thanks in advance, and thanks again for the great channel.
You can feed a sensor with an output pin, for example. Then it should not consume a lot of power when the MCU is sleeping.
@@AndreasSpiess Thank you so much for your fast response. How simple! :-) Kind regards
Keep up the good work Andreas! Just one small pronunciation thingy: wifi is pronounced more like weyefeye /ˈwaɪ.faɪ/ (like hi-fi) and rhymes with things like pie and dye :)
Thanks. In the newer videos I changed it. I used the German pronunciation, but learned it now.
Ah I see, well you sure do make great video's. Really interested in everything there is about the ESP8266 at the moment and subscribed to your channel ;)!
I saw it on my subscriber counter ;-) Thanks!
Mr. Andreas, first, thank you for sharing your knowledgement and I like your peculiar way of teaching, it´s very clear and understandable. Second, can you help me in a doubt ? Have you ever measured the amps consumption of an ESP8266 with a decoupling capacitor of 1000uf 6v in deep sleep mode ? And then, take the capacitor out and measure again... Can you do this test for me ? Because I did, and with the capacitor even in deep sleep it draws 150uA... With out the capacitor it draws 3uA. Can you confirm that ? is there a way to use the capacitor, but keeping the consumption in 3uA ? PS: I am powering ESP with two AAA batterys... Thank you very much !
I am travelling and have no module and capacitor handy. You can do this yourself by just measuring the capacitor without a module. If it uses the difference, then it is the cause.
Pay attention that you wait a long time before you measure, because the capacitor is loaded over an exponential curve and this takes long. It is possible that you just measure some loading current. If the capacitor does not take the current, write a sketch which leaves the esp in deep sleep for one hour and measure.
+Eduardo Zola you decide with the calls you described in which mode the Esp will wake up. So, you know. The Esp should not chang this mode itself.
I do not know of such a function.
If you are in doubt if the calls really work, measure the current.
That's probably the leakage current of the capacitor. Tantalum?
Thanks. It was very well explained
:-)
Thanks for going into detail! Also, how do you put the ESP into Light Sleep?
I never tried light sleep
Thank you Andreas, great Video.
is the current consumption same when using ESP.deepSleep(x,WAKE_RF_DISABLED) and ESP.deepSleep(x,WAKE_RF_DEFAULT).?
if not please mention the current consumption for both these modes.
I never used these modes. Please do not use a development board. Use a plain ESP-12 for your power experiments.
You are great, thanks. I love your video about powerconsumption and bateries. I hav a project with NodeMcu 12E and in deep sleep I still use about 70mA, so my batery lasts about 4-5 months and it shoul last much more in deep sleep because I do work every 20minutes, send data tu database and then go to deep sleep 20minutes. I simpley cant have about 20 micro ampers. I connect GPIO0 to 3.3, GPIO15 to GND, RST pin and EN pin connected to Vcc, GPIO16 to RST. Can you please help. Thanks
So if you use a large capacitor to reduce the current spikes in order to be able to use a lower current regulator, how do you deal with the inrush current when the capacitor is initially charging?
A small regulator usually cannot deliver a high current (because it has a high internal resistance or a protection circuit), that is the problem I want to solve with the capacitor. So, I think, the inrush current will be limited by this fact.
It won't damage the regulator? I'd like to use a MCP1700. Datasheet shows max output current at 250mA, but output short circuit current at 408mA, which is way above the 250mA spec.
bkhofmann so, you see, you could even short cut the regulator without harm, because it is protected
Thanks for the reply, and thanks for all the great videos! I look forward to them!
be careful when using big capacitors (>1000 uf depending on your max current and wire dimensions) which leads to slow VCC rampup. It happened to me that at powerup the rampup of the 3.6V VCC voltage was so slow that the ESP startet without WIFI properly working. The reason is that when rampup is too slow due to limited inrush current, the ESP core starts running (e.g. at 2.5V or even lower) but WIFI cannot initialize correctly at that time because it needs higher voltage for calibration. It is not always "the more the better" :-)
Great video. It got me going on my first ESP project. I got WiFi sleep to work. turning it off and then on again and getting 18mA average draw. I would like to get light sleep to work and half that draw again. I am polling a sensor every 10 seconds, and deep sleep isn't the best way to tackle that.
WIFI sleep code:
#include
void setup() {
wifi_set_sleep_type(MODEM_SLEEP_T);
}
void WifiStart(){
WiFi.forceSleepWake();
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
}
void WifiStop(){
WiFi.disconnect();
WiFi.mode(WIFI_OFF);
WiFi.forceSleepBegin();
}
Thanks for the snipplets. Another possibility could be to use RTC memory as presented in my video #60
Hi. WiFi.mode(WIFI_OFF); and WiFi.forceSleepBegin(); both worked with an active connection for me.
WiFi, pronounced WhyFiii (iii, as in I), not WhyFeee ;)
Cheers for the informative videos!
Andreas - Excellent Video and Loved your thorough explanations... I have
tried this with an ESP8266 - 01, however, it seems I over-looked the
need for access to GPIO16... Doesnt seem available.. My experiment was
to place these in a wearable package for my pets to track them through
the day... Using Signal Strength and several other ESP8266s thoughout
the house...but, battery consumption is a problem, it seems the 12E is
the only option, correct? Or do you have an idea on how to better track a
pet through the house...
Did you use deepsleep?
Hello Andreas, I tried the Deep Sleep, but I am not using 12E, using the ESP8266 - 01 Module, but maybe need to order a couple of the 12E versions,,, Since GPIO16 is not accessible on the Module..
Yes
Hello Andreas, I didn't understand exactly how you connected the Capacitor.
Is it between max 4.2 and ground from the battery or between VOut of the LDO and ground?
Where did you solder + of the capacitor If it's between the LDO Vout and ground?
The big cap is between Vcc and GND of the ESP. I solder it on the module itself
@@AndreasSpiess Thank you!
My projects wouldn't have been possible without your help :)
Thank you for all of your video's. They explain all details very well. One question though on deepsleep. I'd like to wake my esp8266 from deepsleep from an external interrupt (button press). I thought I could just connect vcc via a resistor with a button to ground and T from between the resistor and button to the RST input to put an interrupt event on the RST input. But that does not seem to reset the device. Is the D0 - RST connection still needed in that setup? Any thoughts on that?
If you pull the RST pin low and high again, the ESP boots. I just tried it with my NodeMCO board. So, you connect a 5-10k resistor from VCC to RST to keep it high and a push button between RST and GND. Then, you should get what you want. Just connect serial monitor to check. The module always have to be powered.
It seems to have been a case of the syndrome that you can look at a situation for a long time, but don't spot what you've done wrong. I now see that I had the resistor connected to GND as well. Thank you very much!
You only learn from errors ;-)
Great video :) cant wait to see part 2 :)
+Ejal Nvt You have to wait a few days. It is right now in the video editor...
+Andreas Spiess I think I can speak for everyone, we are just very grateful for the time and effort you put in all your videos. Video editing is a lot of, sometimes frustrating, work. So thanks again and keep up the good work!! Kudos!
You are the best on youtube..:)
Thank you!
Amazing! thanks for the great analysis :)
You are welcome!
Hey Andreas! Very interesting video. For my project i need a sensor to wake up the ESP from deep sleep. Is this also possible? Or is timing the only way to handle it?
Maybe you look also at the EXP32. It has many more possibilities for wake-up. Here, the only possibility is using the reset pin.
Thanks for the deep sleep explanation. Is there any video explaining Light Sleep in detail? I am new to ESP so I have few questions. If ESP8266 does Light Sleep automatically or if we have to do it manually with WiFi.forcedSleepBegin()? If it is useful to use forced light sleep or should I go with deep sleep always?
I never used the light sleep and I do not know, if it works. A few mont ago, I read, that it did not work properly. Its effect on power consumption is also not that big, similar to switching off the WiFi.
Thanks for replying. Another thing, if I use ESP.deepsleep(time,WAKE_RF_DISABLED) then on reboot, my wifi will be OFF. Right ? then how can I enable it again ? for example, 1 out of 10 times I want to enable Wifi.
That is not trivial. Because the ESP boots after deepsleep, you lose all your varialbes, also your counter. In some of my videos I solved this problem using the RTC memory. But I would start first simple and add complications afterwards
can i use 1k micro farad capacitor with my ESP-32 as well?
Yes
Hi Andreas, Interesting tutorial. I measured current comsumption in an ESP-12F and detected picks of 500mA. Have you ever tested this model? It's rather weird, because I did not find any reference about diferent current consumtion among esp8266 models.
No, I do not own one. And I am also not completely sure if I measured the the real peak current of the 12E's correctly. I was satisfied with the results then. How did you test?
I used the same method for testing that you have used. I think the higher current comsumtion is related to the improvement in the RF module of 12F.
That was really helpful. Thank you alot. I am running a NodeMCU 12E from a Li-ion 3.7 battery. First I connected the battery directly to 3.3 pin and the deep sleep works and cosumes 115 micro ampere current. Then I stepped down the voltage form the battery using mcp1700 votlage regulator which has a quiescent current 1.5 micro amp but the promblem is that in deep sleep mode the consumed current rises to 1.5 mili amps. Then I tried to run the board from the Vin pin which is 5v in my board but it did not work at all. Any help or advice to reduce power cosumption during deep sleep would be appriciated.
Thank again for your effort on your videos.
Most development boards cannot be used with deep sleep because their power consumption is too big. This is why I used a barebone module. Some ESP32 boards are a little better. I made some test videos.
@@AndreasSpiess Thank you for your response. I will take a look on the videos.
I was looking at the function of CH_PD pin, CHip select Power Down a pin that active low brings the who chip in a restart mode. It seems that this pin reduces the current till micro amps. It seems to be similar to deep sleep mode.
You are right.
I get 0.17 mA on my multimeter when esp8266 is in deep sleep, please help!
Unfortunately I cannot do remote debugging.
@@AndreasSpiess I use wemos d1 mini, is that the problem? V3
yes, if you want small currents you have to use an ESP-12 module alone
@@AndreasSpiess Thank you!!! I was struggling so hard to find answer! I thought my wemos was faulty!
Hello I am measuring the current consumed by a NodeMCU (module ESP-12E), connect a resistance of 1 ohm in series with the power supply and 200mV peaks appear every 100ms that these peaks are due.
With this configuration, you measured the operating current, not the deep-sleep current.
sehr schön erklärt, vielen Dank!
+Peter Leder Bitte. Gern geschehen.
Thank you for great videos on the ESP8266. Have you found a way to enable RF after waking up from ESP.deepSleep(microsec, WAKE_RF_DISABLED)? Seems like forceSleepWake() does not do the trick. The only way I can get wifi working again is to do another deep sleep with RF_CAL, which is not optimal.
To my knowledge, you have to decide whether you want to use WiFi after your wake-up, as you described.
The only way I've found to get it to use the modem after deepSleep(..., WAKE_RF_DISABLED) is these 3 commands before WiFi.begin() inside the loop() of the sketch:
WiFi.forceSleepBegin();
delay(100);
WiFi.forceSleepWake();
... do something ... I have several println here
WiFi.begin(...
If I try just the WiFi.forceSleepWake() it does not work.
Hope that helps. I found this through trial and error.
Hi Andreas! I run more and more ESP's on 5V now, especially since Espressif made their comment regarding 5V tolerance. Have you ever tested what happens to the current spikes when running an ESP-12, ESP-01 or similar on 5V?
I hope you mean on the input pins, not on Vcc ;-). Because the statement of Espressif was only for these pins.
Input pins should not produce any current spikes.
Thank you for your reply Andreas! No, running *many* devices on 5V (VCC). Even running them om 5.2V. And, yes, ESP-01, ESP-07 and ESP-12 VCC (no regulator). Guessing then that you have not tested this on your oscilloscope? Cheers, Mike!
And I probably will not test it because I do not see a reason to violate manufacturers recommendation here. Vcc max for the ESP chip itself is 3.6 volt. But it is good to know that it also runs on 5.2 volts...
Good walk through.
I have an odd experience with a bare ESP12E, I haven't connected RST and GPIO16 as i want it to go to sleep until it will be power cycled. but after the sleep-time ran out, it blinks the blue led and draw 8 mA??
if i use ESP.deepSleep(0); it dosn't wake up, but then you can ONLY wake it by reset.
Quistion: When it wakes up, i can see it is booting @74400baud, but it doesn't run my code, so what are it doing?
1. Maybe you watch my video #108.
2. The ESP always runs your code if you reset it. the messages @ 74400 are not important. It has nothing to do with deepsleep
Andreas, may I ask how you setup your scope to measure current. Do you require different probes? Are there any dangers to measuring current? I have recently purchased a rigid Ds1104DZ and still learning the basics. Your direction would be gratefully received.
Thank you
+Dean Greenhough It is quite easy: As you see in the video I put a 1 Ohm resistor in the GND line. With the oscilloscope you just measure the voltage on that resistor and calculate the current according ohm's law. Maybe you watch the video again with this explanytion you will see the explanation.
There is a danger of a shortage: Your oscilloscope has usually GND connected to Earth. If your device has also a connection to earth you can create a shortcut in your device. This is why I put the resistor in the GND line. Then I can connect GND of the oscilloscope to GND of my bench power supply. No problem. You will also have no problem if you power your device from battery because then you have no connection to earth.
This danger exist always, not only during measurement of current!
Hope, this helps.
+Andreas Spiess
my apologies for writing a post, before I re watched your video. Your explanation is clear and I have reached a better understanding, thank you.
I do have one question:
The 1ohm resistor, I assume I will need a resistor like this? I assume this will get pretty warm. Do you advise only running this for a limited amount of time?
Thank you so much for your time
www.ebay.co.uk/itm/like/391374624389?limghlpsr=true&hlpv=2&ops=true&viphx=1&hlpht=true&lpid=122&chn=ps&googleloc=1006959&poi=&campaignid=207297426&device=c&adgroupid=13585920426&rlsatarget=pla-142405555266&adtype=pla&crdt=0&ff3=1&ff11=ICEP3.0.0-L&ff12=67&ff13=80&ff14=122&ul_noapp=true
+Dean Greenhough The power dissipation of a resistor can be calculated by the formula: P = I x I x R. If yor device draws a current of 1A the power rating for the resistor is: 1A x 1A x 1 ohm = 1 Watt. Normal resistors are 1/4 Watt and therefore should be good for 0.5A. So, yours is ok for quit big currents.
This video has absorbed me for the whole weekend, I have learned so much, but aware of just how much I don't know. Thank you Andreas for your guidance and patience. I am awaiting a 1ohm power resistor so I can replicate your work on the ESP.
In sleep mode the current drawn is shown as 60uA and not 600uA
Great great great tutorial !
Worked pretty well for me but I still have kind of 0.5mA in Deep Sleep do you have any idea from where it could come from ?
Thanks again so much for what you're doing !
From somewhere around the ESP8266 (LDO or other chips) ?
Hi Andreas, thanks a lot for your quick answer ! Actually I use the same chip than yours, this is why I found it ackward, a classic esp8266 esp12e. I will open the metaliic case of a broken one. I just feel it's in Light Sleep when I ask a Deep Sleep.
Do you have any idea on how to stop the CPU by hand ? ( by command in fact )
Thanks a lot !
Oh maybe the module adapter has 3 resistances I'll check without any of those
Are you sure you measure right? These are quite small currents. You can reset the chip with the rest pin to check.
Hi Andreas ! I'm actually checking the amperage going out from an arduino UNO 3.3 Volt output,it was the only thing I had under my hand. I've put a capacitor and it worked fine, but when I tried withtout, I had the luck to hear a small "gritziik" which told me I had to try with another board. I'll try with a real power supply tomorrow.
I definitely believe that a low power consumption timer should exist in another way ! I'll keep you informed in anyways, thanks so much for your answer
Anyone have an idea why deep sleep would cause erratic behaviour? I'm using a Wemos D1 mini wich is based on the esp8266, and when I use deep sleep the timing at wich thingspeak receives data becomes randomised to a certain extent, without deep sleep the transmission delay is a very tight 30 seconds but with deep sleep theres suddenly a 5 second variance. It also seems after every 3-4 transmissions the data gets messed up because thingspeak receives an entry but it's not displayed on the chart. Any ideas would be greatly appreciated!
1. Because the ESP boots after deep-sleep it has to connect to WiFi. Which takes sometimes longer.
2. Look at the maximum posting rate of Thingspeak. Maybe 5 seconds are not allowed in the free plan.
Grüß Gott Andreas, with reference to the scheme @ min 7'40", how is the switch at GPIO0 operated (to flat firmware or to upload a sketch)? I mean, when is the pulp or pull down activated?
There is a bit of confusion out there, perhaps because "pin" and "GPIO" are used interchangeably.
Happy and creative 2018
GPIO means General purpose Input/output. These are pins which can be used for this purpose (other than Ground or Vcc pins).
During power-up, GPIO0 pin has to be high (3.3 volts) if you want to run the sketch. If it is low, the ESP programs its flash memory.
To be sure it really is 3.3 volt, we use pull-up resistors to 3.3 volts. A button switch shortens the pin to ground for programming.
Thx
Thx for the awesome series of videos, from which I learned a lot!
My sketch reset after 10sec sleep command. But not start again, loop1 didn't shown after sleep?
+Signal Elektronik did you connect pin16 with reset?
Yes I did. I saw power consumption goes down after reset, but sketch can't restart again.
************************************************************
Begin
Loop1
{l$ÜŸ|{l$ÜŸ|{l$ÜŸ|{l$ÜŸ|{l$ÜŸ| bla bla bla
and here comes nothing.
************************************************************
I tried all module in my hand and I've got same result all of them (Even original ESP-WROOM-02 Espressif module). I can't understand is it version issue or serial adapter FT232
+Signal Elektronik what is your sleep command? What happens if you reset automatically after 5 secons?
Everything works as you advised in your sketch. if you work with deep sleep. you do not need to have anything in loop. After deepsleep. the ESP sleeps and starts with a reset at the beginning of setup. So, it never reaches delay(100);
I'm terribly sorry about that. But the problem is my Tantalum Capacitor. I think the capacitor datecode is too old. I change the capacitor and everything is fine. Thanks a lot and sorry about that. :(
Hello Andreas. Quite old topic but I followed this exercise to reduce current peaks. But having 5x1000uF (electrolitic polarised) I could reduce only to 180mA. Any tips you may have?
If you connected the capacitor very close to the power pins of the ESP there are two possibilities: 1. Your measuring method or crappy capacitors. I only use one 1000uF capacitor
how do you get an esp back to live, when he, for example, isnt´ programmable anymore because of the last sketch uploaded to him contained deep sleep:
"warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed"
Maybe you google. Your ESP might be up, but not in programming mode.
So I followed your video on deepSleep , I like your explanation but for some reason I have not seen my ESP8266 development board go into deep sleep. If I put my Fluke 87(older meter) in series with the 5v line I see .20uA , copied the sketch you posted and watched the readings. It was in Loop1 , never showed less than .20uA .So first off the math,10000000 if I reduce this number to a lower number will I see the loop2 come on sooner and then see the drop in uA ?I assume I wasn't watching the meter long enough or is there some other reason that I am missing, thanks.
So I read some of your replies to others and I think I know the answer now. I am using a 12F development board and you are using a bare chip so maybe that's why I am not getting into deepSleep? Also you mentioned a cap , I did not install that either.
Development boards consume much more power. This is why I use a bare ESP8266 board.
If I'm reading the meter correctly, starting at 9:31, that is only 60 micro amps, not 600.
You are right!
Thanks! That was awesome!
:-)
What if I use a ESP8266 board that can take up to 20volts? Do you reckon the deep-sleep power consumption will be very high?
Depends on your voltage regulator.
Andreas Spiess Tbh - The board comes with one build in. Im building a batterypack for the device, and I’d like to have a higher voltage on the batterypack. It will shorten charge time for the same amount of money.
The project is for my school. I’m making 10 letters that each light up and each have 6-10 SW2812. (Along with 6x 2Ah 3,7V 18650) I’ll make it start at around 6pm and turn off at 2am. Each day with a new color. Won’t need WiFi (unless I want to turn it into a party light later haha)
Dht22 and deep sleep does not work very well. After a few cycles, the esp can no longer read the signal from the DHT22 sensor. This also happens irregularly. Do you know the problem?
Do you switch the DHT22 off druring deepsleep of the ESP? How do you power the DHT? It absolute minimum is 3.3V.
Did you see this text " don't send any instruction to the sensor within one second to pass unstable status" in the data sheet of the DHT22 and is your sketch programmed like that?
Following lines before "deepsleep" seems to help:
" pinMode(DHTPIN, OUTPUT);
digitalWrite(DHTPIN, LOW);
ESP.deepSleep (XXX);
Power is stabel.
I found this in the Adafruit lib in DHT.cpp:
"// Now start reading the data line to get the value from the DHT sensor.
pinMode(_pin, INPUT_PULLUP);
delayMicroseconds(10); // Delay a bit to let sensor pull data line low."
Maybe the error is here located?
If it works, it is ok. It is always hard for me to remote-diagnose tricky problems. There are many possibilities for something to go wrong.
Just tried the first option (was too hast to watch the whole video) and in works nicely now on Wemos D1 mini 3.0.0 - switching between 80mA and 20mA with WiFi.forceSleepBegin(); and WiFi.forceSleepWake(); both followed by delay(100), it nicely reconnects to wifi. I suppose the library and maybe something in HW was improved.
This is an old video, so we can assume that thins changed since then.
@@AndreasSpiess Yep clear thing, please do not take my comment personally (I wan never meant as criticism), I just go to your videos for help a lot and I guess I am not the only one. So wanted to help the others if they need active MCU and WiFi only once in a time. I was searching a lot and the information was somehow mixed, because of the probable change in SW or HW.
Great video!!! 👍✨
Thank you!
I got only 7 days from deepsleep getting The temperature outside each 10 minutes with a 18650 battery. Is there a way To extend battery Life ??
Thank you.
Have a Nice day.
Marc.
Which board did you use?
Andreas Spiess nodemcu v1
This is, what I thought. These boards use a lot of energy because:
1. They have a USB to Serial chip which is only used for programming
2. They usually have an AMS1117 voltage regulator which uses way too much energy during deep sleep.
You need a plain ESP-12E board with a good LDO regulator. Maybe it is good to watch my video #91. And there are some other related videos in my ESP8266 playlist.
Hi, thank you for the video and the relation between the supply votlage and the deep sleep current.
I'm wondering if you already test deepsleep with ESP01. Because on the web i found a deep sleep current of 78µA but with your code i have a deep sleep current of 250µA @ 3.3V and 520 µA @ 4.9V and i don't know why...
Which module do you use? Any voltage regulators?
ESP01 like this: tim.jagenberg.info/files/2015/01/PTIM9823.png (512Ko) from FYI here is the hack to allow deepsleep on tim.jagenberg.info/2015/01/18/low-power-esp8266/
No voltage regulator, only a DC lab supply and a capacitor of 100µF on the supply
Current measurement are performed with a multimeter AMPROBE AM-510-EUR with a accuracy of ±(1.0% Rdg + 2 LSD)
The hack is not for deep sleep, but for wake-up.
Are you sure your ESP is in deep sleep? How do you check? I do not remember if the ESP-0 has a LED. There is a circle on one of the pictures you sent me. You have to remove the LED if it is always on.
Otherwise I have no idea.
Sorry for the sentence, yes it is for the wakeup. I'm sure the esp is in deep sleep while it reboots and stay in sleep during the correct sleep time (and reduces the current). I have already remove the led.
Perhaps it is the other black component (i don't know what it is) which has a higher sleep current than the esp8266.
when I connect D0 to RST, deep sleep mode is successfully entered & automatically wake up. it's good. but there is a problem. normal Reset is not working. for example, ESP.reset() or system reset by watchdog's bite is not working. I think Not working wdt reset is a serious problem. Do you know how to solve this?
I am not sure if this is true. Did you check it?
@@AndreasSpiess yeah sorry it is just my fault
Please help me my esp8266 going to the sleep but current consumption 7.4 miliamps please help me what to do
Maybe you use a development board which has many more components which consume current.
Hi, could you check with ceramic capacitors? Electrolytics have relatively high ESR when comapred to ceramics. Could make a big difference. Maybe just 300uF ceramic would be sufficient.
+helloworld Unfortunately, I do not have such big ceramic capacitors. The biggest is 10uF. I just checked with Aliexpress. There, 220uF were the biggest I found. But they were very expensive (compared to the tantalums I use).
I am also not sure if the charge of such a capacitor would be sufficient, because the peaks have a certain duration. But I am not a specialist in capacitors...
+Andreas Spiess It need not be a single ceramic cap of 300uF. 100uF is available for
+helloworld Ok. You convinced me. I ordered some 100uF and will try it.
Great! :)
Hello Andreas, thanks for the video! Will you make another video with ceramic caps? Where exactly have the caps to be in the layout? Between VCC and GND near ESP?
At 1:00 there are three resistors R1, R2, R3. Which do I have to use?
Not critical. 1 - 10k or even higher.
Andreas (or anyone else reading), do you know how to "deep sleep" an ESP for more than one hour? I want my ESP only to wake 3 times a day.
+Ejal Nvt Yes. Tomorrow you will see a video coming. And if all goes well, next week another one for exactly this topic.
Is there any way to reduce the amount of time it takes to start running a program from Flash memory after waking from deep sleep? I'm getting a delay of about 230 ms.
I do not know, but I never investigated into it.
Tried this using ESP now. No luck so far.
One node has to be always powered on.
They wifey module, haha :D Very funny accent! Very informative video!
Thank you!
Maybe a silly question but how do you connect the capacitor ?
Plus to Vcc of the ESP-12 module and minus to GND
Hello!
I need some help with a project.
At first is it possible or not?
ESP12f and others have a deep sleep mode. That's right!
I want him to wake up every minute. To be able to connect to the server and check if I have set it to stay working or if I have not set it to work the given relay switch should continue to sleep. if I set it to turn on it turns on and runs until I turn it off. just to check every minute.
The goal is to have a security camera off, but have it ready. in case I had to turn it on to have a link to it. but to save energy.
If there is any other way how to do it, I would be glad if someone could share.
Thanks in advance!
Remotely switching devices on and off is possible. You find a lot of useful information for your project on UA-cam. Maybe you create a diagram and search for each part independently?
Hi, where can I get the list of ESP-specific APIs?
It depends on the programming framework. Espressif's homepage would be a good beginning...
Thank you so much for the response. I'll have a look on their website. I'd like to find the exact list you're using in the video as I'm working with Arduino myself.
My ESP8266 still draws 10mA with the same sketch. How can i fix this so it'll be 20uA?
+Guus van Marle Is it a NodeMCU or wemos board?
Andreas Spiess it's a nodemcu board.
+Guus van Marle You have to use a bare ESP-12 board. The NodeMcu have too many parts which consume current
i'm powering the board with a 3.3v power supply directly is the ams1117 stil drawing current then? What about the cp2102 is that drawing a lot of current?
thanks (I got the reply from you late)
thanx ,very usefull
+somood safady You are welcome!
Just as an update. It turns out a 12K resistor is insede the ESPs other than type S ESPs. Ie ESP8266 12E and 12F have a 12 K internally between enable ind Vcc. Out a meter on the two pins and you will see 12K. Undocumented. Sadly.
I assume it should prevent unscheduled reset. I assume it is included in the deep-sleep current consumption because you cannot remove it.
Thank you ;-) Vielen dank
You are welcome.
Does RTC RAM even exists? Because he(RainerOchs) is writing to the same memory offsets as you (65+). I think it's he's referring to RTC EEPROM when he says "RTC RAM". Am I correct?
+Rui Rex There is no RTC EEPROM, only RTC RAM
Oh, ok. Thanks! Now I see... I got confused when you talked about EEPROM (emulation) on you're video #60. Then I thought that the RTC memory was in fact EEPROM. So no wear on RTC memory, great!
I made a ESP clock with MAX7219 led matrix but now I want it to sleep between updates but also keep the dots blinking :) Thanks again!
+Rui Rex this is how I do it with my UA-cam subscribers counter
+Andreas Spiess Yes, I know. I got some parts from that project :) mainly because of the rotated display. I also use those with 4 matrix on a single PCB. I'll check it out. I didn't have some of the debug functions defined so I didn't use your code (didn't bother to fix it...). But your code architecture is good.
:-)