CircuitPython Microcontroller Programming¶
We use a variety of microcontrollers which use CircuitPython as their operating system and programming language. There are hundreds of different boards available which use CircuitPython. The following sections provide a general usage guide and details for the specific microcontrollers we may use in this course.
The CircuitPython language is compatible across these devices, but individual code samples involving hardware input or output are typically written for a specific platform. However, the samples can generally be ported to a different device with modest changes.
To get started, please read the CircuitPython Introduction, followed by the introductory page for the specific device you will be using.
General CircuitPython Guide¶
Raspberry Pi Pico¶
The Raspberry Pi Pico is a low-cost microcontroller board from the Raspberry Pi Foundation. It has a breadboard-friendly layout and many pins for input and output, but the only built-in I/O device is a single LED. It is our workhorse for building embedded devices and is Physcomp Lab part 1005.
- Raspberry Pi Pico
- Introductory Examples - Raspberry Pi Pico
- Hobby Servo Examples - Raspberry Pi Pico
- Digital Input/Output Examples - Raspberry Pi Pico
- DC Motor Examples - Raspberry Pi Pico
- Analog Input/Output Examples - Raspberry Pi Pico
- Stepper Motor Examples - Raspberry Pi Pico
- Ultrasonic Ranger Examples - Raspberry Pi Pico
- NeoPixel LED Examples - Raspberry Pi Pico
- I2C Examples - Raspberry Pi Pico
- CAP1188 Capacitive Touch Sensing - Raspberry Pi Pico
- Decision Tree Classifier - Raspberry Pi Pico
CircuitPython Universal Examples¶
The following samples are purely computational and should apply to any CircuitPython platform.
Raspberry Pi Pico 2W¶
The “2W” version of the Raspberry Pi Pico 2 includes a faster CPU, more memory, and a WiFi transceiver.
Adafruit Circuit Playground Bluefruit¶
The Circuit Playground Bluefruit (CPB) is a microcontroller board sold by Adafruit which includes several useful sensors, color NeoPixel LEDs, and accessible electrical contacts.
- Adafruit Circuit Playground Bluefruit
- Introductory Examples - Adafruit Circuit Playground Bluefruit
- Quick Reference Guide - Adafruit Circuit Playground Bluefruit
- Soft Sensing Examples - Adafruit Circuit Playground Bluefruit
- Hobby Servo Examples - Adafruit Circuit Playground Bluefruit
- Audio Examples - Adafruit Circuit Playground Bluefruit
- Motor Pump Examples - Adafruit Circuit Playground Bluefruit
- Ticklish Device Example - Adafruit Circuit Playground Bluefruit
- Bluetooth Sensor Capture - Adafruit Circuit Playground Bluefruit
- Bluetooth Remote Control - Adafruit Circuit Playground Bluefruit
Adafruit Crickit with Circuit Playground Bluefruit¶
The Adafruit Cricket is a baseboard which accepts an Circuit Playground Bluefruit (CPB) on top and adds motor drivers, servo output connectors, motor power input, and more.
Cytron Maker Pi RP2040¶
The Cytron Maker Pi RP2040 board integrates a RP2040 microcontroller with hardware suitable for a small robot: two DC motor drivers, four servo connectors, battery input, LED indicators, switches, and seven Grove connectors.
Cytron Maker Pi with Pi Pico¶
The Cytron Maker Pi Pico is a carrier board for a Raspberry Pi Pico which includes buttons, LEDS, speaker, audio jack, SD card slot, and Grove connectors. It doesn’t include the Pi Pico itself.