From CoMakingSpace Wiki
Revision as of 12:49, 27 August 2017 by Lukas (talk | contribs) (written by Mitja)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Type: embedded
Platform: ESP8266
License: MIT
Source: website, GitHub
Input Formats: Python
Output Formats: microcontroller pins
Users: Mitja

MicroPython is implementing a subset of Python 3 on microcontrollers. This allows you to program microcontrollers in the Python language. A Kickstarter campain funded porting MicroPython to ESP8266.

Compiling Firmware

The compiled firmware is available to backers only, but you can compile it yourself from the open source project. The README in the esp8266 subdirectory explains all required steps and dependencies.

In short, to flash a Wemos D1 mini after you have built MicroPython before, the commands are

export PATH="/path/to/esp-open-sdk/xtensa-lx106-elf/bin:$PATH"
esptool.py --port /dev/ttyXY erase_flash
cd /path/to/micropython/esp8266/
make PORT=/dev/ttyXY FLASH_SIZE=4m deploy

Aside from the README there is another building tutorial on the Adafruit website, using a virtual machine.

If compiling sounds too difficult, Mitja can also flash the firmware for you at your own risk, before asking you should make sure that your ESP8266 board is compatible.

Flashing Firmware

If you downloaded a precompiled binary, you can flash it with esptool.py, available via pip:

esptool.py --port /dev/ttyUSB0 erase_flash
esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=4m 0 firmware-combined.bin

Compatible Boards

The requirements are listed on the official website.

  • Wemos D1 mini works well

Writing Code

Read the tutorial. You might use the WebREPL or upload files using ampy. A more advanced remote shell with tab completion is mpfshell.