Industrial client · design, manufacturing & software
Camera-based LED detection for a HIL test bench
Light guides and a camera capture 25 LEDs of the device under test – immune to stray light, isolated and for about €900 instead of €4,000 of measurement hardware.
- HIL test bench
- Light guides
- Image processing
- OpenCV
- Python
- OPC UA
- 3D printing
- Design by contract
- Galvanic isolation
Challenge
Control units and operator panels often show their status via LEDs. For automated testing on a HIL test bench, the 25 LEDs of an operator panel had to be evaluated reliably – not just “on” or “off”, but also dimmed and flashing. At the same time, the test bench needed to inject signals via digital inputs.
Approach
Hardware
- Light guides carry the light of each LED from the operator panel into the 19-inch rack module; the coupling is adapted individually to the panel
- A tube in front of the camera arranges the ends of the light guides as a matrix and shields them from ambient light
- An industrial camera (uEye) captures the matrix at 10 frames per second; it is connected via the Windows driver
- Signal injection via digital inputs
Design and manufacturing
- All components of the module designed in-house
- Manufactured by 3D printing, also in-house
Software
- Image evaluation with OpenCV in Python
- The states off, on, dimmed and flashing are distinguished using calibration data with defined tolerance bands
- Detection of flashing frequencies between 0.5 and 2 Hz
- Calibration via automated routines in the test framework
- All data provided via OPC UA: raw values, calibration data and the calculated states
The interface: design by contract
We specified the interface with the client strictly according to design by contract. The binding agreement covered:
- raw data in digits
- states as an enumeration (off, on, dimmed, flashing)
- calibration data
- a guaranteed latency of 1 s
With design by contract, both sides define up front what an interface requires and what it guarantees. Deviations surface early and integration becomes predictable – instead of improvising at the test bench.
Flashing frequency and latency
The lower the slowest flashing frequency to be detected, the longer detection takes – because the period the system has to observe grows as the frequency falls. We therefore define the frequency range narrowly for each application. In this project it is 0.5 to 2 Hz with a guaranteed latency of 1 s. Processing 10 frames per second causes no noticeable CPU load in Python.
Outcome
- Immune to stray light: the tube shields the light guides from ambient light, so detection stays reliable regardless of the lighting at the test bench.
- Cost-effective: the camera cost about €900 in total. The alternative – 25 fast inputs with NI measurement hardware – would have cost about €4,000 for the hardware alone, without software licences such as LabVIEW.
- Full galvanic isolation: the light guides transmit only light – the electrical potentials of the device under test and the evaluation remain completely separate.
- Delivered quickly: completed in eight weeks, because we designed all components ourselves and 3D-printed them in-house.
- Integrated in one day: because the interface had been clearly agreed in advance, system integration was completed within a single day. The client’s test framework receives ready-to-use LED states and does not have to perform any image analysis itself.
The camera module can be integrated as a function module into our operator software for HIL test benches – see the reference HIL test bench for household appliances.
More about our HIL test benches, test automation and mechanical design.
From the project
Click a photo to enlarge it.
Frequently asked questions
Can the system be transferred to another device under test?
We adapt the coupling of the light guides individually to each operator panel. A newer panel of the same type, on the other hand, can be fitted quickly and without any modification.
How is the system calibrated?
Via automated routines in the test framework, started by the tester or the CI pipeline. The calibration data defines the tolerance bands for the individual states and is delivered via OPC UA.
How quickly does the system detect a change of state?
The guaranteed latency is 1 s. It results from detecting the flashing rhythm – the lower the slowest flashing frequency, the longer the period the system has to observe.
How long did the project take?
Eight weeks to the finished solution; integration into the client's test framework then took one day.