(click here to see index of all ESP8266 posts)
In my experimentation, so far, the ESP8266 is pretty cool but using the AT command interface requires at least an Arduino to do anything useful. Say I want to monitor a remote switch and send a UDP packet back to a Raspberry Pi when the switch changes state – that requires an arduino read the status of the switch, then send AT commands to the ESP8266 to transmit the data.
BUT WAIT! There are a couple of GPIO pins on the ESP8266-01 (GPIO0 and GPIO2):
Wouldn’t it be cool to read the status of the switch using GPIO0 and transmit the status change directly from the ESP8266 without any additional hardware? This can be done.
The first way is to setup the ESP8266 SDK (software development kit). This let’s you write and download C code for the ESP8266 much as you would for the Arduino.
That is certainly doable (and I may do this one of these days), but you have to learn the ESP8266 tool chain. I’m kind of lazy and really don’t want to go through that much trouble, especially since I’m not really going to do anything tricky – I just want to transmit status.
Enter NodeMCU‘s firmware. This version of ESP8266 firmware supports a LUA script interpreter. You can write simple scripts in the LUA language and execute them on the ESP8266. For simple logic operations, this seems like an ideal solution.
The first step is to get NodeMCU’s firmware installed, which is the topic of this post.
First off, the NodeMCU firmware was much easier to locate and install. I didn’t spend 30 minutes just trying to locate it. And the flash program is, well, cleaner anyway.
My general notes for the upgrade came from notes from a coworker as well as this site:
http://benlo.com/esp8266/esp8266QuickStart.html
I obtained the flasher software from:
https://github.com/nodemcu/nodemcu-flasher
and the latest firmware from:
https://github.com/nodemcu/nodemcu-firmware
Download these directories onto your system. From the flasher ZIP / directory locate the file nodemcu-flasher-master/Win32/Release/esp8266flasher.exe. from the firmware zip / directory locate the file nodemcu-firmware-master/pre_build/latest/nodemcu_latest.bin.
First, unplug the ESP8266 from the computer’s USB port. Short GPIO0 to ground, and plug the USB cable back in.
Start the esp8266flasher program. It should find the appropriate COM port on its own. If it can’t, you may need to change the USB COM port down to a smaller value (I’ve seen various places mention issues with the COM port being to large for some of these programs):
Click on the config tab, and then the little gear indicated here to enter the name of the firmware bin file:
Click back on the Operation tab and click on Flash:
The firmware will start being uploaded. I’m sure, as with any other firmware update, you absolutely do not want to interrupt this. The software indicates its progress:
Once completed, remove the ESP8266 from the USB port, disconnect the GPIO0 ground, and reconnect to the USB port.
Now connect to the ESP8266 using a terminal emulator, press ENTER and you will get a ‘>’ prompt.
To experiment with the ESP8266 now, take a look at lualoader found here:
I have found that I need to run lualoader as administrator for it to properly discover the ESP8266’s serial port.
I’ll address writing LUA scripts pretty quick now.
Iam not able to find prebuilt firmwares.No path exists in the new firmware.
nodemcu-firmware-master/pre_build/latest
It appears that as of Dec 28, 2015, the pre-built binaries are no longer included: https://github.com/nodemcu/nodemcu-firmware/releases/tag/1.4.0-master_20151229
You will either need to build/compile the source files yourself, or the last binary appears to be here:
https://github.com/nodemcu/nodemcu-firmware/releases/tag/0.9.6-dev_20150704
I believe the binary I was using in my examples is here:
https://github.com/nodemcu/nodemcu-firmware/releases/tag/0.9.6-dev_20150406