Skip to content

Getting started with micropython

This is an introductory tutorial to get your Lolin D1 Mini Pro board flashed with micropython. At the end of this tutorial you should have micropython flashed on your mini board and you will be able to start programing in python for micro contollers.

Requirements

Step by step walk through

Install CH340 driver

  • Download the CH340 driver from the link provided above
  • Extract the zip file
  • Connect your board through the micro usb on your computer
  • Run the .exe file contained in the folder
  • Click install on the window that opens

  • If you have successfully installed the drivers, you will get a success message as shown below. If you don’t get a message, make sure that you downloaded the right drivers.

Drivers

Install esptool for python

  • Download latest python version from the link provided above

  • Run windows command prompt as an administrator

  • Navigate to the directory where python files are stored on your computer and locate the Scripts folder

  • Use the command

    1
    pip install esptool
    
  • Don’t close the command prompt as you will be using it in the next steps

Install micropython

  • Download micropython latest version from the link above

  • Open up device manager from your computer control panel

  • Under ports you will find the name of the port your lolin D1 Mini Pro board is using. Make sure it is connected with the micro usb (See screenshot below)

  • To delete existing flash storage, use the command (remember that COM5 is the port on my computer, yours might be different)

    1
    esptool.py --port COM5 erase_flash
    
  • To flash micropython on the board, use the command below. The .bin file is the micropython version you downloaded before. Make sure you replace it with the one you have downloaded and make sure you include it in the Scripts folder of python directory.

    1
    esptool.py --port COM5 --baud 460800 write_flash --flash_size=4MB 0 esp8266-20190125-v1.10.bin
    
  • If you don’t have PuTTY installed, download it from the link provided above

  • Open PuTTY.exe and use the Serial connection type and use 115200 speed, then click open. (See screenshots below)

  • You should now be looking at the micropython terminal. Sometimes the PuTTY terminal freezes as soon as you open it up. In case this happens and the cursor is not moving, close the terminal and open PuTTY configuration again!

Ports

Putty

This is the end of Tutorial 1 for Lolin D1 Mini Pro, on how to flash micropython.