As we know from previous posts, the ESP8266 WiFi module can work as a standalone device. It's MCU, GPIO ports and user memory are all it's needed to make simple IoT projects like wireless Internet enabled data loggers.
For the ESP8266 to work as a standalone device we need to use a
module with bootable OS. For this project we will use the NodeMCU
firmware. NodeMCU is a firmware based in the eLua programming language for the ESP8266 from Espressif. The latest firmware is based on the Espressif NON-OS SDK 1.5.1.
You
can buy a ESP8266 module with NodeMCU already loaded or you can flash a
"standard" ESP8266 with the NodeMCU firmware yourself. If you're like
me you'll want to flash the firmware yourself. After all that's how we
learn stuff, by doing it ourselves!
NodeMCU firmware can be obtained from GitHub. It currently is made up of 41 modules. According to the team, due to the ever-growing number of modules available within NodeMCU, pre-built binaries are no longer made available. Now you select the modules you need, provide an e-mail address and the firmware will be custom built and sent to your e-mail. But older pre-built NodeMCU firmware versions are available. You can also built your own NodeMCU firmware. Fore more info go to the NodeMCU firmware GitHub project page.
To replace the
ESP8266 firmware with NodeMCU we can use one of several flasher tools
available. I will use the official tool from Espressif: ESP Flash Download Tool.
Put the ESP8266 module in download mode and download the NodeMCU .bin firmware file to the 0x00000 address. You will need an USB to Serial adapter. If you don't know how to do this, read my previous post.
After
the the firmware is successfully uploaded to the module we can check if
the device is booting with NodeMCU. Disable download
mode, start RealTerm and restart the module. In RealTerm you shoud get a Lua prompt:
Ignore the cannot open init.lua message, it's normal. It's shown because we did not upload a init.lua file yet. We'll do that when we upload Lua project files.
Downloads:
Download ESP FLASH DOWNLOAD TOOL
Download ESP8266 NodeMCU firmware
Download RealTerm
Buy the Parts:
Buy the ESP8266 Wi-Fi from Banggood
Buy the ESP8266 Wi-Fi from Dealextreme
Buy the USB to Serial Adapter from Banggood
Buy the USB to Serial Adapter from Dealextreme
Previous ESP8266 posts:
ESP8266 firmware update
ESP8266 ESP-01 testing - Part 2
ESP8266 ESP-01 testing - Part 1
ESP8266 WiFi modules