MQTT Stopwatch / Display

MQTT Stopwatch / Display

Setting Up CircuitPython (MQTT Stopwatch / Display)

Once you've finished assembling your hardware, you should install CircuitPython and the necessary libraries. Adafruit has excellent documentation for this process in their MatrixPortal guide at learn.adafruit.com/adafruit-matrixportal-m4/install-circuitpython .

In very brief terms:

  • Get the .uf2 file for CircuitPython itself from circuitpython.org/board/matrixportal_m4/ and store it somewhere convenient.
  • Plug your Matrix Panel into your computer using a USB-C cable; no power cable is necessary at this point.
  • Double-click the Reset button on the MatrixPortal board, and watch for the on-board NeoPixel to turn green (sometimes it takes a couple tries to get the rhythm right). Once the the NeoPixel has turned green, you should be able to check the file manager program on your computer and find a new folder called "MATRIXBOOT".
  • Drag the .uf2 file that you previously downloaded into the "MATRIXBOOT" folder. After a moment, the "MATRIXBOOT" folder will disappear and will be replaced by a folder called "CIRCUITPY".
  • At ths point, the basic CircuitPython installation is complete. You still need to install the libraries relevant to your program though.

If the steps above don't work for you, consult the Adafruit guide for more detailed instructions

Install the Libraries

The Adafruit guide continues at with instructions for downloading libraries. A brief summary of the relevant instructions follows:

  • Get a .zip bundle of the lastest full library set from circuitpython.org/libraries . Click the purple button labelled "Bundle for Version 7.x and save the file somewhere convenient
  • UnZip the file to a convenient location on your computer. This bundle includes A LOT of libraries. You don't need them all (in fact, they probably won't all fit on your device).
  • If your computer is not still plugged in to the MatrixPortal, plug it back in, then use your filemanager to view the "CIRCUITPY" folder.
  • If there is not a folder called "lib" in the "CIRCUITPY" folder, create one. If there IS a folder called "lib" there already, then delete all of the files within it so you can replace them with up-to=date versions.
  • Now you will want to copy the libraries needed to support this project into the "lib" folder from the large folder of libraries that you downloaded and unzipped. It will be handy to open a second file manager window and point it at the unzipped contents. Note that the unzipped folder probably contains 3 subfolders -- "examples", "lib", and "requirements". You want the one called "lib".
  • Copy the following files / folders into the "lib" folder within "CIRCUITPY". Note that the items with .mpy extensions are files, the ones without extensions are folders which should be copied in their entirety into "CIRCUITPY" (copy the folder, not just the folder contents).
    • adafruit_bus_device
    • adafruit_display_text
    • adafruit_esp32spi
    • adafruit_io
    • edafruit_matrixportal
    • adafruit_minimqtt
    • adafruit_portalbase
    • adafruit_fakerequests.mpy
    • adafruit_requests.mpy
    • neopixel.mpy

Remember that once you've plugged your MatrixPortal in to your computer, it behaves sort of like a Flash Drive. Do not ever unplug it without first performing whatever steps your computer requires to "safely eject" the device.