Development environment setup and workflow for Universe 2025 (Tufty) Badge with MonaOS. Use when setting up the badge, flashing firmware, debugging, or working with the development toolchain.
Help develop, flash, and debug applications for the Universe 2025 (Tufty) Badge and its MonaOS launcher system.
The Universe 2025 Badge uses:
/system/apps/ directory__init__.py, icon.png, and optional assets/update() function called every frameWhen developing MonaOS apps:
badgeware module API__init__.py and icon.png/system/apps/my_app/ directoryFor MicroPython development:
# Install Thonny IDE (recommended for beginners)
brew install --cask thonny
# Or install command-line tools
pip install esptool adafruit-ampy mpremote
For C++ development:
# Install Pico SDK
git clone https://github.com/raspberrypi/pico-sdk.git
export PICO_SDK_PATH=/path/to/pico-sdk
# List connected devices
ls /dev/tty.usb*
# Connect via serial (MicroPython REPL)
screen /dev/tty.usbmodem* 115200
# Exit screen: Ctrl+A then K
# Put badge in bootloader mode (hold BOOT button, press RESET)
# Flash MicroPython firmware
esptool.py --port /dev/tty.usbmodem* write_flash 0x0 firmware.uf2
mpremote connect /dev/tty.usbmodem* run my_app/__init__.py
⚠️ CRITICAL: /system/apps/ is READ-ONLY via mpremote. You MUST use USB Mass Storage Mode to install apps.
# Step 1: Enter Mass Storage Mode
# - Press RESET button TWICE quickly (double-click)
# - Badge appears as "BADGER" drive
# Step 2: Copy app to badge
# macOS/Linux:
cp -r my_app /Volumes/BADGER/apps/
# Windows:
xcopy my_app D:\apps\my_app\ /E /I
# Step 3: Exit Mass Storage Mode
# - Eject BADGER drive safely
diskutil eject /Volumes/BADGER # macOS
# - Press RESET once to reboot
# Your app now appears in MonaOS launcher!
File System Mapping:
/Volumes/BADGER/apps/ → /system/apps/ on badge/Volumes/BADGER/assets/ → /system/assets/ on badgempremote connect /dev/tty.usbmodem* ls /system/apps
⚠️ Note: Install the paginated menu for unlimited apps (default shows 6):
/Volumes/BADGER/apps/menu/__init__.py in Mass Storage Modempremote connect /dev/tty.usbmodem* ls /storage
mpremote connect /dev/tty.usbmodem* cp :/system/apps/my_app/__init__.py local_backup.py
MonaOS app structure on your computer:
my_app/ # MonaOS app directory
├── __init__.py # Entry point with update() function (required)
├── icon.png # 24x24 PNG icon for launcher (required)
├── assets/ # Optional: app resources (auto-added to path)
│ ├── sprites.png
│ ├── font.ppf
│ └── data.json
└── README.md # Optional: app documentation
Multiple apps in development:
badge-project/
├── my_app/ # First MonaOS app
│ ├── __init__.py
│ └── icon.png
├── game_app/ # Second MonaOS app
│ ├── __init__.py
│ ├── icon.png
│ └── assets/
│ └── sprites.png
├── requirements.txt # Python tools
└── deploy.sh # Deployment script
# In REPL
import sys
sys.print_exception(e) # Print full exception traceback
from badgeware import screen, display, brushes
# Clear with black
screen.brush = brushes.color(0, 0, 0)
screen.clear()
# White text
screen.brush = brushes.color(255, 255, 255)
screen.text("Hello Badge!", 10, 10, 2)
display.update()
import network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect('SSID', 'password')
print(wlan.isconnected())
print(wlan.ifconfig()) # IP address info
import machine
import badgeware
# Check battery level
battery = badgeware.get_battery_level()
print(f"Battery: {battery}%")
# Check if USB connected
usb = badgeware.get_usb_connected()
print(f"USB: {usb}")
# Light sleep (for delays)
machine.lightsleep(1000) # Sleep 1 second
# Deep sleep (wake on button press - saves significant power)
machine.deepsleep()
update() function called every frameupdate() - it runs continuouslyio.ticks for animations instead of time.time()update() to reduce GC pausestry/except blocks to prevent crashesBadge not detected: Check USB cable, try different port, press RESET button
Out of memory: Reduce allocations in update(), use generators, call gc.collect(), free variables with del
Display not updating: MonaOS automatically updates after update() returns - no manual update needed
App not in menu: Check uploaded to /system/apps/my_app/, verify icon.png exists, may need pagination: https://badger.github.io/hack/menu-pagination/
WiFi connection fails: Check credentials, verify 2.4GHz band, restart badge
