Automated HIL testing for fire apparatus ECUs — from manual switches to Python test scripts

Hardware-in-the-Loop Test Framework

Python, CAN bus, analog/digital I/O, CI/CD


The Problem

Pierce Manufacturing's Hardware-in-the-Loop (HIL) simulator for fire apparatus ECUs was designed for manual testing. An engineer would sit at the test bench with mechanical switches and indicator lights, verifying behavior by hand. The process was:

The simulator hardware itself was capable. What was missing was a software layer that let engineers treat it like a programmable test system instead of a manual switchboard.


The Approach

I pushed for automated test execution and built a Python abstraction layer that sat between the engineer's test scripts and the HIL hardware API.

Test script (Python) -> Abstraction layer -> HIL hardware API -> ECU

The abstraction layer handled:

The key insight was that the abstraction layer should hide the hardware details but expose the operations that engineers actually cared about: "send this CAN message and verify that response," not "set register 0x34 to value 0x7F."


The Result

The framework became the standard for new product testing at Pierce. Engineers could write test scripts in a few hours that would have taken days to run manually. The automated test suite could run overnight and produce a clean pass/fail report by morning.

More importantly, the framework made testing repeatable - the same test run on two different days would produce identical results, which was impossible with manual testing. This made regression testing reliable enough to run before every release.


Technical Details

The HIL simulator was built around a CAN bus backbone with analog and digital I/O channels all routed to I/O pins on National Intruments io modules. The Python abstraction layer communicated with the simulator hardware over a the python's Versistand package, sending commands and receiving responses in a custom protocol.

Key capabilities exposed through the abstraction layer:


What I Learned

The HIL framework was a reminder that the best engineering tools are the ones that make the operator's job easier. The hardware was perfectly capable - what was missing was someone to bridge the gap between what the hardware could do and what the engineers needed it to do.

The Python abstraction layer was not technically complex. What made it valuable was that it removed friction. Engineers could focus on what to test instead of how to drive the hardware.