Huzzah32 ESP32: Micropython Setup

Huzzah32 ESP32 Micropython Setup

This tutorial guides how to get started with Huzzah32 ESP32 Micropython Setup. Before getting started with the tutorial, the environment being used is as follows.

Environment:

Preliminary Preparations:

1. Create a virtual environment:

Creating a virtual environment would be a great choice to avoid some conflicts among Python packages.

Once the venv directory was generated, the default directory tree would be as follows.

Let’s create a subdirectory to store codes.

After that, the new directory tree will be as follows.

2. Install the required Python package:

These two packages are useful for Huzzah32 ESP32 Micropython setup. Ampy is a micropython tool that executes codes via serial port. Esptool is a Python tool to communicate with the boot loader for ESP32. By installing these two packages, ampy makes the execution easier and esptool makes flashing easier.

After pip-installed the packages, please double-check if the packages were installed properly by typing the following command.

If these packages below are shown on Terminal, the ampy package and esptool have been installed successfully.

3. Download a Firmware

From this link, https://micropython.org/download/esp32/ download one of the firmware. In this tutorial, the latest firmware is being used.

After being downloaded, let’s create a subdirectory to store the firmware bin file.

Then, the directory tree looks like this:

4. Erase and write the firmware

In order to erase and write the firmware, you can type each command one by one on Terminal. However, I would recommend creating a shell script because simply executing that shell script when flashing the ESP32 again is complete.

Then, the directory tree looks like this:

In the shell script, please add these two lines.

Of course, XXXXXXXX should be replaced by the com port of your ESP32. In order to check the com port on macOS, you can use the following command.

Eventually, my shell script looks like this.

To execute the shell script, simple type:

If the execution is successful, it will look like this

That is all for the preliminary preparations for Huzzah32 ESP32 Micropython Setup. For the next tutorial, I will actually write and execute the code.

Related Post

Leave a Reply

Your email address will not be published.

CAPTCHA