Getting started with Thonny

  1. Download Thonny for your computer and install it.
  2. If you’re on Windows, you’ll also need to download and install the CP210x drivers:
  • Download the current version from SiLabs.
  • Unzip the folder and double-click on the CP210xVCPInstaller_x64.exe file (not the x86 one!)
  • Click your way through the install wizard (it should only take a few seconds)
  1. Download the latest MicroPython image (1.19) here. You don’t need to run the file; just save it somewhere so you can use it in the next step.
  2. Plug in your ESP32, and flash MicroPython to it:
  • In Thonny, select Run > Select Interpreter
  • Select MicroPython (ESP32) at the top
  • Make sure the port is correct (in general there will only be one choice)
  • Click “Install or update firmware” in the bottom-right
    • If you’re not able to open the dialog, you may need to install esptool
    • Go to Tools > Manage Plug-Ins, search for “esptool”, and click “Install”
  • Select the port (again) and the firmware file you downloaded, and click “Install”
  • It will take a couple of minutes to complete, and then you’re ready to go!

Installing libraries

To use a library that isn’t included in MicroPython by default, you’ll need to save a copy of the library onto the ESP32.

  • Download the library from the internet to your computer. This will just be a normal Python code file, with a .py extension.
  • Open the file in Thonny (from wherever you’ve saved it on your computer).
  • Select File > Save copy and then select “MicroPython device”.
  • In the file dialog that appears, give it the same name (e.g., ssd1306.py)
  • Click “OK”, and it should complete in a few seconds.

All done!

Some libraries we’re using

Right-click to save these to your computer.

How much room do I have for libraries?

Not much… and quite a lot. When flashed with MicroPython, the ESP32 chips we have 2MB of memory available for libraries and code. By modern computer standards, that’s not very much. However, 2MB is enough to hold tens of thousands of lines of code. As long as you’re just writing code and not storing images or other large data files, you should have plenty of space.

To see how much space is left on the device, you can open the Thonny file browser (View > Files), click the “hamburger” menu icon next to “MicroPython device”, and select “Storage space”.

Other resources