Lesson plan

Embedded on the ESP32-C3 lesson plan

A 32 bit RISC-V board at 160 MHz. Its own peripherals, its own 3.3 V rules, and a console at the end of it.

7 chapters, 13 lessons, about 11 hours, on the ESP32-C3-DevKitM-1. Every lesson runs in the browser, with nothing to install.

The unit

Objectives and materials

By the end, students can

  • One pin, then six, and what a GPIO matrix is for.
  • A pin that reads, and a handler that runs the moment it changes.
  • UART0 both ways, and the start of every protocol.
  • One unit of time, and everything else in proportion to it.
  • PWM by hand, a filter that averages it, and what the peripheral would have cost.
  • Seven segments, then a screen on two wires, then color on one.
  • A memory game and a console, both on a breadboard.

Materials for the whole unit

  • Addressable RGB LEDs
  • Capacitor
  • ESP32-C3-DevKitM-1
  • Full-size breadboard
  • LED x 6
  • OLED display, 128x64
  • Piezo speaker
  • Pushbutton x 4
  • Resistor x 6
  • Seven segment display
  • TFT display, 240x320

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

First light

One pin, then six, and what a GPIO matrix is for.

LessonTimeWhat students do
First light on the C3One pin, one lamp, one program on a RISC-V board. Why 3.3 V changes the resistor you pick, and what the board does while it waits.50 min
  1. The board, and where it sits
  2. Run it
  3. The lamp on the breadboard
  4. Pick a resistor for 3.3 V
  5. Blink it five times a second
  6. What a GPIO matrix is
Six pins and a moving dotAn array of pin numbers, a loop that walks it, and a sweep that bounces. The first sketch where the code shape matters more than the wiring.50 min
  1. Six lamps, six pins
  2. Run it
  3. All the way along
  4. Watch a pin in the middle
  5. Make it slow
  6. Where six pins stops working

Materials

  • ESP32-C3-DevKitM-1
  • Full-size breadboard
  • LED x 6
  • Resistor x 6

Check for understanding

Each student finishes "Six pins and a moving dot" 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: "Where six pins stops working".

Chapter 2. About 1 h 40 min

Reading the world

A pin that reads, and a handler that runs the moment it changes.

LessonTimeWhat students do
Reading a pin at 3.3 VA button on GPIO 9 with the pad pull-up on. Why pressed reads low, what 45 k means, and what a floating input really does.50 min
  1. A button with no resistor
  2. Watch it go low
  3. And the lamp follows
  4. Check the output pin too
  5. Turn it round
  6. What a floating pin actually does
Interrupts, and what they costA handler that runs the moment a pin falls, a counter shared with the main loop, and the bounce that makes one press count as four.50 min
  1. Something that happens without being asked
  2. Run it
  3. Press it
  4. Press five, and read the number
  5. Catch the contacts bouncing
  6. Debounce it, and know what it costs

Materials

  • ESP32-C3-DevKitM-1
  • Full-size breadboard
  • LED
  • Pushbutton
  • Resistor

Check for understanding

Each student finishes "Interrupts, and what they cost" 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: "Debounce it, and know what it costs".

Chapter 3. About 1 h 40 min

Talking to your computer

UART0 both ways, and the start of every protocol.

LessonTimeWhat students do
The board talksUART0, the monitor, and the uptime. What a baud rate costs in time, and why printing a float works on a chip that cannot do arithmetic with one.50 min
  1. Nothing is wired, and that is the lesson
  2. Say hello
  3. A number with no hardware behind it
  4. The uptime, from a 52 bit counter
  5. Add a line of your own
  6. What printing costs
The board listensCharacters arriving into a FIFO, read without blocking, and echoed back with their hex. The first half of every protocol you will ever write.50 min
  1. Two calls, and neither one waits
  2. Run it
  3. Type a letter
  4. Type a capital and read the hex
  5. Press enter on its own
  6. From echo to protocol

Materials

  • ESP32-C3-DevKitM-1
  • Full-size breadboard

