NodeMCU – Getting started with MicroPython

I have used micro python on nodemcu for couple of small projects. Micro python is great when it comes to ease of writing code and the read to use libraries. You can get started with micro python in no time, as the syntax exactly same as that of python3. You can check more about MicroPython project on the official website. Its a breeze to develop connected applications with micro python on nodemcu (ESP8266), it has some limitations as well. You will go out of heap if you are careful with your heap usage. The IDE are still in elementary stage (if you are comfortable with cmd lines tools, there is esptool which covers nearly every programming need you have for ESP8266/EPS32).

In this post we will see how to load MicroPython interpreter to NodeMCU.

What you need :

  1. NodeMCU with micro USB cable
  2. windows machine

There are couple of ways in which you can load. I will discus command line approach and IDE based approach here

Loading MicroPython using esptool:

To run esptool you need python. Check if python is installed or not. If not, install python first.

python version check
python version check

run the following command to install esptool

pip install esptool

Connect your nodemcu to windows machine through a micro USB cable and find the COM port of the nodemcu (you will be able to find the COM port in DeviceManger, if the device is not recognized you might need to install serial chip drivers)

NodeMCU COM Port
NodeMCU COM Port

download latest version of stable MicroPython interpreter from ESP8266. Navigate to the directory in which bin file is present and run the following command (replace the COM port with the one you found in previous step, and bin file name should the one you downloaded) --port COM4 write_flash 0 esp8266-20171101-v1.9.3.bin
NodeMCU MicroPython bin flashing
NodeMCU MicroPython bin flashing

You can access the python interpreter from putty

Click on Open, then press the reset button on NodeMCU, you should the interpreter waiting for your input

You can ignore the error message (the Errno 2 indicates that, file is not present on the device. MicroPython will try to execute the on bootup). Now you can run any python3 valid statement and NodeMCU will execute it (For exaple print(“Hello Python”)).

Loading MicroPython using uPyCraft:

There is nice little GUI tool for MicroPython developed by guys at DFROBOT. You can download the executable for your platfrom from here. Using uPyCraft we can load the MicroPython interpreter for both ESP32 and ESP8266.

Download the IDE and run the installer, it will ask for installation of MONACO font, click on ok

Install MONACO fonts
Install MONACO fonts

The IDE upgrades itself if there is new version available, Click yes if it asks for upgrade.

To flash the MicroPython firmware, goto Tools -> BurnFirmware

Select board and COM port and click ok, uPyCraft will automatically download the bin and uploads to the board.

using uPyCraft you can upload python files to the NodeMCU (ESP8266)


I think uPyCraft is very simple and easy to use, please mention in comment if you find any new tools/IDE to work with MicroPython

Add a Comment

Your email address will not be published. Required fields are marked *