ESP32-S Micropython

How to install Micropyton on ESP32-S using a Raspberry Pi

Wire an USB to serial convert to ESP32-S U0TXT, U0RXD and GND and the Raspberry USB port

Close the boot button (IO0 to GND) and turn on the ESP32-S board to enter in download mode

Install pip on Raspberry Pi

sudo apt update
sudo apt install python-pip

Install esptool using pip

pip install esptool

Erase the ESP32-S flash by typing:

./local/esptool.py --port /dev/ttyUSB0 erase_flash

Download the Micropython firmware from https://micropython.org/download/esp32/ then transfer it to the ESP32-S:

./local/esptool.py --chip esp32 --port /dev/ttyUSB0 write_flash -z 0x1000 esp32-idf3-20200902-v1.13.bin

Launch e terminal emulator to get access to the Micropython commadn line

Send Python script to ESP32-S

pip install adafruit-ampy

Blinking led example:

from machine import Pin
import time

led = Pin(2, Pin.OUT) 

while True:
    led.on()
    time.sleep(1)
    led.off()
    time.sleep(1)

NeoPixel example:

import machine
from neopixel import NeoPixel

pin = machine.Pin(16, machine.Pin.OUT)

np=NeoPixel(pin,100)



for i in range(100):
    np[i] = (255,0,0)

np[0]=(0,0,255)
np[99]=(0,255,0)

np.write()

Send a Python script to run at startup:

ampy --port /dev/ttyUSB0 put main.py

Links

Bruna Mandolino