Program Directly - ESP8266 Module

You don't have to wire up a separate USB serial converter if you don't like or can't get access to the pins. Instead, you can use miniesptool which will run on a CircuitPlayground Express board.

You will need at least 1MB of disk space on the Express board, so clear off some space for the firmware!
Likewise, your ESP8266 or ESP8285 module must have at least 1MB of Flash - old 512KB ESP-01's wont work!

The library to support the upload is adafruit_miniesptool and it is include in the latest  Bundle or you can  download adafruit_miniesptool from github and install  it on your Express board in the root directory of you CIRCUITPY drive.

Also grab the firmware binaries esp8266/ folder from the ESP8266 Firmware Zip file in the Firmware files page, and copy it to the root directory of your CIRCUITPY drive

Note: in the screenshot below, adafruit_miniesptool.py in in the root directory -- If you are using it from the bundle and placed in /lib then you will not see it.

We'll be using a Feather M4 to demonstrate, M0 boards may not have enough memory! Wire up the ESP8266 module as shown:

  • VBat from ESP8266 to VBat on Feather M4 (if your board doesn't have a Battery power pin, skip this)
  • Vin from ESP8266 to VUSB on Feather M4 - use whatever 5V (no higher!) power source you have
  • GND to GND
  • ESP8266 Reset to D5 (you can use any pin)
  • ESP8266 GPIO #0 to D6 (you can use any pin)
  • ESP8266 RX to UART TX
  • ESP8266 TX to UART RX

Note the UART pins are 'cross wired' - RX to TX

Save the following esp uploading example as miniiesptool_esp8266program.py

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

import time
import board
import busio
from digitalio import DigitalInOut
import adafruit_miniesptool

print("ESP8266 mini prog")

uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=1)
resetpin = DigitalInOut(board.D5)
gpio0pin = DigitalInOut(board.D6)
# On ESP8266 we will 'sync' to the baudrate in initialization
esptool = adafruit_miniesptool.miniesptool(
    uart, gpio0pin, resetpin, flashsize=1024 * 1024, baudrate=256000
)

esptool.debug = False
esptool.sync()

print("Synced")
print(esptool.chip_name)
print("MAC ADDR: ", [hex(i) for i in esptool.mac_addr])
esptool.flash_file("esp8266/AT_firmware_1.6.2.0.bin", 0x0)
# 0x3FC000 esp_init_data_default_v05.bin
esptool.flash_file("esp8266/esp_init_data_default_v05.bin", 0x3FC000)
# 0x3FE000 blank.bin
esptool.flash_file("esp8266/blank.bin", 0x3FE000)
esptool.reset()
time.sleep(0.5)

Change the GPIO0 and Reset pin assignment if necessary.

Open up the serial connection and connect to the REPL then type:

import miniesptool_esp8266program

to start the uploading process, it will take a few minutes

When complete, you may delete the esp8266/ folder to free up space.

This guide was first published on Dec 16, 2018. It was last updated on Mar 28, 2024.

This page (Program ESP8266 via CircuitPython) was last updated on Mar 28, 2024.

Text editor powered by tinymce.