SwagBadge2022 Installation

From Open Hardware Miniconf
Revision as of 00:36, 13 March 2023 by Jonathan Oxer (talk | contribs) (Resources required)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

GitHub repository: https://github.com/geekscape/aiko_engine_mp

Example firmware for the SwagBadge is written in MicroPython, so the badge will require MicroPython to be installed first.

MicroPython firmware for the SwagBadge 2021 (master branch) will run on the SwagBadge 2022. However, the color LCD screen is not yet supported. Currently, this is an easy way to test networking, MQTT and play with Aiko Services

A work-in-progress firmware (swagbadge_2022 branch) supports the SwagBadge 2022 color LCD screen. However, the LCD screen driver is allocating significant chunks of memory, causing the overall application to crash. So, networking, MQTT and Aiko Services have been temporarily removed, whilst a design and implementation refactor occurs.

Resources required

The following sequence will fetch all the resources required including Aiko Engine and MicroPython. This should only need to be done once.

Create a directory to keep everything in, and change into it:

 mkdir SwagBadge2022
 cd SwagBadge2022

Get Aiko Engine:

 git clone git@github.com:geekscape/aiko_engine_mp.git

Get Aiko Services, which has the SwagBadge examples. We need the swagbadge_2022 branch:

 cd aiko_engine_mp
 git checkout swagbadge_2022
 cd ..

Create a virtual Python environment for Aiko use, and activate it:

 python3 -m venv aiko_env
 . aiko_env/bin/activate

Install the tools we need:

 python3.9 -m pip install --upgrade pip   # To prevent it complaining every time!
 pip install esptool mpfshell

Create a directory to hold the firmware:

 cd aiko_engine_mp
 mkdir firmware

MicroPython installation

Download version v1.17 of the MicroPython binary for ESP32 from here: micropython.org/download/esp32/

The SwagBadge 2022 currently requires microPython version 1.17.

Move the downloaded binary into the "firmware" directory that you created above.

Plug in your ESP32 device and make sure you can see it, e.g ls -l /dev/tty.* will show a serial device file like /dev/ttyUSB0 or /dev/tty.wchserial1410.

Export the serial port to an environment variable, so mpfshell can use it, e.g:

 export AMPY_PORT=/dev/tty.wchserial11410

where the device is the one shown by the ls -l command above.

If you just did the initial setup you should already be in the "aiko_engine_mp" directory. If not, change into it. Then:

 ./scripts/flash_micropython.sh                        # Flash MicroPython onto the badge

Aiko example installation

With MicroPython on the badge, load the example script:

 ./scripts/mpf_script.sh ./scripts/aiko.mpf