ESP8266 MicroPython Firmware

To enhance the capabilities of the ESP8266 there are various firmware packages available. In my last post, I showed how to install NodeMcu which uses eLua. I am a big fan of the Python programming language, so I was very happy to see a Python version for the ESP8266. The ESP8266 MicroPython Firmware is available from Download it from HERE.

To flash the ESP8266, make sure that GPIOO isĀ  wired to GND. Check the following diagram for the complete wiring:

ESP8266 MicroPython Firmware Flashing(Download the Fritzing source for the wiring diagram HERE.) An interesting post showing how to flash the ESP8266 using an Arduino instead of the USB to serial converter (used in the graphic above) can be found HERE.

To flash the ESP8266 MicroPython Firmware, make sure that the flash tool ( is installed (or if installed, is up to date):

pip install --upgrade esptool

Here are the commands to flash the ESP8266 MicroPython Firmware: erase_flash --port /dev/ttyUSB0 write_flash --flash_size=detect 0 esp8266-20170612-v1.9.1.bin

Version 1.9.1 was the current version when I wrote this post, so the flash file name will vary. Once the firmware is loaded, open a serial terminal program like picocom via:

picocom /dev/ttyUSB0 -b115200

You might have to ‘hit enter’ a few times to get to the >>> MicroPython REPL prompt.To verify the flash use these commands:

import esp

The result should be ‘True’ if flash is OK. Even so, I still had problems when I flashed some of my ESP8266 modules. The problem was resolved by ensuring a stable/good power source and letting use its default baud rate to do the flashing.

A WEB accessible REPL prompt is also possible once installed/configuredĀ  via:

import webrepl_setup

from the serial connection. Download the WebBREPL code from HERE. This comes in quite handy to connect and enter commands when the only access to the ESP8266 is wireless. If you don’t have a ‘local’ copy of WebREPL to run, it is hosted here: Note: Once that code is loaded in your browser, it will connect via websocket to your ESP8266 module.

To show what can be done with ESP8266 MicroPython Firmware, I wrote a WEB server script to toggle pin 2 (GPIO2). This is basically the same functionality as the Lua script in my previous post but this one is coded in Python. Download it from HERE.

For more information on the specifics of MicroPython on the ESP8266, consult the Documentation HERE.

Leave a Reply

Your email address will not be published.