Testing & Validation · Study deck
Hardware-in-the-Loop IoT Tests
Some defects only appear when the real device is running: an interrupt arrives during a write, a brown-out resets the board halfway through a transaction, or a pin changes faster than the firmware expected.
Test Tessa is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- build a hardware-in-the-loop rig that puts a real board inside a controlled, repeatable world
- read HIL evidence and distinguish what the rig proves from what it still models
- explain why real hardware is needed at this stage instead of a pure simulation
- Explain: A desk test may miss the timing.
Major section
Start With the Story: Make the Real Board Face a Repeatable World
A desk test may miss the timing.
- The team needs a safe rig that can cause the same fault and observe the same pins again.
- A microcontroller means the small computer inside the controller.
- Hardware-in-the-loop testing keeps that real board in a controlled test world.
Major section
Start With the Story: Make the Real Board Face a Repeatable World (continued)
A host-only test can describe those cases, but it cannot prove the actual board responds correctly.
- This runway does not reproduce every field condition.
- The deeper sections explain harness boundaries, signal timing, fault injection, observation, reset, repeatability, and the limits of modeled evidence.
- A HIL rig injects inputs, observes outputs, resets the device, and records the result so the same hard situation can be replayed.
Major section
Overview: A Real Device Inside a Controlled World
Hardware-in-the-loop testing connects a real device — the actual microcontroller running the actual firmware — to a controlled harness that feeds it inputs and watches its outputs.
- The device cannot tell it is being tested; it sees signals on its pins and responds as it would in the field.
Major section
Overview: A Real Device Inside a Controlled World (continued)
The technique comes from control engineering, where a controller for an engine, motor, or vehicle is connected to a simulated version of the thing it controls before it is ever trusted with the real machine.
- The trade is that everything around the device is now a model, and the evidence is only as good as that model and the harness boundary.
- “A demo proves it can work once; a test proves it keeps working — bring the field, not the bench.”.
- It catches what host-only tests miss, yet its claim is bounded by what the harness can inject, observe, and reset.
Major section
Overview: A Real Device Inside a Controlled World (continued)
If you only need the intuition, this layer is enough: HIL runs the real firmware on real hardware, but inside a controlled rig that injects inputs, observes outputs, and can trigger faults repeatably.
- Engineers can trigger an engine failure, an iced sensor, or a wind shear on demand and watch the real computer respond — none of which they could safely do with a real aircraft full of passengers.
- HIL does this for an IoT device.
- This loop connects realistic hardware behavior to reproducible evidence without pretending that the harness represents every field condition.
Major section
Overview: A Real Device Inside a Controlled World (continued)
Bounded by the harness The claim only covers what the harness can inject, observe, and reset; everything else is a gap to record.
- The image identifies the real candidate under test; the harness boundary names what is modeled; observation compares the board's response with the expected behavior; and reset restores a known state before repetition.
- The One-Minute View Real device, modeled world The firmware and hardware are real; the sensors, network, and surroundings are supplied by a controlled harness.
- Beginner Examples Read these examples as a progression from the simplest observation to the boundary that still needs evidence.
Major section
Practitioner: Building the Loop and Reading Its Evidence
Observation captures the device's outputs — messages, log lines, state changes, pin levels — at a defined monitor point.
- The model is whatever the surrounding system is supposed to be doing, from a fixed stimulus up to a full simulated plant.
- A pass is meaningless without knowing which build ran.
Major section
Practitioner: Building the Loop and Reading Its Evidence (continued)
The result must trace to a controlled stimulus.
- The first fields identify the real candidate and the modeled surroundings; reset makes each open- or closed-loop scenario repeatable; and observations capture the board's response.
- An observation, not an impression, supports a decision.
- Names the boundary the claim does not cover.
Major section
Practitioner: Building the Loop and Reading Its Evidence (continued)
That record connects the richer closed-loop behavior to a bounded claim without hiding timing or physical effects the harness does not represent.
- A reset or isolation control is what makes such tests repeatable — each run must start from a known device state, or the evidence cannot be compared run to run.
- Image, harness, input, or schema change that retests.
- If you can build a loop, inject a fault, and read a record for scope and reset control, you can stop here.
Major section
Under the Hood: Why Real Hardware, and Where the Rig Still Models
But HIL is not reality either: it replaces the physical environment with a model, and that model has assumptions.
- Understanding both halves — why the real device matters, and where the rig still approximates — is what keeps HIL evidence honest.
Major section
Under the Hood: Why Real Hardware, and Where the Rig Still Models (continued)
These effects emerge from the actual chip and board, and they are a frequent source of bugs that pass every host test and fail in the field.
- HIL puts the real device in the loop precisely so these timing and electrical behaviors are exercised, not assumed.
- Real-Time Fidelity Is a Correctness Condition When the harness models a system that reacts to the device, the model must meet the device's real-time deadlines.
- Non-real-time HIL is still useful for open-loop and functional checks, but its limits should be recorded.
Major section
Under the Hood: Why Real Hardware, and Where the Rig Still Models (continued)
So a green HIL run can still miss a defect that only a real, imperfect sensor or a real environment would trigger.
- The rig can even introduce its own artifacts — ground loops, electrical loading, or timing skew between the injection and capture instruments — that look like device behavior but are the harness.
- Field adds: real noise and drift, plus real temperature, vibration, and EMI the harness can only approximate.
- Common Pitfalls Review these failure modes in the order they can weaken or invalidate the result.
Deck summary
Key takeaways
A desk test may miss the timing.
- A host-only test can describe those cases, but it cannot prove the actual board responds correctly.
- Hardware-in-the-loop testing connects a real device — the actual microcontroller running the actual firmware — to a controlled harness that feeds it inputs and watches its outputs.
- The technique comes from control engineering, where a controller for an engine, motor, or vehicle is connected to a simulated version of the thing it controls before it is ever trusted with the real machine.
- Observation captures the device's outputs — messages, log lines, state changes, pin levels — at a defined monitor point.
Retrieval practice
Recall check 1 of 3

Test Tessa says: answer from memory, then check your reasoning.
Q1What distinguishes hardware-in-the-loop testing from running the firmware as a program on a developer's host machine?
Show answer
Answer: D The defining feature is the real device in the loop, with the surroundings supplied by a repeatable harness, so real timing and electrical behavior are exercised.
Retrieval practice
Recall check 2 of 3

Test Tessa says: answer from memory, then check your reasoning.
Q2A HIL test reports that recovery after an interrupted operation works, but the rig cannot reliably return the device to a known state between runs. How should you treat the result?
Show answer
Answer: A Repeatability depends on a known starting state; without reset control, runs are not comparable and the recovery claim is unsupported.
Retrieval practice
Recall check 3 of 3

Test Tessa says: answer from memory, then check your reasoning.
Q3A firmware build passes every host-based test, then fails on a HIL rig with an intermittent fault when an interrupt fires during a flash write. A developer wants to dismiss it as a flaky rig and ship. What is the sound interpretation?
Show answer
Answer: A Interrupt-versus-main-loop races and timing faults emerge from real silicon; an intermittent HIL failure is a signal to investigate, not noise to rerun past.
Print reference
Answers
Answer key.
- D · The defining feature is the real device in the loop, with the surroundings supplied by a repeatable harness, so real timing and electrical behavior are exercised.
- A · Repeatability depends on a known starting state; without reset control, runs are not comparable and the recovery claim is unsupported.
- A · Interrupt-versus-main-loop races and timing faults emerge from real silicon; an intermittent HIL failure is a signal to investigate, not noise to rerun past.