{"id":238046,"date":"2021-03-19T21:24:51","date_gmt":"2021-03-19T20:24:51","guid":{"rendered":"https:\/\/emariete.com\/?p=238046"},"modified":"2021-03-19T21:24:51","modified_gmt":"2021-03-19T20:24:51","slug":"espeasy-deep-sleep-esp8266-low-consumption","status":"publish","type":"post","link":"https:\/\/emariete.com\/en\/espeasy-deep-sleep-esp8266-bajo-consumo\/","title":{"rendered":"ESPEasy and deep sleep mode (ESP8266 low power consumption)"},"content":{"rendered":"<p class=\"wp-block-paragraph\">The ESP8266 microcontroller <strong>is very well prepared to make the best use of energy<\/strong>with very low power consumption modes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For many people, these low-power modes seem like issues. <em>mystical or occult<\/em>The most important thing is that it is within the reach of very few people. <em>elected<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here you will see that<strong> with ESPEasy are very easy to use.<\/strong> and that will allow you to <strong>huge energy savings<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-que-es-el-modo-deep-sleep\">What is deep sleep mode?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The deep sleep mode of the ESP8266 means that the microcontroller goes into a deep sleep mode, with <strong>virtually all off<\/strong>except for a very small part of the microcontroller that checks if this happens. <em>\"something\"<\/em> which should cause the rest of ESP8266 to wake up, coming out of its lethargy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An ESP8266 in deep sleep mode (sleeping, and waiting for <em>for something to happen<\/em>The ESP8266 (the ESP8266 is used to wake up) can consume as little as 8 to 20\u00b5A (1 mA = 1000 \u00b5A) while a NodeMCU board with its ESP8266 in deep sleep mode consumes 8-20mA. That is <strong>500 to 1000 times more!<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you are interested in the topic of low power consumption, I recommend that when you finish reading this article, you read this one. Here you will find all the basics you need to know to reach the low power Olympus with ESP8266:<\/p>\n\n\n<div class=\"gb-container gb-container-6882cc7f\">\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-emariete wp-block-embed-emariete\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"l33LFWRqwb\"><a href=\"https:\/\/emariete.com\/en\/experiments-with-speasy-sp8266-and-low-consumption-v1-0\/\">Experiments with ESPEasy (ESP8266) and low power - v1.0<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&quot;Experiments with ESPEasy (ESP8266) and low power - v1.0&quot; - eMariete\" src=\"https:\/\/emariete.com\/experimentos-con-espeasy-esp8266-y-bajo-consumo-v1-0\/embed\/#?secret=sVgNvDtshf#?secret=l33LFWRqwb\" data-secret=\"l33LFWRqwb\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n<\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-que-necesito-para-utilizar-el-modo-deep-sleep-del-esp8266\">What do I need to use the ESP8266 deep sleep mode?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You need two things: a complex <em>hardware <\/em>external precision that allows the microcontroller to go into a coma and a complex <em>programming<\/em>The new, almost undecipherable, even for the best programmers in the world.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-el-hardware-para-deep-sleep\">The hardware for deep sleep<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The hardware you need is this:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"419\" src=\"https:\/\/emariete.com\/wp-content\/uploads\/2021\/03\/cable-jumper-para-breadboard-macho-macho1.jpg\" alt=\"\" class=\"wp-image-238047\" style=\"width:450px;height:314px\" srcset=\"https:\/\/emariete.com\/wp-content\/uploads\/2021\/03\/cable-jumper-para-breadboard-macho-macho1.jpg 600w, https:\/\/emariete.com\/wp-content\/uploads\/2021\/03\/cable-jumper-para-breadboard-macho-macho1-300x210.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-y-la-programacion-para-deep-sleep\">And the programming for deep sleep<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The programming you need is this:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndeepsleep,x\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>In this article I will tell you how to easily take advantage of this high technology.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-espeasy-y-deep-sleep\">ESPEasy and deep sleep<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">ESPEasy includes full support for putting the processor into deep sleep mode and can be used from your rules very easily.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first thing you need to know is that <strong>the RST pin must be connected to GPIO-16<\/strong>This is necessary in order for the ESP8266 to enter and exit its <em>comatose state<\/em>. This is what you will use the cable I showed you before, to make a bridge from RST to GPIO-16, as simple as this.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In order for the ESP8266 to enter this <em>comatose state<\/em>You only have to call it from a rule (or a command, for example):<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndeepsleep,x\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Where <strong>\"x\" is the time, in microseconds, you want the ESP8266 to be in deep sleep mode.<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When this time has elapsed, the ESP8266 <em>will come out of its deep coma <\/em>and the execution will begin, <strong>exactly the same as if we had just turned it on.<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here are the details of this mode.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here's what happens when the ESP8266 wakes up from its <em>DEEP NAP<\/em> and ESP Easy starts working again:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Attempts to connect via wifi to the defined SSID, and to SSID2 if defined and SSID fails.<\/li>\n\n\n\n<li>If you are unable to connect and you have enabled the option <strong>Sleep on connection failure<\/strong>If you have to do something with wifi and it is not available, why wait any longer, wasting energy).<\/li>\n\n\n\n<li>It shall send all sensor measurements at the same time (ignoring any delays that have been defined).<\/li>\n\n\n\n<li>It will shut down and sleep for the number of seconds you set in the Sleep Delay setting. Deepsleep uses an internal 32-bit counter in uSecs. That means it is running up to 4294 seconds, longer delays will not work. That is. <strong>the longest sleep time is approximately 1 hour and 11 minutes.<\/strong>.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-despertar-el-esp8266-manualmente\">Wake up the ESP8266 manually<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you specify a <strong>deepsleep,0<\/strong> the ESP8266 will enter deep sleep mode. <strong>without a pre-set time to wake him up<\/strong>. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You will have to wake up the device yourself <strong>connecting RST to GND<\/strong>with a push button, for example, or a simple cable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is a very useful mode if we want to do something like a door or window sensor with a magnetic sensor (which we will connect between RST and GND) and which will make the ESP8266 wake up the moment that contact is closed, <strong>seconds or months have elapsed since the last time<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-saliendo-de-deep-sleep\">Coming out of deep sleep<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When deep sleep mode is active, you cannot connect to the web interface. In fact, the ESP8266 is turned off and there is only a small timer circuit on to wake up the main ESP8266 core when the time comes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> There are three ways to exit deep sleep mode:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-arranque-en-frio\">Cold start<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Turn off the ESP8266 and turn the power back on. You will have 30 seconds to connect to the web interface and disable deep sleep mode (you will get information on the serial port).<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-desactivacion-temporal-de-deep-sleep-mediante-un-puente\">Temporary deactivation of deep sleep by means of a jumper<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If 30 seconds is too short for you, you can use this method.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Disconnect GPIO-16 from RST and connect it to GND. Reconnect the ESP8266.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Deep sleep will now be disabled and the ESP8266 will operate normally, until you reconnect GPIO-16 to RST.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This requires a version of ESPEasy v2.0.0-dev6 or newer.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-restablecimiento-de-fabrica\">Factory Reset<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If all else fails, simply perform a factory reset - you will lose all your settings!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The reset is done by connecting the RX and TX pins together while resetting the ESP8266. Turn off the device. Then, remove the connector between the RX and TX pins. Reboot and install the ESPEasy firmware again. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If this does not work, try loading the blank image to match the size of the memory installed in the device. Reboot and wait 5 minutes. Then load the firmware you want to use. Reboot and wait 5 minutes.<\/p>\n\n\n\n<p class=\"has-text-align-center has-pale-cyan-blue-background-color has-background has-medium-font-size wp-block-paragraph\"><strong>DID YOU FIND IT INTERESTING? <\/strong><br><strong>DON'T MISS FUTURE ARTICLES LIKE THIS ONE!<\/strong><br><strong>SUBSCRIBE TO THE NEWSLETTER AND JOIN THE TELEGRAM GROUP AND DON'T MISS ANY OF THE BEST.<\/strong><\/p>","protected":false},"excerpt":{"rendered":"<p>Learn how to reduce consumption by mastering ESPEasy's deep sleep mode.<\/p>","protected":false},"author":1,"featured_media":238049,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","_lmt_disableupdate":"yes","_lmt_disable":"no","footnotes":""},"categories":[17],"tags":[21,26,28,41],"class_list":["post-238046","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-proyectos-arduino","tag-bajo-consumo","tag-espeasy","tag-esp8266","tag-nodemcu"],"modified_by":"Mariete","uagb_featured_image_src":{"full":["https:\/\/emariete.com\/wp-content\/uploads\/2021\/03\/ESPEasy-y-el-modo-deep-sleep-ESP8266-bajo-consumo.png",1620,912,false],"thumbnail":["https:\/\/emariete.com\/wp-content\/uploads\/2021\/03\/ESPEasy-y-el-modo-deep-sleep-ESP8266-bajo-consumo-150x150.png",150,150,true],"medium":["https:\/\/emariete.com\/wp-content\/uploads\/2021\/03\/ESPEasy-y-el-modo-deep-sleep-ESP8266-bajo-consumo-300x169.png",300,169,true],"medium_large":["https:\/\/emariete.com\/wp-content\/uploads\/2021\/03\/ESPEasy-y-el-modo-deep-sleep-ESP8266-bajo-consumo-768x432.png",768,432,true],"large":["https:\/\/emariete.com\/wp-content\/uploads\/2021\/03\/ESPEasy-y-el-modo-deep-sleep-ESP8266-bajo-consumo-1024x576.png",1024,576,true],"1536x1536":["https:\/\/emariete.com\/wp-content\/uploads\/2021\/03\/ESPEasy-y-el-modo-deep-sleep-ESP8266-bajo-consumo-1536x865.png",1536,865,true],"2048x2048":["https:\/\/emariete.com\/wp-content\/uploads\/2021\/03\/ESPEasy-y-el-modo-deep-sleep-ESP8266-bajo-consumo.png",1620,912,false],"trp-custom-language-flag":["https:\/\/emariete.com\/wp-content\/uploads\/2021\/03\/ESPEasy-y-el-modo-deep-sleep-ESP8266-bajo-consumo.png",18,10,false]},"uagb_author_info":{"display_name":"Mariete","author_link":"https:\/\/emariete.com\/en\/author\/admin_xlyz052h\/"},"uagb_comment_info":5,"uagb_excerpt":"Aprende a reducir el consumo dominando el modo deep sleep de ESPEasy","_links":{"self":[{"href":"https:\/\/emariete.com\/en\/wp-json\/wp\/v2\/posts\/238046","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/emariete.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/emariete.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/emariete.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/emariete.com\/en\/wp-json\/wp\/v2\/comments?post=238046"}],"version-history":[{"count":2,"href":"https:\/\/emariete.com\/en\/wp-json\/wp\/v2\/posts\/238046\/revisions"}],"predecessor-version":[{"id":241099,"href":"https:\/\/emariete.com\/en\/wp-json\/wp\/v2\/posts\/238046\/revisions\/241099"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/emariete.com\/en\/wp-json\/wp\/v2\/media\/238049"}],"wp:attachment":[{"href":"https:\/\/emariete.com\/en\/wp-json\/wp\/v2\/media?parent=238046"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/emariete.com\/en\/wp-json\/wp\/v2\/categories?post=238046"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/emariete.com\/en\/wp-json\/wp\/v2\/tags?post=238046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}