ESP32 MicroPython Blink

Step 1: Why? The Purpose.

Load MicroPython firmware in ESP32 and turns the built-in LED on and off by using python command.

Step 2: How? The Process.

  1. Check / Install Python3.

  2. Install ESP Tools.

  3. Erase the flash memory of ESP32 and Load the MicroPython.

  4. Install Rshell for communication with ESP32 Board.

  5. Use repl to blink the built-in led.

Step 3: What? The Result.

Verify "What we Get" by "Why we are Doing".

Step 1: Check whether Python3 is Installed or Not. If Not, Install it.

Click Here to Download Python Installer

Note: Do not install Python2.

Step2: Install ESPTOOLS.

cmd> pip install esptool

Note: don't upgrade pip to 20 version.


Check the esptool help command:

cmd> esptool.py -h

Commands of Interest:

-h, -p PORT, flash_id, erase_flash, write_flash

Step 3a: Download and Install CP210x driver

Click here to download CP210x driver: USB to UART bridge.

Step 3b: Connect the ESP32 board and find out the com port number.

Step 3c: Display the esp32 board info.

cmd> esptool.py -p COM3 flash_id

Note: While try to connecting, you have to press the boot button for few seconds until unless connection established.

Replace the COM3 with your COM PORT NUMBER.

Step 3d: download the latest stable version of MicroPython for ESP32.

Click here to download MicroPython for ESP32.

Step 3e: Erase the flash memory of ESP32.

cmd> esptool.py -c esp32 -p COM3 erase_flash

Note: Replace COM3 with your COM PORT Number.

Step 3f: Load MicroPython in ESP32.

cmd> esptool.py -c esp32 -p COM3 -b 460800 write_flash -z 0x1000 D:\RoboticsClasses\ESP32\esp32-idf3-20200902-v1.13.bin

Note: replace COM3 and bin file with address with your COM and bin file with address.

Step4: Install rshell for communication with ESP32.

cmd> pip install rshell

Check the rshell help command:

cmd> esptool.py -h

Step 5: Communicate with esp32 board and control LED.

cmd> rshell -p COM3

cmd> boards

cmd> cd /pyboard

cmd> ls

cmd> repl

>>> print("Hello!")

>>> from machine import Pin

>>> p2 = Pin(2, Pin.OUT)

>>> p2.on()

>>> p2.off()

Knowledge Base:

Inside /pyboard we have "boot.py" file. Don't delete it or mesh with it.

Click Here for MicroPython Library reference