Installing and Running MicroPython on ESP32-C3 Super Mini

  • Clovis Fritzen
  • 82 Views
  • easy
  • Tested

esp322-c3 super mini board

Introduction

In this article we will install and run MicroPythonon on ESP32-C3 super mini, using a tool made by Espressif called “esptool“. The final object is to run microPython code into our ESP32-C3 super mini.

Then I will show you how to implement a simple LED blink code which is non-blocking. That means it does not use “sleep()” and does not block any other code from executing. First thing you have to do is install the “esptool” tools, following this procedure.

What you have to do is open the command prompt by typing “cmd” after pressing the Windows button. Then in the command prompt (a black screen) type:

$ pip install esptool

Then just wait for the installation to happen, won’t take long. You then have to connect the ESP32-C3 to the computer via USB cable and figure what is its COM port. To do that you press the Windows button and type “device manager‘. Open the device manager app and search for a COM port, which is the one from ESP32-C3.

Now go back to the command prompt (black screen) and type the command below to erase the ESP32’s flash memory. Substitute “PORTNAME” for the COM port name you just found (ex “COM22”).

esptool.py --port PORTNAME erase_flash

After the process is finished you are going to see something similar to this:

erasing esp32-c3 flash memory

It is now time to download the binary file necessary to transform our ESP32-C3 into a microPython-capable board. Head to this link (specific for our -C3 board) and download the laster “.bin” file to your computer. I recommend you rename the just download file to something easier to use and remember. I renamed my file to “micropython_c3.bin”.

Flashing the firmware

First, you navigate to the folder where your “.bin” file is, from inside the terminal (cmd). You are going to use the “cd” command for that. In my case, it was:

cd C:\Users\Clovisf\Downloads

Once inside there, you just have to issue the command below and hit enter. Remember to use your file name, not necessarily mine (micropython_c3.bin).

esptool --baud 460800 write_flash 0 micropython_c3.bin

Upon success, you are going to see something similar to the screen below:

flashing new firmware to esp32-c3

Blinking an LED

This time just unplug the ESP32-C3 from the USB and plug it back in, just to make sure everything is all right. Open the Thonny IDE software and go to “Tools > Options” and the “interpreter” tab. Make use that “MicroPython (Raspberry Pi Pico)” is selected and that the board’s COM port is also selected.

Copy and paste the code below to a new file in Thonny IDE. Save it TO THE BOARD as “main.py”. Notice that I put pin 8 as the LED, since this is the pin the ESP32-C3 super mini uses.

import machine
import time


led= machine.Pin(8, machine.Pin.OUT) #ESP32-C3 super mini

if __name__ == "__main__":
    
    initialtime= time.ticks_ms() #https://docs.micropython.org/en/latest/library/time.html
    
    while True:
        
        
        
        if time.ticks_diff(time.ticks_ms(), initialtime) > 200: #update with the "current" time
            initialtime= time.ticks_ms()
            
            led.value(not led.value())

This time you have to click the green arrow at the top of the screen (“Run current script (F5)”) and observe the onboard board’s LED. It will be blinking. I made a video to illustrate the whole process, enjoy and comment below:

Please follow and like us:
Pin Share
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments

RELATED PROJECTS

TOP PCB Companies