Skip to content

Latest commit

 

History

History
89 lines (66 loc) · 4.39 KB

setup-esp32.md

File metadata and controls

89 lines (66 loc) · 4.39 KB

MicroPython Firmware


MicroPython is not flashed onto the ESP32 or ESP8266 boards by default. The first thing you need to do to start programming your boards with MicroPython is upload the firmware.

Download ESP32 MicroPython Firmware


  1. Go to the ESP32 MicroPython Downloads page: https://micropython.org/download/esp32/

  2. Scroll your mouse to the very bottom of the web then you should see Firmware (Compiled with IDF 3.x).

  3. Select the lastest release to download .bin files.

  4. The firmware (.bin) should be downloaded.

Download and Installing USB Driver.


Before you connect the Micro USB to your computer, you should install the USB Driver first, otherwise Thonny might not find your USB port.

The driver is different depending on the chip on the ESP32. But the most ESP32 use CP210x USB to UART Bridge VCP Drivers. Click here to nevigate to the download page.

For Windows, select CP210x Windows Drivers, then the driver should start downloading. For Mac OSX, the driver should be built in with the OS, so there is no need to download it.

After downloading the CP210x Driver, complete the installation by running the installer.

Installing ESP32 MicroPython Firmware


  1. Connect the Micro USB to the ESP32.
  2. Open Thonny IDE.
  3. Click the Run menu on the top of the window.
  4. Then in the dropdown menu click Select Interpreter
  5. In the option window,change the The same interpreter which run Thonny (Default Interpreter) to MicroPython ESP32.
  6. Then select your computer port for your ESP32 port.

  1. After the port is selected, click Install or update firmware on the right bottom.
  2. In the port entry, select your ESP32 port.
  3. Then in the firmware entry, browse to your firmware file (.bin).
  4. After that, press and hold the Boot button on the ESP32, then click Install and wait until done.
  5. Close the option window and go back to Thonny IDE.
  6. The Shell should prompt MicroPython v<version> on <last update> and ESP32 module with ESP32.Then the left-buttom menu will show boot.py inside the MicroPython Device window. (If you do not see the MicroPython Device window, click the view menu on the top, then on the dropdown select the File menu. The window should appear.)

Testing your MicroPython


  1. Click the New menu on the top (or Ctrl+N) to create a new file, then save it as main.py
  2. After that, in the editor coppy the following code.
from machine import Pin
print('Hello World!')
  1. Save the new file by click save (Ctrl+S) to This computer and Run (F5).
  2. In the Shell will display Hello Wolrd.

Deploy your code


When you finish the code and want to save it on the ESP32.

  1. Right click the main.py in This computer window.
  2. Select upload to and wait until the upload is complete.
  3. The upload file will show in MicroPython Device window. (If you do not rename it to main.py, it will not work.)
  4. Press the EN button on the board then the ESP32 should be reboot.

Upload External Library


To use an external or custom library, you need to upload the library file to the MicroPython device before running or deploying your code. 

The process is the same as uploading main.py to a MicroPython device.

  1. Right click the library file in This computer window.
  2. Select upload to and wait until the upload is complete.
  3. The upload file will show in MicroPython Device window.