This article will show you how to setup Thonny, an editor that works well with the ESP32, the hardware you’ll need and how to flash Micropython onto the ESP32.
Thonny is a Python editor that works well with the ESP32 and works out of the box. Installation instructions can be found on the Thonny home page https://thonny.org/
Getting the Hardware
You will need an ESP32 WROOM-32 30 pin version and 2 breadboards
You can find them on Aliexpress.
Setting up the ESP32
First you’ll need to download the firmware fo the ESP32. It can be found here https://micropython.org/download/esp32/ . You’ll want the ESP-IDF v3.x, with support for BLE, LAN and PPP. You’ll want GENERIC unless you have external ram.
Now open Thonny and go to Tools > Manage plug-ins… in the menu. Search for “esptool” and install it.
Plug your ESP32 into you computer.
Now go to Tools > Options > Interpreter.
Select MicroPython(ESP32) from the first box.
Select the port.
Now click on “Install or update firmware” (above OK button).
Select the port. Then click browse to find the firmware you downloaded earlier.
Wait for it to install. Now your ESP32 is ready for its first program.
from machine import Pin from time import sleep led = Pin(2, Pin.OUT) while True: led.on() sleep(1) led.off() sleep(1)
Click the green button with a triangle or go to Run->Run current script, you can also hit F5
You can either save a file locally or to the device
To save go to File->Save Copy… this will give option to save locally or to the device.
If the code you are running is saved to the device you’ll have to stop the script before saving.
If you are running files locally, if you import or open another file it won’t work. Those files need to be saved to the device. Red button or Ctrl+F2