CircuitPython on the Pico lesson plan
Python on real hardware, from your first code.py: LEDs and buttons, knobs and PWM, NeoPixels, I2C sensors and an OLED with displayio, all on Adafruit’s official firmware, ending in a mood light you design.
Objectives and materials
By the end, students can
- code.py, and pins that are on or off.
- Analog readings, PWM and NeoPixels.
- An I2C sensor and a screen.
- A mood light built from the whole course.
Materials for the whole unit
- Addressable RGB LEDs
- LED
- OLED display, 128x64
- Potentiometer
- Pressure, humidity and temperature, BME280
- Pushbutton
- Raspberry Pi Pico
- Resistor
Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.
First steps
code.py, and pins that are on or off.
| Lesson | Time | What students do |
|---|---|---|
| code.pyYour first CircuitPython program: print, a variable, a loop, and what happens when code.py ends. How the CIRCUITPY drive and auto-reload make every save a new run. | 45 min |
|
| digitalioPins that are on or off: an LED as an output, a button as an input with a pull-up, blinking without sleep() so the button is never missed, and counting presses. | 45 min |
|
Materials
- Addressable RGB LEDs
- LED
- OLED display, 128x64
- Potentiometer
- Pressure, humidity and temperature, BME280
- Pushbutton
- Raspberry Pi Pico
- Resistor
Check for understanding
Each student finishes "digitalio" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Sleep or monotonic".
Knobs and light
Analog readings, PWM and NeoPixels.
| Lesson | Time | What students do |
|---|---|---|
| analogio and pwmioBetween on and off: read a knob as a number from 0 to 65535 with analogio, turn it into volts, and dim an LED with pwmio by switching it on and off a thousand times a second. | 35 min |
|
| NeoPixelsEight color LEDs on one wire: colors as (red, green, blue) tuples, fill and single pixels, show() to send them all, brightness, and a chase in your own color. | 35 min |
|
Materials
- Addressable RGB LEDs
- LED
- OLED display, 128x64
- Potentiometer
- Pressure, humidity and temperature, BME280
- Pushbutton
- Raspberry Pi Pico
- Resistor
Check for understanding
Each student finishes "NeoPixels" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Power".
Sense and show
An I2C sensor and a screen.
| Lesson | Time | What students do |
|---|---|---|
| I2C sensorsTwo wires, many chips: scan the I2C bus for addresses, read temperature, humidity and pressure from a BME280 with Adafruit’s library, and turn Celsius into Fahrenheit. | 45 min |
|
| displayio basicsText on a 128 x 64 OLED with displayio: a display, a Group of Labels, the built-in terminal font, scale, and a counter that redraws itself when its text changes. | 35 min |
|
Materials
- Addressable RGB LEDs
- LED
- OLED display, 128x64
- Potentiometer
- Pressure, humidity and temperature, BME280
- Pushbutton
- Raspberry Pi Pico
- Resistor
Check for understanding
Each student finishes "displayio basics" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "One way for every screen".
Project
A mood light built from the whole course.
| Lesson | Time | What students do |
|---|---|---|
| Project: a mood lightEverything together: a knob picks the color, a button steps through glow, breathe, rainbow and off, the BME280 turns it warm red when the room is hot, and the OLED says what it is doing. | 60 min |
|
Materials
- Addressable RGB LEDs
- LED
- OLED display, 128x64
- Potentiometer
- Pressure, humidity and temperature, BME280
- Pushbutton
- Raspberry Pi Pico
- Resistor
Check for understanding
Each student finishes "Project: a mood light" on their own, without opening the hints. The simulator checks 8 of its 8 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Build it for real".
Teach this unit as a class
Start a class from this course and its 7 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.
The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.