| × | 1 | ||||
| × | 1 |
| ||||
![]() |
| |||
|
This is to show you how to get started with a ESP8266, model ESP-07 (flashing firmware, writing code) and test deep sleep mode.
The first thing to do is to wire your ESP to power (VCC), ground, RX/TX of PC Serial and the required GPIOs:
DONT USE 5V as this will damage your ESP.
Once wiring set up for flashing, you can flash your ESP with latest firmware. Download and run NodeMCU Firmware programmer ((ESP8266Flasher.exe)..
Select your COM port (usually is auto-detected, check the drop-down list)
On Advanced tab, you should have those values:
Baudrate: 57600
Flash size: 4MByte
Flash Speed: 40MHz
SPI Mode: DIO
Power up your ESP and press Flash(F) button.
If everything goes well, the MAC is being read and a progress bar will show you the flashing status.
Once completed, you can power it off and close the application.
Now let's change it to boot mode.
Now we have a flashed ESP, with NodeMCU firmware and ready to boot.
Download and run Esplorer application (Esplorer.bat - is running a jar file).
Set up the correct COM port and press Open.
Power the ESP. If everything is ok, the output from your ESP is displayed in the right side, loading NodeMCU firmware and ready for coding.
NodeMCU 0.9.6 build 20150704 powered by Lua 5.1.4
lua: cannot open init.lua
>
Open the two scripts: init.lua and sleep.lua and press button Save to ESP on each one.
Or, you can use Upload button (this will avoid to run in after upload).
Note: dont forget to add your wifi ssid name and password in init.lua file.
Power off/on your device and you'll see in serial console the output of your code:
Once 60s is over, the ESP will reset and start over.
Note:
If you want to break this loop and re-write the code, use this tweak:
file.remove('init.old')
file.rename('init.lua','init.old')
This will remove the init.lua and the ESP will stop, ready to be coded, as we started in the beginning.
Good luck!
If something is unclear or get stuck, you can comment it and I will reply and update the steps above.
Did you replicate this project? Share it!
I made oneLove this project? Think it could be improved? Tell us what you think!
Please log in or sign up to comment.
Slarti Fartfast
6 months agoGood idea for a project, as I want to implement a sleep function, and great documentation, .
One thing that I can't quite see; you say the ESP will reset after sleep, but I don't see any call to node.restart() so what does that? surely dsleep doesnt reset, or we would lose variables, etc. sorry if that seems dumb!
Bobby
5 months agoThat's how actually Deep Sleep works. This state triggers the Reset pin when timer expires.
Yes, you will need loose variables if not stored, the algorithm just starts again.
If you want to save variables, just save it on a file (write/read).
Anudeep
5 months agoHi.. I tried same code with Esp8266-01 after displaying date and time it's going to deepsleep and but it's not restarting.....?
Bobby
5 months agoThat's because ESP01 does not have (exposed) this GPIO16 - Deep Sleep to connect it to reset pin, in order to be triggered.
So, use ESP07 or 12 or similar.
Deleted account
3 months agoI have a big problem with the ESP-12
I plug according to the diagram at 3.3v:
+3.3 Volts to Vcc
ground to ground
TxD on the board to RxD on the adapter (PL2303)
RxD on the board to TXD on the adapter (PL2303)
Vcc is CH_PD
GPI0 is GND
GPI15 is GND
And with Flash does not have a problem (Loading a just - nodemcu_float_0.9.6-dev_20150704.bin)
The problem appears in ESPlorer - I can not open a port and connect to upload any code 😦
It performs steps in sequence to power off the ESP-12
Connect Vcc is CH_PD (even though it was still connected in this way)
Disconnect GPI0 from GND and connect it to Vcc
(Or the GPI15 I did not do anything? And continue to be connected to the ground?)
PL2303 plug in a USB powering at this moment the ESP-12. In ESPlorer i want to open but nothing happens, and only rows of dots to display ...
What I am doing wrong and how to make the opening of the port with my ESP-12?? 😦