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:
- +3.3 volts to Vcc
- ground
- TxD on the board to RxD on the adapter
- RxD on the board to TxD on the adapter
DONT USE 5V as this will damage your ESP.
- Connect Vcc to CH_PD to enable the chip
- Connect GPI0 to GND to enable flash reprogramming
- Connect GPI15 to GND to enable UART Download
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.
- Connect Vcc to CH_PD to enable the chip
- Disconnect GPI0 from GND tand connect it to Vcc
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:
- connect to Wifi
- execute sleep.lua
- open a web connection to google.com
- parse the result and get the date/time
- enter to deepsleep for 60 seconds
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:
- in Esplorer go to tab Snippets
- edit one of the Snippets and add this code:
file.remove('init.old')
file.rename('init.lua','init.old')
- save it and you'll have a new button associated to this code.
- when ESP is starting and header is displayed (NodeMCU 0.9.6 build 20150704 powered by Lua 5.1.4) press immediately the button.
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.
Comments