Lab Notebook

Running Python on the Huzzah Feather

device

I always forget that the esp boards are a pain since you can't just drag file to them over usb serial, you have to use a bunch of utilities to do stuff; every time I say I'll get the better board next time, and then every time I get the esp board that is a pain to deal with. From the main page they make you think you need to use chrome to webload the firmware on, but easier than installing a spyware infested browser, is just using esptool.

Manually loading the firmware without the web loader

  • pip install esptool
  • esptool.py --port /dev/cu.usbserial-5AA60813031 erase_flash
  • esptool.py --port /dev/cu.usbserial-5AA60813031 --baud 460800 write_flash -z 0x0 resources/adafruit-circuitpython-adafruit_feather_huzzah32-en_US-10.1.3.bin

Connecting to the board

  • picocom -b 115200 /dev/cu.usbserial-5AA60813031
  • Ctrl+A Ctrl+X : quit picocom
  • Ctrl+A Ctrl+H : help

Setting up WIFI on the board

f = open("settings.toml", "w")
f.write('CIRCUITPY_WIFI_SSID = "your_wifi_name"\n')
f.write('CIRCUITPY_WIFI_PASSWORD = "your_wifi_password"\n')
f.write('CIRCUITPY_WEB_API_PASSWORD = "your_api_password"\n')
f.close()

Reset the board and then connect to http://circuitpython.local
or connect via picocom and the ip is in the title bar

Python code to get your IP from the repl:

import wifi

print("My MAC addr: %02X:%02X:%02X:%02X:%02X:%02X" % tuple(wifi.radio.mac_address))
print("My IP address is", wifi.radio.ipv4_address)

Updating the code

welcome

You can connect to circuitpython.local and edit/upload the code,

files

or like most normal people, you can just use a Makefile that uploads your code via ampy

PORT := /dev/cu.usbserial-5AA60813031

build:
    ampy --port $(PORT) put code.py

flash:
    esptool.py --port $(PORT) erase_flash
    esptool.py --port $(PORT) --baud 460800 write_flash -z 0x0 adafruit-circuitpython-adafruit_feather_huzzah32-en_US-10.1.3.bin