CircuitPython Device Support โ
Documentation in Progress
This documentation is currently being developed. CircuitPython support is in beta with core functionality implemented.
Status: ๐งช Beta support, ๐ Documentation in progress
Expected completion: After CircuitPython validation testing
Coming Soon โ
This page will provide setup and usage guidance for CircuitPython devices, including:
- Supported Boards: Adafruit and community CircuitPython boards
- Firmware Installation: CircuitPython firmware installation process
- Library Management: Installing and managing CircuitPython libraries
- Pin Compatibility: CircuitPython vs MicroPython pin differences
- Feature Limitations: Known limitations and workarounds
- Adafruit Ecosystem: Integration with Adafruit learning guides
- Performance Considerations: CircuitPython-specific optimizations
Current Beta Status โ
CircuitPython devices work with Belay.NET using the same Raw REPL protocol as MicroPython, but there are some differences:
โ Working Features โ
- Basic device connection and communication
- Code execution via Raw REPL protocol
- File transfer capabilities
- Most attribute-based programming patterns
๐ Limitations (Beta) โ
- Some MicroPython-specific modules not available
- Different pin naming conventions
- Library compatibility differences
- Performance variations
Quick Start Preview โ
csharp
// Example of what's coming - CircuitPython device control
public class CircuitPythonController : Device
{
[Setup]
public async Task InitializeCircuitPythonAsync()
{
await ExecuteAsync(@"
import board
import digitalio
import analogio
# Built-in LED (varies by board)
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
# Analog input
analog_in = analogio.AnalogIn(board.A0)
# Digital input with pull-up
button = digitalio.DigitalInOut(board.BUTTON)
button.direction = digitalio.Direction.INPUT
button.pull = digitalio.Pull.UP
");
}
[Task]
public async Task SetLedAsync(bool state) =>
await ExecuteAsync($"led.value = {(state ? "True" : "False")}");
[Task]
public async Task<bool> ReadButtonAsync() =>
await ExecuteAsync<bool>("not button.value"); // Inverted for pull-up
[Task]
public async Task<int> ReadAnalogAsync() =>
await ExecuteAsync<int>("analog_in.value");
[Task]
public async Task<float> ReadAnalogVoltageAsync() =>
await ExecuteAsync<float>("analog_in.value * 3.3 / 65536");
}
// Usage
using var device = Device.FromConnectionString("serial:COM3");
await device.ConnectAsync();
var controller = new CircuitPythonController();
await controller.InitializeCircuitPythonAsync();
// Control LED
await controller.SetLedAsync(true);
await Task.Delay(1000);
await controller.SetLedAsync(false);
// Read sensors
var analogValue = await controller.ReadAnalogAsync();
var voltage = await controller.ReadAnalogVoltageAsync();
Console.WriteLine($"Analog: {analogValue}, Voltage: {voltage:F2}V");
Popular CircuitPython Boards โ
Adafruit Feather Series โ
- Feather M4 Express: SAMD51 @ 120MHz
- Feather ESP32-S2: WiFi-enabled with native USB
- Feather RP2040: Raspberry Pi RP2040 chip
Adafruit ItsyBitsy Series โ
- ItsyBitsy M4: Compact SAMD51 board
- ItsyBitsy RP2040: Tiny RP2040 board
Raspberry Pi Pico โ
- CircuitPython Support: Alternative firmware to MicroPython
- Pin Compatibility: Same hardware, different software approach
Key Differences from MicroPython โ
Pin Naming โ
csharp
// MicroPython style
await device.ExecuteAsync("from machine import Pin; led = Pin(25, Pin.OUT)");
// CircuitPython style
await device.ExecuteAsync("import board, digitalio; led = digitalio.DigitalInOut(board.LED)");
Library Structure โ
csharp
// MicroPython
await device.ExecuteAsync("from machine import ADC, Pin; adc = ADC(Pin(26))");
// CircuitPython
await device.ExecuteAsync("import board, analogio; adc = analogio.AnalogIn(board.A0)");
Module Availability โ
- CircuitPython: Rich Adafruit library ecosystem
- MicroPython: More low-level hardware access
- Compatibility: Some modules may not be interchangeable
Library Management โ
CircuitPython Bundle โ
CircuitPython uses a different library system:
- Download CircuitPython library bundle from Adafruit
- Copy required libraries to
/lib
folder on device - Import libraries in your Python code
Common Libraries โ
adafruit_motor
: Motor controladafruit_sensors
: Various sensor driversadafruit_display
: Display driversneopixel
: RGB LED strips
Validation Status โ
Feature | Status | Notes |
---|---|---|
Basic Communication | โ Working | Raw REPL compatible |
File Transfer | โ Working | Standard file operations |
Attribute System | โ Working | Task, Setup, Thread, Teardown |
Error Handling | โ Working | Exception mapping functional |
Library Compatibility | ๐ Testing | Some MicroPython libraries incompatible |
Performance | ๐ Testing | Evaluating vs MicroPython |
Related Documentation โ
- Hardware Compatibility - Full compatibility matrix
- Getting Started - Basic setup guide
- Attribute Programming - Using attributes with CircuitPython
- Raspberry Pi Pico - Pico with CircuitPython
Need immediate help? Check CircuitPython documentation or our GitHub Discussions for CircuitPython-specific questions.