Check for understanding

Each student finishes "The board listens" 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: "From echo to protocol".

Chapter 4. About 50 min

Timing you can hear

One unit of time, and everything else in proportion to it.

LessonTimeWhat students do
Timing you can hearMorse is timing and nothing else. One unit of time, five rules, a lamp and a piezo, and a button that moves to the next message.50 min
  1. One number decides everything
  2. Run it and read the log
  3. Watch the lamp
  4. And listen to it
  5. Move to the next message
  6. Change the speed

Materials

  • ESP32-C3-DevKitM-1
  • Full-size breadboard
  • LED
  • Piezo speaker
  • Pushbutton
  • Resistor

Check for understanding

Each student finishes "Timing you can hear" 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: "Change the speed".

Chapter 5. About 50 min

Brightness

PWM by hand, a filter that averages it, and what the peripheral would have cost.

LessonTimeWhat students do
Brightness without a PWM peripheralThe C3 has an LED PWM peripheral and Mokxi does not model it, so this sketch does it in software. Two lamps, one through a filter, and the cost of doing it by hand.50 min
  1. Two branches, on purpose
  2. Run it and watch it breathe
  3. Read the filtered node
  4. And the lamp behind the filter
  5. Make the breath faster
  6. What it would cost in hardware

Materials

  • Capacitor
  • ESP32-C3-DevKitM-1
  • Full-size breadboard
  • LED x 2
  • Resistor x 3

Check for understanding

Each student finishes "Brightness without a PWM peripheral" 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 it would cost in hardware".

Chapter 6. About 2 h 30 min

Showing something

Seven segments, then a screen on two wires, then color on one.

LessonTimeWhat students do
Showing a numberSeven LEDs in the shape of an eight, a table of digits, and a die that tumbles. Where a pin budget starts to hurt.50 min
  1. Seven LEDs and a table
  2. Run it
  3. Roll it
  4. Watch a segment pin
  5. One resistor for all of it
  6. Count the pins
A screen on two wiresA 128x64 OLED over I2C, bit-banged on two pins. Addresses, acknowledgments, a frame buffer in RAM, and what a redraw costs.50 min
  1. Two wires, many devices
  2. Run it
  3. Something on the screen
  4. A screen is a buffer in your RAM
  5. What a frame costs
  6. Put your own thing on it
Color on one wireSixteen addressable LEDs on a single pin, and a protocol where the length of a pulse is the bit. The timing is the whole problem.50 min
  1. Every LED has a chip in it
  2. Run it
  3. Count the lit ones
  4. All sixteen
  5. Slow the wheel down
  6. What sixteen LEDs actually draw

Materials

  • Addressable RGB LEDs
  • ESP32-C3-DevKitM-1
  • Full-size breadboard
  • OLED display, 128x64
  • Pushbutton
  • Resistor
  • Seven segment display

Check for understanding

Each student finishes "Color on one wire" 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 sixteen LEDs actually draw".

Chapter 7. About 1 h 40 min

Two things to play

A memory game and a console, both on a breadboard.

LessonTimeWhat students do
Project: a memory gameFour lamps, four buttons and a sequence that grows. State, arrays and input handling in one thing you can actually play.50 min
  1. The game, stated before it is built
  2. Run it
  3. Watch it show you
  4. Answer it
  5. Get it wrong on purpose
  6. Make it better
Project: a consoleA color TFT, two buttons and a piezo, running a game at forty frames a second. What a frame budget is and where it all goes.50 min
  1. A screen, two buttons and a speaker
  2. Run it
  3. Play it
  4. Miss it
  5. Where the 25 milliseconds go
  6. Make it your game

Materials

  • ESP32-C3-DevKitM-1
  • Full-size breadboard
  • LED x 4
  • Piezo speaker
  • Pushbutton x 4
  • Resistor x 4
  • TFT display, 240x320

Check for understanding

Each student finishes "Project: a console" 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: "Make it your game".

Your class

Teach this unit as a class

Start a class from this course and its 13 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.