Sunday, November 15, 2015

Flashing the ESP8266

Once you have bought your first ESP8266 modules you will want to start some projects with them.

Now if you have bought the NodeMCU version you are in luck as there is probably the LUA language build in. However if you bought the ESP8266-01 or any other member of this family there is likely to be the AT-command firmware in this module.

The AT-command firmware can be used to communicate with an Arduino. The Arduino does all the I/O and calculations and just sends the results to the ESP which then can send these results over Wifi. Or you can send commands to the ESP which will pass them through to the Arduino that can execute them.

Fun but not very easy to use for novice ESP users like me.

The Lua language is much more easy to understand. It is a high level language which is easy to learn.

And there is more. Not only Lua is available. In the past year a lot of languages have been devellopped for the ESP8266 family. There is Python, Javascript, Lisp and even Basic !!!

At the end of this story I will provide you with links to all the different firmwares that are available for the ESP8266.

Flashing the NodeMCU

To flash the NodeMCU with new firmware you just have to connect the USB cable to your computer, start the NodeMCU Flasher. Get the firmware and instruct the NodeMCU flasher to use that and Push the Flash button.

Flashing the ESP8266-01

This is a bit more tricky. First you will need to build the ESP8266 programming board. You can find it in this post.

Next you will need to load the NodeMCU flasher. You can find the latest version here on the NodeMCU github page: https://github.com/nodemcu/nodemcu-flasher

After you have downloaded and Unzipped it it is ready to flash the latest version of the Lua firmware in your ESP8266.



As you can see the flasher immediately recognizes on wich com-port the ESP8266 is located.




In the config menu you can see that NODEMCU (the LUA firmware) is activated and ready to be flashed.

Now if you press the Flash button nothing will happen. Flashing will not start.
To start flashing you will need to press the Program button (the rightside button on the programmer) and keep it pressed. Then press the Reset button (the leftside button on the programming board).


Now the QR code will be made visible. So will the Mac adresses for the AP (Access point) and STA (Station) be shown. You can write these down or use your Android Phone with a QR code scanner (or your PC with a webcam) for memorising them.


Keep pressing the Program Button (the rightside button) and you will see that the module is slowly being flashed.

When finshed a green circle at the right side of the window will appear with the word Ready next to it. And you're done.

Flashing other firmware.

As stated above there are many firmwares available for the ESP8266: AT-commands, Basic, Java, Lisp, Lua and Python.


To use any of these first click the config tab and choose any free line where it says 'Path of Binary file'. Next to this line is a button. Click that and the fileselector will open. Choose the firmware you want and it will be displayed on that line.


Now choose the right offset in memory. Dont worry normally it is 0x00000 which is already filled in.


Next check which firmware you want to flash and make sure the other lines are unchecked. Now go back to the Operation Tab and proceed as described above and flash your desired firmware.

You're done !!!

To make sure the firmware starts press the reset button on the programming board (the left button).

The links to the available firmwares

First the flash software itself:
https://github.com/nodemcu/nodemcu-flasher

Original AT command set
http://bbs.espressif.com/viewtopic.php?f=46&t=1123&sid=a5a84b6f154226729c6a573fe64e54e4#p3755

Basic:
http://www.esp8266basic.com/flashing-instructions.html

Javascript for ESP8266
https://github.com/espruino/Espruino

Lisp
https://github.com/yesco/esp-lisp

Micro Python
https://github.com/micropython/micropython

Till next time.
Have fun


Luc Volders