Source: https://mokxi.com/teachers/plans/firmware-testing
Updated: 2026-11-19

Lesson plan

# Testing firmware lesson plan

A thermostat tested the way firmware teams do it, every test running on the Uno and printing PASS or FAIL: pure logic first, fake pins and a fake clock, tests on target for the DS18B20 and the relay contact, a second Uno as a hardware-in-the-loop rig, a regression caught and fixed, TAP reports, and a thermostat that tests itself at every boot.

4 chapters, 7 lessons, about 7 hours, on the Arduino Uno R3. Every lesson runs in the browser, with nothing to install.

Start a class from this course

The unit

## Objectives and materials

### By the end, students can

- Pure functions, then fakes for the sensor, the relay and the clock.
- On the target itself, and from a second board in the loop.
- Regressions caught and fixed, and reports a machine can read.
- A thermostat that proves itself at every boot.

### Materials for the whole unit

- Arduino Uno R3 x 2
- Relay module
- Temperature sensor, DS18B20

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 2 h

## Tests without hardware

Pure functions, then fakes for the sensor, the relay and the clock.

Lesson | Time | What students do

Pure logic first The thermostat’s judgment as one function with no pins in it, five tests that run on the board at boot and print PASS or FAIL, and the same function then driving a real DS18B20 and relay. | 60 min

- Run it: tests at boot
- Why this function is easy to test
- Then the real thing
- Cool the room
- Write a test
- Test the logic, not the hardware

Fake pins The thermostat talks to its sensor, relay and clock through three function pointers, so tests swap in fakes: scripted temperatures, a recorded relay, and a clock that runs twelve minutes of thermostat life in a fraction of a second. | 60 min

- Run it: a thermostat with a clock
- A seam for the hardware
- The same class, for real
- What a fake can and cannot do
- Let the test catch a bug
- Designing for test

### Materials

- Arduino Uno R3
- Relay module
- Temperature sensor, DS18B20

### Check for understanding

Each student finishes "Fake pins" 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: "Designing for test".

Chapter 2. About 2 h 10 min

## Tests with hardware

On the target itself, and from a second board in the loop.

Lesson | Time | What students do

Tests on target Tests that only the real board can run: the DS18B20 answers with family code 0x28, converts inside the datasheet time and reads a plausible value, and the relay contact really closes and opens. Then a missing pull-up, and a test that passes for the wrong reason. | 70 min

- Run it: test the parts
- Timing from the datasheet
- Did the relay really move?
- A missing pull-up
- A test that passed for the wrong reason
- Faster, coarser readings
- What to test on target

Hardware in the loop A second Uno tests the thermostat from outside, as a production test station would: it sends setpoints over the serial link and times the relay contact, never looking inside. Then a warmer room breaks a test that assumed 22 C. | 60 min

- Run it: a test rig
- Drive it, time it
- A full report
- The room changed
- Test a requirement nobody tested
- What HIL is for

### Materials

- Arduino Uno R3 x 2
- Relay module
- Temperature sensor, DS18B20

### Check for understanding

Each student finishes "Hardware in the loop" 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 HIL is for".

Chapter 3. About 1 h 50 min

## Tests that keep working

Regressions caught and fixed, and reports a machine can read.

Lesson | Time | What students do

Regressions A one-line change that worked on someone’s desk, "tighter temperature control", fails a test written weeks earlier: the relay would switch 16 times in ten noisy minutes. Read the failure, find the change, fix it, and keep the test. | 60 min

- Run it: something broke
- Read the failure
- Stop the release
- Find the change
- Fix it
- Every bug gets a test

Test reports The thermostat’s self-test reported two ways: lines a person reads, or TAP, the Test Anything Protocol a CI server parses, with a firmware version, a plan line, diagnostics and a to-do test for a feature not built yet. | 50 min

- Run it: a report for people
- A summary that counts everything
- What a machine needs
- Switch to TAP
- Reports people trust

### Materials

- Arduino Uno R3
- Relay module
- Temperature sensor, DS18B20

### Check for understanding

Each student finishes "Test reports" 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: "Reports people trust".

Chapter 4. About 1 h

## Boss project

A thermostat that proves itself at every boot.

Lesson | Time | What students do

Boss: a tested thermostat A thermostat that proves itself at every boot (logic tests, then on-target checks of its DS18B20 and relay contact) and refuses to heat if anything fails, then runs with a rest time and fails safe on a lost sensor. | 60 min

- Run it: a power-on self-test
- Cold room
- A board with a fault
- The room cools while it runs
- A warmer setpoint
- Your test plan

### Materials

- Arduino Uno R3
- Relay module
- Temperature sensor, DS18B20

### Check for understanding

Each student finishes "Boss: a tested thermostat" 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: "Your test plan".

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.

Start a class from this course See the demo class

More units

## Other lesson plans

Electronics basics 20 lessons, about 10 h. Embedded on the Arduino Uno 16 lessons, about 12 h. Embedded on the ESP32-C3 13 lessons, about 11 h. Embedded on the Raspberry Pi Pico 7 lessons, about 6 h. Build your own fight stick 5 lessons, about 4 h. Embedded on the STM32F411 6 lessons, about 6 h. C++ on a board 13 lessons, about 10 h. Digital logic and memory 4 lessons, about 4 h. Interactive devices on the Uno 9 lessons, about 8 h. From gates to a computer 23 lessons, about 16 h. Build a claw machine 8 lessons, about 6 h. Every unit All the courses as ready-made units, on the teachers page.
