This article will primarily introduce how to install and run MicroPython on the ESP32-C3 Super Mini development board using Espressif’s esptool. The ultimate goal is to run MicroPython code on the ESP32-C3 Super Mini development board.

Installing MicroPython on the ESP32-C3

Next, this article will demonstrate how to implement a simple non-blocking LED blinking code. That is, without using the `sleep()` function, it will not block the execution of other code. First, you need to install the `esptool` utility.

Press the Windows key, type cmd to open the command prompt. Then type the following in the command prompt:

  1. $ pip install esptool

The installation process is quick; just wait. After installation, connect the ESP32-C3 development board to your computer using a USB cable and locate its corresponding COM port. Open the Device Manager application and find the serial port corresponding to the ESP32-C3.

Now return to the command prompt and enter the following command to erase the ESP32’s flash memory. Replace “PORTNAME” with the COM port number you just found (e.g., “COM22”).

  1. esptool.py –port PORTNAME erase_flash

Once completed, you will see something like the following:

Installing MicroPython on the ESP32-C3

You now need to download the binary file to convert the ESP32-C3 into a development board that supports microPython. Visit this link and download the latest “.bin” file to your computer. I suggest you rename the downloaded file to a more user-friendly and memorable name, such as “micropython_c3.bin”.

firmware flashing

First, navigate to the location of the “.bin” file in the command prompt (cmd). You will need to use the “cd” command:

  1. cd C:\Users\Clovisf\Downloads

Once you are in that directory, simply type the following command and press Enter. Please remember to use your own filename, not necessarily mine (micropython_c3.bin).

  1. esptool –baud 460800 write_flash 0 micropython_c3.bin

After success, you will see an interface similar to the image below:

Installing MicroPython on the ESP32-C3

LED indicator flashing codes

Now simply unplug and replug the ESP32-C3 development board to ensure everything is working correctly. Open the Thonny IDE software, and click “Tools > Options” and then the “Interpreter” tab. Ensure that “MicroPython (Raspberry Pi Pico)” is selected and the COM port of the connected development board is checked.

Installing MicroPython on the ESP32-C3

Copy and paste the following code into a new file in the Thonny IDE. Save it to the development board and name it “main.py”. Note that I set pin 8 to LED because this is the pin number used by the ESP32-C3 Super Mini development board.

  1. import machine
  2. import time
  3. led= machine.Pin(8, machine.Pin.OUT) #ESP32-C3 super mini
  4. if __name__ == “__main__”:
  5.    
  6.     initialtime= time.ticks_ms() #https://docs.micropython.org/en/latest/library/time.html
  7.    
  8.     while True:         
  9.         
  10.         if time.ticks_diff(time.ticks_ms(), initialtime) > 200: #update with the “current” time
  11.             initialtime = time.ticks_ms()
  12.             
  13.             led.value(not led.value())

Now you can simply click the green arrow “Run current script (F5)” at the top of the interface and observe the onboard LED, which will start flashing.

error: Content is protected !!
Scroll to Top