Arduino Setup Guide - ISS-Mimic/Mimic GitHub Wiki

Flashing the Arduino and Adafruit Metro M0 Boards


1 Install the Arduino IDE

  1. Grab the latest “Arduino IDE 2” from https://arduino.cc/software and install with default options.
  2. Launch it once so the preferences file is created.

You can keep IDE 1.x side-by-side; they share boards + libraries.


2 Add the Adafruit SAMD core (Metro M0 = ATSAMD21)

  1. File ▸ Preferences ▸ Additional Boards Manager URLs → paste
    https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
  2. Tools ▸ Board ▸ Boards Manager
    Search “Adafruit SAMD”Install.
  3. Restart the IDE so the new tool-chain loads.

(Installing the official Arduino SAMD Boards package as well won’t hurt and is recommended by most tutorials.)


📚 3 Install common libraries once

Install each of the libraries in the table below once via Tools ▸ Library Manager (or arduino-cli lib install …).
Anything not listed ships with the Arduino IDE or the Adafruit SAMD core already (e.g. Wire.h, SPI.h, Servo.h, String.h, string.h, etc.) and therefore needs no manual action.

Sketch folder(s) that pull it in Library to install Notes
LED Controller FastLED 3.6.0 Needs to be version 3.6.0 or it might not compile on Metro M0s (other boards might work)
Port_BGA, Starboard_BGA, SARJ_TRRJ Encoder (by Paul Stoffregen) Reads the quadrature shaft encoders on the BGAs
Port_BGA, Starboard_BGA, SARJ_TRRJ Adafruit Motor Shield v2 Library
(brings in utility/Adafruit_MS_PWMServoDriver.h)
Drives the dual-stepper TB6612 FETs on the Motor Shield

Quick one-liner (CLI users)

arduino-cli lib install \
  "[email protected]" \
  Encoder \
  "Adafruit Motor Shield V2 Library" \

Why isn’t string.h in the table?

<string.h> is part of the standard C library baked into every Arduino core, so nothing extra is needed.

With the above libraries installed, every .ino in the active folders will compile cleanly on a fresh Arduino IDE setup.


4 Wiring & USB sanity checks

  • Use a known-good USB 2.0 data cable (power-only cables are the #1 “won’t upload” cause).
  • Normal draw for a Metro M0 is < 150 mA, so powering from a Pi hub or your PC is fine.
  • The board should enumerate as
    Windows: COMxx – Adafruit Metro M0 Express
    macOS/Linux: /dev/cu.usbmodem… or /dev/ttyACM…

If you only see a generic USB serial device, double-tap RESET to enter the UF2 boot-loader; it will re-enumerate with the proper name.


5 Repo layout (one-time)

Inside Mimic/Arduino/ you’ll find one folder per microcontroller:

Folder Uploads to Notes
Ard_PortBGAs_r18 Port-side Solar Array Controller
Ard_StbdBGAs_r18 Starboard-side Solar Array Controller
Ard_SARJs_TRRJs_r18 SARJ and TRRJ Controller
Mimic_LED_Controller LED Controller Board

Each folder is already a sketch: the .ino file must match the folder name for the Arduino IDE to open it cleanly (repo is already set up this way).


6 Flashing a board

  1. Connect only the board you’re about to program.
  2. File ▸ Open → pick the folder; IDE loads ⟨folder⟩.ino.
  3. Tools ▸ Board → Adafruit SAMD → “Adafruit Metro M0 Express (SAMD21)”
  4. Tools ▸ Port → select the Metro’s port.
  5. Sketch ▸ Verify/Compile – catches missing libraries early.
  6. Sketch ▸ Upload (or press ).

Upload time ≈ 15 s.
If you see No device found on tty…, double-tap RESET and choose the new “Bootloader” port that appears, then upload again.


🔧 Troubleshooting Guide

Symptom Likely Cause Recommended Fix
SAM-BA operation failed Brown-out while flashing Use a powered USB hub or unplug high-draw peripherals during upload.
“No device found” Board not in boot-loader Double-tap RESET, then choose the new “Bootloader” port in Tools ▸ Port.
xyz.h: No such file Missing library Install the library via Tools ▸ Library Manager and re-compile.
Upload hangs at 0 % Wrong board selected Set Tools ▸ Board to Adafruit Metro M0 Express (SAMD21).
Random resets at runtime 5 V servo draws too much current Power servos from a separate, regulated 5 V rail instead of the Metro’s 5 V pin.

Still stuck? See Adafruit’s Metro M0 and generic SAMD troubleshooting pages for deeper dives.


Future Upgrades: Re-connecting multiple Metros

After all sketches are loaded you can plug every Metro back into the Pi’s powered hub. For future in-situ updates:

  • Label each USB cable with its subsystem – or –
  • Give each sketch a unique USB string:
// in setup()
#define USB_PRODUCT "ISS-Mimic Port BGA"
The Adafruit SAMD core exposes this macro; recompiling makes the OS label
the port with your custom text.
⚠️ **GitHub.com Fallback** ⚠️