Micropython How-To with ESP32 Huzzah

I couldn’t find a step-by-step for using MicroPython+Notecarrier AF+Feather ESP32 Huzzah anywhere, so I thought I would document what steps I took here so that others could comment and/or benefit. The official Blues guides (that I could find) for the Huzzah only cover using Arduino.

  1. Assemble the Notecarrier AF with Feather ESP32 Huzzah and Notecard per normal directions.
  2. Download the latest esp32-idf3 MicroPython firmware (I used esp32-idf3-20210202-v1.14.bin)
  3. Connect the USB port on your computer to the micro-USB port on the Feather
  4. Press and hold the B0 button on the Notecarrier; while doing this, press and release the reset button on the Feather.
  5. Open the Adafruit WebSerial ESP Tool in Chrome.
  6. Select a buad-rate of 115200 and press connect and select the COM port associated with the Feather.
  7. Press Erase and wait for completion.
  8. Select the first Choose a file and select the .bin firmware download. Set the offset to 0x1000, then press Program.
  9. After successful program, disconnect the USB and reconnect to it reboot the device.

At this point, MicroPython should be running. I used MobaXTerm to create a serial session to interact with the board.

You can confirm that you can successfully interact with the Notecard by scanning the I2C bus.

>>> import machine
>>> i2c = machine.SoftI2C(scl=machine.Pin(22), sda=machine.Pin(23))
>>> i2c.scan()
[23]

You’ll need the Adafruit MicroPython Tool to place the notecard libraries onto the ESP32. The following commands will checkout the note-python library and install it into the micropython environment (this assumes your serial device in /dev/ttyS4, you will need to adjust that per your environment)

$ git clone https://github.com/blues/note-python.git
$ cd note-python
$ ampy --port /dev/ttyS4 mkdir notecard
$ ampy --port /dev/ttyS4 put notecard/__init__.py notecard/__init__.py
$ ampy --port /dev/ttyS4 put notecard/card.py notecard/card.py 
$ ampy --port /dev/ttyS4 put notecard/env.py notecard/env.py
$ ampy --port /dev/ttyS4 put notecard/file.py notecard/file.py
$ ampy --port /dev/ttyS4 put notecard/hub.py notecard/hub.py
$ ampy --port /dev/ttyS4 put notecard/note.py notecard/note.py
$ ampy --port /dev/ttyS4 put notecard/notecard.py notecard/notecard.py
$ ampy --port /dev/ttyS4 put notecard/validators.py notecard/validators.py

After copying those files, you can return to MobaXterm and

>>> import machine
>>> import notecard
>>> i2c = machine.SoftI2C(scl=machine.Pin(22), sda=machine.Pin(23))
>>> card = notecard.OpenI2C(i2c, 0, 0, debug=True)
>>> req = {"req": "card.version"}
>>> card.Transaction(req)
{"req": "card.version"}
{"body":{"org":"Blues Wireless","product":"Notecard","version":"notecard-1.5.6","ver_major":1,"ver_minor":5,"ver_patch":6,"ver_build":13807,"built":"Oct  7 2021 14:32:14"},"version":"notecard-1.5.6.13807","device":"dev:XXX","name":"Blues Wireless Notecard","sku":"NOTE-NBGL-500","board":"1.11","api":1}
{'version': 'notecard-1.5.6.13807', 'sku': 'NOTE-NBGL-500', 'name': 'Blues Wireless Notecard', 'api': 1, 'device': 'dev:XXX', 'body': {'ver_major': 1, 'org': 'Blues Wireless', 'ver_build': 13807, 'built': 'Oct  7 2021 14:32:14', 'ver_minor': 5, 'ver_patch': 6, 'product': 'Notecard', 'version': 'notecard-1.5.6'}, 'board': '1.11'}

NOTE - On Windows 11 I had to download and install the latest CP210x drivers from here

3 Likes

Thanks @dirtdevil this is great! It’s on our roadmap to flesh out our tutorials with variations such as this.

Rob

Hi, thank you for this! I’m also using esp32 and micropython. @RobLauer did you all ever do additional tutorials? I’m happy to alpha test them if so. And…related, any new info on DFU for micropython/esp32? Other threads on that seem old.

Hi @ljsweeny and welcome to the Blues community!

I’m glad you wrote about additional tutorials - long story short, it’s still on our backlog but I hope to have some out this summer.

We do have some information on using Notecard Outboard Firmware Update with CircuitPython (not MicroPython) if that’s of interest.

Rob

1 Like