Source: https://mokxi.com/learn/path/firmware-testing
Updated: 2026-11-20

All paths

# Testing firmware

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.

Arduino Uno R3 Free 7 lessons 7 h 4 chapters 2,497 XP Embedded engineering · Advanced +250 XP

0 of 7 done

Start the course free Pure logic first Lesson plan for teachers

What you will build

## 3 projects, built step by step

7 lessons in 4 chapters, about 7 hours on a simulated Arduino Uno R3. Free, in your browser, every step checked by the simulator.

Chapter 1 project

### 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.
Open it in the simulator

Chapter 2 project

### 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.
Open it in the simulator

Chapter 3 project

### 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.
Open it in the simulator

The map

## Chapter by chapter

Each lesson opens when the one before it is done, and each chapter ends in a project.

Chapter 1

## Tests without hardware

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

Open 265 XP

### 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.

0 of 6 steps

Start What is in it

Project Locked 484 XP

### 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.

0 of 6 steps

4 questions, graded as you go.

Chapter 2

## Tests with hardware

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

Locked 303 XP

### 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.

0 of 7 steps

Project Locked 530 XP

### 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.

0 of 6 steps

4 questions, graded as you go.

Chapter 3

## Tests that keep working

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

Locked 242 XP

### 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.

0 of 6 steps

Project Locked 408 XP

### 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.

0 of 5 steps

3 questions, graded as you go.

Chapter 4

## Boss project

A thermostat that proves itself at every boot.

Locked 265 XP

### 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.

0 of 6 steps

3 questions, graded as you go.

Syllabus

## Every lesson in the course

All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.

Chapter 1

### Tests without hardware

- 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.
- 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.

Chapter 2

### Tests with hardware

- 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.
- 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.

Chapter 3

### Tests that keep working

- 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.
- 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.

Chapter 4

### Boss project

- 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.

Kits

## Build it on your bench too

Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.

Have a kit already?

### Find your kit

Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.
See every kit

Questions

## About Testing firmware

Is Testing firmware free?

Yes. All 7 lessons of Testing firmware are free and run in your browser, with nothing to install and no parts to buy before you start.

Do I need a real Arduino Uno R3?

No. Every lesson runs on a simulated Arduino Uno R3 with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.

How long does Testing firmware take?

About 7 hours: 7 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.

What will I build?

Each chapter ends in a project that puts it together: Fake pins, Hardware in the loop and Test reports.

Where do I start?

With "Pure logic first", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.
