You need to use Python on your PC to program the ESP32. This assumes that you already have miniconda installed. For more instructions, see here for detailed instructions.
(optional) Activate your desired environment conda activate <environment_name>
.
You can ignore if you want to install in the base environment
type the following to install a prerequisite package
conda install -y -c conda-forge wrapt
Install the ESP32 commandline flashing tool
pip install esptool
To install Thonny type the following (This is optional):
pip install thonny
Note: on Mac, open up terminal or xterm and type pip3 install esptool thonny
The device drivers will help your computer recognize the ESP32 as a USB Device
Install Silabs cp210x driver (windows download)
This step is required if the device is not recognized as a virtual COM port.
Open Device Manager and Select Update Driver |
Browse specific directories |
Select the directory |
Let it Install |
Done |
Requires thonny to be installed, see above
open cmd and type thonny
Start Thonny |
open up tools–>options, select the “interpreter” tab and ensure that “Micropython (ESP32)” is selected. Select the “Silicon Labs CP210X USB to UART Bridge Com(XY)” down below.
Open Tools–>Options |
Select Interpreter Tab, then the ESP32 Interpreter |
Select the Port |
Selection Made |
Before selecting ok, in the bottom right hand corner select “install or update firmware”. select the right port corresponding to the “Silicon Labs CP210X USB to UART Bridge Com(XY)”
Install or Update Firmware |
select the firmware you downloaded and hit “install”.
Select Firmware File |
Hit install |
wait for the install to finish
Done |
Look at the interpreter window. You should see something similar to:
MicroPython v1.XX on 20XX-YY-ZZ; ESP32 module with ESP32
Type "help()" for more information.
>>>
Blank |
type print('hello, world!')
into the shell and that’s it! You should have a working python interpreter loaded on your ESP32!
Hello World! |
esptool
windows:
esptool --chip esp32 --port COM7 erase_flash
linux:
esptool.py --chip esp32 --port /dev/ttyUSB0 erase_flash
Now flash it using the template below. Check device manager in windows to identify the appropriate COM port
Windows:
esptool --chip esp32 --port <serial_port> write_flash -z 0x1000 <esp32-X.bin>
For Example:
esptool --chip esp32 --port COM7 write_flash -z 0x1000 Downloads/esp32-20220618-v1.19.1.bin
Linux:
esptool.py --chip esp32 --port <serial_port> write_flash -z 0x1000 <esp32-X.bin>
For Example:
esptool.py --chip esp32 --port /dev/ttyUSB0 write_flash -z 0x1000 esp32-20220618-v1.19.1.bin
use terminal or xterm if you have it as Macs do not have powershell
use pip3 install ...
instead of pip install ...
with the most recent flavors of MacOS
make sure pip
or pip3
(Mac) is updated to avoid installation errors
python3 -m pip install --upgrade pip
Mac doesn’t do COM, but can list USB devices. In your terminal, type:
ls -al /dev/tty.
then unplug your ESP32 and run the previous command again to see which name for the device is the ESP32
when selecting the port, there may be two Silicon Labs CP210X USB to UART Bridge (ESP device name here) devices. Watch the messages in the terminal to determine the correct selection (obviously, don’t use the one that says error/cannot find/etc.)
when running the program you may need to press ctrl + c twice within thonny
If you install on a computer where you don’t have administrative access, it is still possible to install but you have to remember a couple things:
After instlling anaconda, you must add it to your path every time you want to run it.
Start –> “cmd”
set PATH=C:\Users\<MYUSERNAME>\Miniconda3;C:\Users\<MYUSERNAME>\Miniconda3\Library\mingw-w64\bin;C:\Users\<MYUSERNAME>\Miniconda3\Library\usr\bin;C:\Users\<MYUSERNAME>\Miniconda3\Library\bin;C:\Users\daukes\Miniconda3\Scripts;%PATH%