Lesson plan

Embedded on the Raspberry Pi Pico lesson plan

A dual core Cortex-M0+ at 125 MHz. PWM on every pin, a 64 bit clock, and pins that do not forgive 5 V.

4 chapters, 7 lessons, about 6 hours, on the Raspberry Pi Pico. Every lesson runs in the browser, with nothing to install.

The unit

Objectives and materials

By the end, students can

  • Drive a pin, read a pin, and learn what this chip will not tolerate.
  • Six lamps from an array, and PWM on any pin you like.
  • The monitor both ways, and a loop that never waits.
  • A blank page, six lamps and a way to measure what you built.

Materials for the whole unit

  • Full-size breadboard
  • LED x 6
  • Pushbutton
  • Raspberry Pi Pico
  • Resistor x 6

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.

Chapter 1. About 1 h 40 min

The board

Drive a pin, read a pin, and learn what this chip will not tolerate.

LessonTimeWhat students do
First light on the PicoAn LED on GP15, a second one inside the module, and a board that keeps its program in a separate flash chip. Where the RP2040 is different.50 min
  1. The board, and where its program lives
  2. Run it
  3. The lamp you can see
  4. Both pins, checked separately
  5. Blink it faster
  6. What this board has that the others do not
Reading a pinA button on GP15 with the pad pull-up on, a lamp on GP14, and the pad configuration that sits under one line of Arduino code.50 min
  1. One line, three registers
  2. Watch it go low
  3. And the lamp follows
  4. Check the output pin too
  5. Turn it round
  6. The one thing this board will not forgive

Materials

  • LED
  • Pushbutton
  • Raspberry Pi Pico
  • Resistor

Check for understanding

Each student finishes "Reading a pin" 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: "The one thing this board will not forgive".

Chapter 2. About 1 h 40 min

More than one of everything

Six lamps from an array, and PWM on any pin you like.

LessonTimeWhat students do
Six pins and an arrayA dot sweeping along six LEDs, driven from a list of pin numbers. Arrays, loop bounds, and where the idea stops scaling.50 min
  1. One pin per lamp
  2. Run it
  3. All the way along
  4. Watch a pin in the middle
  5. Slow it down
  6. Where one pin per lamp stops
PWM on any pinEvery GPIO on this chip has a PWM channel, which is unusual. Slices, channels, and what the divider is actually doing.50 min
  1. Eight slices, two channels each
  2. Run it and watch it breathe
  3. What 0 and 255 really do
  4. Where the frequency comes from
  5. Make the breath faster
  6. What PWM is good and bad at

Materials

  • Full-size breadboard
  • LED x 6
  • Raspberry Pi Pico
  • Resistor x 6

Check for understanding

Each student finishes "PWM on any pin" 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: "What PWM is good and bad at".

Chapter 3. About 1 h 40 min

Talking and timing

The monitor both ways, and a loop that never waits.

LessonTimeWhat students do
The board talks and listensUART0, the monitor, and an echo. The one debugging tool you always have, and what it costs to use it.50 min
  1. Nothing is wired, and that is the circuit
  2. Say hello
  3. The uptime, from a 64 bit counter
  4. Type something
  5. Add a line of your own
  6. What printing costs
Timing without delayThe chaser is written with delays, so it can do nothing else. Rewrite it around the microsecond timer and it can do anything.50 min
  1. What the sweep cannot do
  2. Run it as it is
  3. Rewrite it around the clock
  4. Two details that are not optional
  5. Now add the thing it could not do before
  6. What you would use micros for

Materials

  • Full-size breadboard
  • LED x 6
  • Raspberry Pi Pico
  • Resistor x 6

Check for understanding

Each student finishes "Timing without delay" 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: "What you would use micros for".

Chapter 4. About 50 min

Make it yours

A blank page, six lamps and a way to measure what you built.

LessonTimeWhat students do
Project: make the sweep yoursSix lamps and a blank page. Change the pattern, count the passes, report them, and measure how long your own loop takes.50 min
  1. What you have to work with
  2. Change the pattern
  3. Count what it does
  4. Measure yourself
  5. Pick one and finish it
  6. What you would reach for next

Materials

  • Full-size breadboard
  • LED x 6
  • Raspberry Pi Pico
  • Resistor x 6

Check for understanding

Each student finishes "Project: make the sweep yours" 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: "What you would reach for next".

Your class

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.