Comments on: ESP8266 Deep Sleep with Arduino IDE (NodeMCU) https://randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Tue, 18 Mar 2025 21:07:40 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Patrick https://randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide/#comment-1017764 Tue, 18 Mar 2025 21:07:40 +0000 http://randomnerdtutorials.com/?p=44608#comment-1017764 I am trying to use this sketch in deep sleep mode (ESP.deepSleep(20e6)). Before sleeping the ESP8266 (bare) draws 70mA and gives a reading. After sleeping the appropriate amount of time, the on-board LED gives a brief flash and the unit draws 30 mA but doesn’t give a reading. Can you help please?

]]>
By: FF https://randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide/#comment-1007280 Wed, 12 Feb 2025 09:11:51 +0000 http://randomnerdtutorials.com/?p=44608#comment-1007280 In reply to Aa.

If the led is connected to a GPIO simply turn off the led before going into Deep Sleep.
Of course if the led is directly wired to the main power supply you have to detach it in some way, may be using a simple small MOSFET transistor and disable it when the ESP is going to deep sleep.

]]>
By: Alfred Jones https://randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide/#comment-997208 Sun, 05 Jan 2025 00:52:37 +0000 http://randomnerdtutorials.com/?p=44608#comment-997208 In reply to Sara Santos.

Amazing how time flies. Apologies for waking an old comment.

My solution would involve “jumpers” or some such thing pulling an input one way or the other and have the code not do the deep sleep. That way there’s no race after a reset (or wake from the previous deep sleep). So, it’s a “disable deep sleep”, “debug”, “program” human control.

Of course it does require a spare GPIO pin. On the plus side, no trying to reconfigure circuits on the fly.

]]>
By: Sara Santos https://randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide/#comment-987520 Fri, 29 Nov 2024 11:14:15 +0000 http://randomnerdtutorials.com/?p=44608#comment-987520 In reply to Ash Dash.

Hi.
It doesn’t matter.
You can put everything on the setup() because it will only run once.
But, you can also put it on the loop() even though it will just run once (just make sure the deep sleep function is just called at last).
Regards,
Sara

]]>
By: Ash Dash https://randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide/#comment-987345 Thu, 28 Nov 2024 21:04:55 +0000 http://randomnerdtutorials.com/?p=44608#comment-987345 Dears,
i want that my ESP8266 NodeMCU wakes up after 6 or 7 minutes, reads the current measurements of temperatur and humidity from a DHT11 and send them via MQTT to my ioBroker – something exactly you described above.
So my question as a rookie is:
Should i put the parts (or functions, let’s see) waking up, connecting to WiFi and MQTT server, reading and sending measurements and going back to sleep all in the setup() or loop() part of the sketch?

]]>
By: Tayip https://randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide/#comment-902815 Tue, 02 Apr 2024 12:28:40 +0000 http://randomnerdtutorials.com/?p=44608#comment-902815 I want to develop a project with the ESP8266 E12 nodemcuv3 module. I will use both GPS module and accelerometer module in this project. However, I could not decide on the battery that would be sufficient for my device for 2 days. I would be glad if you help. Thank you for your time…

]]>
By: Sara Santos https://randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide/#comment-861938 Fri, 22 Sep 2023 09:57:59 +0000 http://randomnerdtutorials.com/?p=44608#comment-861938 In reply to Jean-Claude Servaye.

Thanks for sharing your results.
Regards,
Sara

]]>
By: Jean-Claude Servaye https://randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide/#comment-861758 Thu, 21 Sep 2023 13:42:49 +0000 http://randomnerdtutorials.com/?p=44608#comment-861758 ESP-NOW and DeepSleep

In my case, I need to send pool temperature to the server each minute. For the pool, I will not use power supply for security reasons.

To powering with batteries, we need to limit the current and time needed to run our application.

Using the minimum hardware possible.
Using ESP-NOW and not WIFI because ESP-NOW transmit data without the need of maintaining permanant WiFi connection.
Setting the ESP in deep sleep mode for a maximum of time, waking up only for getting the data and transmit.

I choosed ESP12F because in all other development bords, only the ESP8266 can be set in deepsleep mode, but USB to serial device stay powered.
I uses a pack of 4 AA batteries and a voltage regulator (MCP1702 3.3 volts: dropout = 0.75V, quescient current = 2 uA )
To keep 3.3V on the ESP8266, the batteries voltage must be 3.3V + 0.75V = 4.05 Volts minimum.
The total current in deep sleep is now 12 uA.

After powerup, the code need to make a pairing with the server, this takes less 2.5 seconds running time.

Searching 1-wire bus
End of search : 18ms
Setup done
Pairing request on channel 1
Pairing request on channel 2
Pairing request on channel 3
Pairing request on channel 4
Pairing request on channel 5
Pairing done on channel 6 in 2333ms for 78:e3:6d:09:fc:89
Send data of device 1
I'm awake from 2366ms , but I'm going into deep sleep mode for 10 seconds

After wakeup, the running time is less then 350ms

Searching 1-wire bus
End of search : 18ms
Setup done
Pairing request on channel 5
Pairing done on channel 6 in 285ms for 78:e3:6d:09:fc:89
Send data of device 1
I'm awake from 318ms , but I'm going into deep sleep mode for 10 seconds

To perform a test in a reasonable time, I make tests with a sleep time of 10 seconds and, after 1 month, the battery voltage is about 4 volts.
So, if I need a transmission each minute, the 4 AA battery can do the job at least for 6 months (in Canada, we don’t have 6 months of summer time!).

]]>
By: Martin https://randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide/#comment-855966 Sat, 19 Aug 2023 21:42:48 +0000 http://randomnerdtutorials.com/?p=44608#comment-855966 In reply to Sara Santos.

You state the to upload the code to the board the wire to the RST pin has to be disconnected. But if you’re using OTA to upload the code then you don’t have access to the board to manually disconnect the wire to RST. Is there a way to implement recovery from deep sleep when using OTA?

]]>
By: bean https://randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide/#comment-839282 Wed, 07 Jun 2023 13:16:35 +0000 http://randomnerdtutorials.com/?p=44608#comment-839282 you need a reset PULSE to gnd to wakeup, if you keep the reset low it will not start
Also, need a resistor of 470R between gpio 16 and reset button to gnd , as the reset button will short gpio 16(which is normally HIGH ) to gnd.
The chip enable must not let open, floating, needs a resistor of 10k and capacitor of 100nf , see hardware design reference expressif.
espressif.com.cn/sites/default/files/documentation/esp8266_hardware_design_guidelines_en.pdf

]]>