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.

hardware-in-the-loopvalidation-evidencedevice-under-test
Test Tessa, the module guide, in a scene from this chapter.
iotclass.org

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

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.

Why it matters

The claim is powerful because real hardware is in the loop, and bounded because the harness is still a model of the world.

iotclass.org

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

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.
HIL is a loop: the harness injects an input, the real device responds, the harness observes the output, and a reset returns it to a known state for the next run.
HIL is a loop: the harness injects an input, the real device responds, the harness observes the output, and a reset returns it to a known state for the next run.
iotclass.org

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

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

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

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.

Why it matters

If the rig cannot reset the device reliably between runs, the right call is a hold or retest — not because HIL was wrong, but because the evidence is not yet repeatable enough for the claim.

A HIL review record keeps the real device behavior tied to the harness boundary, reset control, observed evidence, known gap, decision, owner, and retest trigger.
A HIL review record keeps the real device behavior tied to the harness boundary, reset control, observed evidence, known gap, decision, owner, and retest trigger.
iotclass.org

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

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

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.

Key terms

Non-real-time HIL
Non-real-time HIL is still useful for open-loop and functional checks, but its limits should be recorded.
iotclass.org

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

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

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

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?

AHIL is just a faster way to run unit tests on a laptop with no hardware involved
BHIL means deploying the device to real customers and watching what happens
CHIL removes the need to model anything, because everything in the test is real
DRun real firmware on real device hardware while a harness supplies inputs and observes outputs
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.

iotclass.org

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?

AHold or retest
BApprove with monitoring
CSwitch to host tests
DIgnore the reset problem as long as the recovery message appeared at least once
Show answer

Answer: A Repeatability depends on a known starting state; without reset control, runs are not comparable and the recovery claim is unsupported.

iotclass.org

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?

AThe intermittent failure is likely a real timing or race defect that only the real device exposes
BThe rig is probably injecting unrealistic interrupts; ship based on the host tests and adjust the harness afterward.
CThe fix is to delete the HIL test so the pipeline goes green again
DIntermittent means random, so no real cause exists and it can be ignored
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.

iotclass.org

Print reference

Answers

Answer key.

  1. 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.
  2. A · Repeatability depends on a known starting state; without reset control, runs are not comparable and the recovery claim is unsupported.
  3. 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.
iotclass.org