ESP8266 is a UART to WiFi module that provides an easy solution for wirelessly connecting any small Microcontroller platform like Arduino to the Internet. Since ESP8266 is inexpensive and easy to work with, it has become one of the leading platforms for the Internet of Things. You can use AT commands to connect to WiFi networks and open TCP connections without running a TCP/IP stack. It also includes a 32-bit Microcontroller that can be programmed to act as a standalone WiFi-connected Embedded Platform.
To get started with the ESP8266 ESP-01, it is recommended to flash and program it with NodeMCU Firmware before building your project. So far there are different variants of ESP-x modules are available, Where x can be 1 to 12. ESP8266 requires 3.3v device, it can’t tolerate 5V so do not power it with 5Volts. We have to make sure that CH_PD pin is pulled up, the module will not give any response until you make this connection. This can be done by directly connecting CH_PD to VCC or using the 3.3K resistance to pull up. The current rating of this Module is 80mA in idle and 300mA during operation.
Entering into Firmware Flash mode:
To get the ESP-01 into the firmware flash mode, we have to make some changes in the state of the GPIOs. The schematic of the board in TOP orientation is shown below.
Fig. 1: Image showing PCB Layout of ESP-01 ESP8266 Module
Connections for Flash mode:
The normal connection details are as below:
WIFI Module |
USB-TTL
|
Vcc |
3.3v |
Gnd |
Gnd |
TX |
RX |
RX |
TX |
CH_PD |
Connected to 3.3v to enable chip firmware boot |
Remember to pull up CH_PD HIGH; the module won’t respond if it isn’t done.
In addition to the above connections, we need to make an additional connection to get into the firmware flash mode. The easiest way to do this is to use a breadboard.
ESP-01 GPIO0 – Pull low by connecting to GND
Fig. 2: Image showing Circuit Connections between ESP8266 Module and FTDI Converter
When you reboot the module it should be in the firmware flash mode!
Downloading the software:
Go to https://github.com/nodemcu/nodemcu-firmware
There, you click the “Download Zip” button on the right of your screen.
A zip file with all the files in it will be downloaded. Extract it and the file we are going to flash is nodemcu_512k_latest.bin which is located in the nodemcu-firmware-masterpre_build.9.4512k-flash directory.
However, it’s even easier if you download the flasher itself, as it includes the firmware!
Go to https://github.com/nodemcu/nodemcu-flasher and Download zip.
Fig. 3: Screenshot of Nodemcu-Flasher Page on Github
Choose the 32bit or 64-bit version depending on your PC’s OS and open it. It should open like the image shown below.
Fig. 4: Screenshot of NodeMCU Firmware Programmer
In most cases this program will find your USB-TTL converter port automatically or else unplug and reinsert the USB-TTL converter. Once it got connected click Flash button.
Fig. 5: Screenshot of Flashing NodeMCU Firmware
Wait until the progress finishes and showing a green check mark at bottom left.
Fig. 6: Screenshot of Flashing NodeMCU Firmware in Progress
Enter to the normal mode by disconnecting the GPIO0 to GND.
You are now ready to program the ESP8266 for your own application.
The NodeMCU Lua firmware communicates with the PC over the serial link. You can use PuTTY or any other terminal program to write Lua programs or enter direct commands to the board. The default speed is 9600 baud, but once you have established communications, you can change it to any other baud rate.
Here, we will be discussing two software used to load LUA programs to the module among many others.
LuaLoader
LuaLoader
LuaLoader.exe is a simple Windows application that requires no special installation.As well as being a simple terminal program, it has built in command buttons that make it easy to interact and experiment with the ESP8266 board.
Download: LuaLoader.zip
From the Settings menu, select COM Port Settings and choose the appropriate COM port for your USB to serial adapter.
Fig. 7: Screenshot of LuaLoader
Clicking buttons on LuaLoader sends commands to the board which is already predetermined. Power your board and watch for the initial message. You should see the version information of the NodeMCU after displaying some funny characters which are firmware reset parameters sent at 74880 baud.
NodeMCU 0.9.5 build 20150107 powered by Lua 5.1.4
After every reboot, NodeMCU will try to run a file called init.lua in flash memory. Since this is the first boot it will report an error and show the > prompt. This shows that the module is now ready to interact.
Fig. 8: Screenshot of LuaLoader Running init.lua
To get information about the amount of RAM available, click the button Heap. The LuaLoader will type the command = node.heap(), and the ESP8266 will respond with 21888 or some other value, followed by the > prompt again.
Fig. 9: Screenshot of getting Information about Amount of RAM Available in LUALoader
Click the Survey button to list the available access points visible to the ESP8266. The SSID, authentication mode, signal strength, MAC address, and channel are shown.
Connecting to an Access Point:
Enter the SSID and password of your closest access point in the appropriate text box on LuaLoader. Click Set AP. The LuaLoader will send the commands to set the WiFi mode and connect to it.
Fig. 10: Screenshot of Connecting to an Access Point in LuaLoader
Click the WiFi button to check the connection status. Click Get IP to confirm that the ESP8266 is connected to your access point.
Fig. 11: Screenshot of getting IP in LuaLoader to Confirm Connection with ESP8266 Module
All commands typed by clicking buttons in LuaLoader can also be entered manually or saved in a file to be run automatically.
Here is video NodeMCU Firmware Flashing on The Esp8266 using Windows
Filed Under: Electronic Projects, ESP8266, Tutorials
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.