Introduction
CircuitPython is an education-focused implementation of Python 3 for microcontrollers, maintained by Adafruit. It simplifies embedded development by letting you write Python code directly on a USB-mounted drive without installing compilers, IDEs, or flashing tools, making hardware programming accessible to beginners and rapid prototypers.
What CircuitPython Does
- Runs Python 3 directly on microcontrollers with 256 KB+ RAM and 32-bit processors
- Mounts the board as a USB drive so code files can be edited with any text editor
- Provides 400+ libraries for sensors, displays, motors, LEDs, and communication protocols
- Includes a serial REPL console for interactive debugging over USB
- Supports 500+ boards from Adafruit, Raspberry Pi, SparkFun, Seeed Studio, and others
Architecture Overview
CircuitPython is a fork of MicroPython with modifications for USB workflow, API consistency, and beginner friendliness. It runs a bytecode interpreter on the microcontroller that reads code.py from the filesystem on each reset. The USB stack provides both a mass storage device (for code editing) and a CDC serial port (for REPL). Hardware abstraction layers map board-specific pins and peripherals to a consistent Python API across different chip families including RP2040, ESP32-S3, nRF52840, and SAMD51.
Self-Hosting & Configuration
- Download the correct UF2 firmware for your board from circuitpython.org
- Enter bootloader mode (usually double-tap reset) and drag the UF2 file to the boot drive
- Place Python code in
code.pyon the CIRCUITPY drive; it runs automatically on save - Install libraries by copying
.mpyfiles from the Adafruit CircuitPython Bundle to thelib/folder - Use
circupCLI tool to manage library installation and updates:pip install circup && circup install adafruit_neopixel
Key Features
- No toolchain required: edit code with any text editor, save to USB drive, and it runs
- Built-in USB HID, MIDI, and serial support for custom input devices and instruments
- Wi-Fi and Bluetooth support on ESP32 and nRF boards for IoT applications
displayiolibrary for driving OLED, TFT, and e-ink displays with graphics and text- Active community with weekly releases and broad board support
Comparison with Similar Tools
- MicroPython — More portable and lower-level; CircuitPython prioritizes beginner experience and USB workflow
- Arduino (C/C++) — Faster execution and more memory-efficient; CircuitPython trades performance for ease of use
- PlatformIO — Professional embedded toolchain; CircuitPython needs no build tools at all
- Raspberry Pi OS — Full Linux on Pi hardware; CircuitPython runs on bare-metal microcontrollers
- Espressif IDF — Low-level ESP32 SDK; CircuitPython abstracts hardware for rapid prototyping
FAQ
Q: What boards are supported? A: Over 500 boards including Raspberry Pi Pico, Adafruit Feather, ESP32-S3 boards, and many others. See circuitpython.org/downloads for the full list.
Q: Is CircuitPython fast enough for real projects? A: For sensor reading, display driving, and IoT tasks it works well. For timing-critical applications like audio DSP or high-frequency PWM, C/C++ may be more appropriate.
Q: How is it different from MicroPython? A: CircuitPython focuses on USB drive workflow, API consistency across boards, and beginner documentation. MicroPython supports more chips and offers lower-level access.
Q: Can I use regular Python packages? A: No. CircuitPython uses its own library ecosystem optimized for microcontrollers. Standard CPython packages are too large for embedded use.