Skip to content

Instantly share code, notes, and snippets.

@caseyanderson
Last active August 10, 2022 06:27
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caseyanderson/6030e04ff59acafa6f016b45ff505c94 to your computer and use it in GitHub Desktop.
Save caseyanderson/6030e04ff59acafa6f016b45ff505c94 to your computer and use it in GitHub Desktop.
describes the installation procedure for MicroPython development under Windows 10

Micropython Pre-flight (Windows 10)

by Casey Anderson

Reference

Materials

Install Anaconda

  1. Go to the downloads section of the Anaconda website here
  2. (On the same page) Scroll down until you see three buttons, one for each operating system supported by Anaconda. Click on Windows
  3. (On the same page) Find the header reading Python 3.7 version and click the Download button just below it
  4. Install Anaconda
  5. Click on the Start menu, you should be able to find an application called Anaconda Powershell Prompt. Launch that application
  6. Run the following in the Anaconda Powershell Prompt: conda info

Create A Conda Environment

In the Anaconda Powershell Prompt:

  1. conda create -n micropython python=3.7
  2. conda activate micropython
  3. pip install esptool
  4. pip install adafruit-ampy
  5. conda list (confirms that esptool and ampy have been installed)
  6. cd Documents
  7. mkdir micropython
  8. cd micropython

Micropython firmware

  1. Go to the Downloads section of the micropython site here and scroll down until you see a header reading Firmware for ESP32 boards
  2. Download the latest Standard Firmware (esp32-20190529-v1.11.bin as of this writing)
  3. (In the Anaconda Powershell Prompt): conda activate micropython
  4. Move the .bin file you just downloaded to the micropython folder. For example, if you downloaded the file to Downloads, navigate to that folder in Anaconda Powershell Prompt and run the following: mv esp32-20190529-v1.11.bin ..\Documents\micropython

Install SiLabs Driver for ESP32

This driver enables communication between a PC and the ESP32 via USB

  1. Go here and find the header reading Download for Windows 10 Universal (v10.1.7 as of this writing)
  2. Click on the link reading Download VCP for Windows 10 Universal to intiate the download
  3. Install the driver

Device Manager

  1. Connect your ESP32 to your PC
  2. Open Device Manager
  3. Scroll to Ports and click to expand
  4. Find the line reading Silicon Labs CP210x USB to UART Bridge. At the end of that line you should see COM followed by a number (example: COM3). This identifies where your ESP32 is on your PC so write it down somewhere for use later.

Configure ESP32

  1. (In Anaconda Powershell Prompt) cd Documents (or wherever you put your micropython folder)
  2. cd micropython
  3. pwd to confirm you are in the right folder
  4. ls to confirm that the .bin file is the micropython folder
  5. Erase the software that is already on the ESP32: esptool --port COM3 erase_flash
  6. Drivers in windows are a little wonky (sorry), so one of the following steps should write the .bin file to the ESP32. Start with the first one and, if you get errors, try the second one:
  • v1: esptool --port COM3 --baud 460800 write_flash --flash_size=detect 0 esp8266-20171101-v1.9.3.bin
  • v2: esptool --port COM3 write_flash 0x1000 esp8266-20171101-v1.9.3.bin
  1. When esptool is done activate the default conda environment to shut it down: conda activate
  2. Quit the Anaconda Powershell Prompt

Install Putty

Putty is an ssh and serial connection client for Windows. We will use it to access the Micropython REPL

  1. Go to the Putty download site here
  2. Find the header MSI (‘Windows Installer’), underneath it you should see a link to download putty 64-bit (putty-64bit-0.71-installer.msi as of this writing).
  3. Install Putty
  4. Go to the Start menu, locate and launch Putty
  5. Set Putty to a serial connection and then enter the following information:
  • Serial Port: COM3 (note: see Device Manager to confirm the port number for your ESP32)
  • Baud Rate: 115200
  1. Click Open. You will probably see a bunch of startup text and then the micropython command prompt: >>>
  2. Print "hello world!" with the micropython REPL: print("hello world!")
  3. Close Putty to shut down the connection

File Management on the ESP32

  1. Save this Python file to your Documents/micropython folder
  2. (In Anaconda Powershell Prompt) conda activate micropython
  3. cd Documents/micropython
  4. Run blink.py on the ESP32: ampy --port COM3 run blink.py. Stop running the script by typing Ctl-C and then power cycle the ESP32
  5. To store the file on the ESP32: ampy --port COM3 put blink.py
  6. To see a file stored on the ESP32: ampy --port COM3 get blink.py
  7. To remove a file from the ESP32: ampy --port COM3 rm blink.py
  8. Or to see all of the files currently on the ESP32: ampy --port COM3 ls
  9. To shutdown: first activate the default conda environment: conda activate, close the Anaconda Powershell Prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment