Inferensys

Glossary

Sensor Emulation

Sensor emulation is a Hardware-in-the-Loop (HIL) testing technique that generates physical electrical signals from a real-time simulation to stimulate the input pins of an embedded controller or device under test.
Engineer deploying small language model to edge device, IoT sensor visible on desk, technical hardware setup in bright workspace.
HARDWARE-IN-THE-LOOP TESTING

What is Sensor Emulation?

Sensor emulation is a core Hardware-in-the-Loop (HIL) testing technique for validating robotic and embedded systems.

Sensor emulation is the HIL methodology of generating simulated sensor signals from a real-time plant model and outputting them as physical electrical signals to the input pins of the device under test (DUT). This allows an embedded controller, like a robot's main computer, to interact with a virtual environment as if it were receiving data from real encoders, inertial measurement units (IMUs), LIDAR, or cameras. The technique is fundamental for closed-loop validation before physical hardware integration.

The process relies on a real-time simulator executing a high-fidelity digital twin of the physical world. This model calculates expected sensor readings, which a specialized I/O board converts into precise analog voltages, Pulse-Width Modulation (PWM) waves, or digital pulses. This enables exhaustive testing of perception algorithms and control logic against millions of simulated scenarios, including fault injection and edge cases, in a safe, repeatable, and automated laboratory setting.

HARDWARE-IN-THE-LOOP TESTING

Key Components of a Sensor Emulation System

A sensor emulation system generates physical electrical signals from a real-time simulation to test embedded hardware. It comprises specialized hardware and deterministic software that work in concert.

01

Real-Time Simulator & Plant Model

The computational core that executes a high-fidelity, physics-based model of the system (the "plant") in hard real-time. This model calculates the expected sensor readings (e.g., position, velocity, pressure) based on actuator commands from the Device Under Test (DUT). Its deterministic execution, often on a multi-core processor with a Real-Time Operating System (RTOS), is non-negotiable to maintain synchronization with the physical world.

  • Example: Simulating the dynamics of a robotic arm to calculate joint encoder counts.
  • Key Output: A stream of floating-point values representing the ideal sensor measurements at each time step.
02

I/O Interface Hardware

Specialized electronic boards that perform the critical digital-to-analog (DAC) and digital signal generation conversion. They translate the numerical sensor values from the real-time model into the precise electrical signals required by the DUT's input pins.

  • Analog Output Channels: Generate voltage or current signals (e.g., 0-5V for a temperature sensor).
  • Digital/PWM Output Channels: Generate pulse-width modulation (PWM) signals, quadrature encoder pulses (A/B/Z channels), or discrete digital signals.
  • Communication Protocol Interfaces: Emulate sensor buses like I2C, SPI, or CAN, transmitting pre-defined data frames.
03

Signal Conditioning & Breakout

Electronic circuitry and physical fixtures that ensure signal integrity and provide accessible test points between the I/O hardware and the DUT.

  • Signal Conditioning: Amplifies, filters, or isolates raw signals from the I/O board to match the DUT's electrical specifications (voltage levels, impedance, noise immunity).
  • Breakout Box / Terminal Panel: A passive interface with labeled connectors, fuses, and test points. It allows engineers to easily probe signals, inject faults, or reroute connections without manipulating the core HIL wiring harness.
04

Latency Management & Synchronization

The system of techniques that ensures temporal accuracy, compensating for the inherent delays in computation and signal conversion to maintain a valid closed-loop test.

  • Deterministic Execution: The plant model must complete its calculation within a fixed, sub-millisecond time step.
  • Latency Compensation: Algorithms (e.g., prediction) that account for the group delay through the DAC and wiring, aligning the emulated sensor signal in time with the DUT's expectation.
  • Time Synchronization: Uses protocols like IEEE 1588 (PTP) to align clocks across distributed I/O nodes and the main simulator for coherent data logging.
05

Test Automation & Scenario Software

The software layer that orchestrates tests, injects faults, and validates responses. It defines what sensor signals are emulated and under what conditions.

  • Test Sequencer: Automates the execution of test cases, applying time-varying input scenarios (e.g., a simulated vehicle driving over rough terrain).
  • Fault Injection: Programmatically introduces sensor failures like signal dropout, saturation, noise, or stuck-at values to test DUT diagnostics and robustness.
  • Data Logging & Analysis: Captures all emulated outputs and DUT responses for post-test analysis and requirement verification.
06

Hardware Abstraction & Configuration

Middleware that decouples the high-level sensor model from the low-level hardware details, enabling portability and simpler configuration.

  • Hardware Abstraction Layer (HAL): Provides a uniform software interface to different I/O boards from vendors like National Instruments or dSPACE. A model configured to output "encoder pulses" doesn't need rewriting if the hardware changes.
  • Configuration Tools: Graphical utilities (e.g., NI VeriStand, dSPACE ConfigurationDesk) that map model variables to specific physical I/O channels, set scaling (engineering units to volts), and define sample rates.
HARDWARE-IN-THE-LOOP TESTING

How Sensor Emulation Works in HIL Testing

Sensor emulation is a core Hardware-in-the-Loop (HIL) technique that replaces physical sensors with simulated, electrically accurate signals to test embedded controllers.

Sensor emulation is the HIL process where a real-time simulation generates virtual sensor data from a plant model and outputs it as physical electrical signals to the device under test (DUT). This involves converting digital simulation values into precise analog voltages, PWM waves, or digital pulses that match the exact electrical characteristics expected by the DUT's input pins. The technique allows for exhaustive testing of sensor fusion algorithms and fault handling without the cost and variability of physical sensors.

The implementation requires deterministic execution on a real-time simulator with specialized I/O boards for digital-to-analog conversion (DAC). Signal conditioning circuits ensure voltage and current levels are correct. A key challenge is latency compensation to account for processing and conversion delays, ensuring the closed-loop system's temporal fidelity. This enables validation of the controller's response to simulated edge cases, failures, and dynamic scenarios that are difficult or dangerous to replicate with real hardware.

HARDWARE-IN-THE-LOOP TESTING

Common Sensor Signals Emulated

Sensor emulation in HIL testing involves generating physical electrical signals that mimic the output of real-world sensors. These signals are derived from a real-time plant model and injected into the input pins of the device under test (DUT) to validate its perception and control algorithms.

01

Pulse-Width Modulation (PWM)

PWM is a digital signal emulated to represent sensors like rotary encoders, RPM sensors, or duty-cycle controlled actuators. The real-time simulator generates a square wave where the pulse width encodes information.

  • Frequency and Duty Cycle: The simulator controls the signal's frequency (e.g., 1 kHz to 100 kHz) and the ratio of high-time to period.
  • Quadrature Encoder Emulation: Two PWM channels are generated 90 degrees out of phase to simulate direction and position for motor feedback.
  • Application: Testing motor controllers, reading simulated speed from a virtual drivetrain model.
02

Analog Voltage & Current

These are continuous signals representing sensors such as temperature probes, pressure transducers, potentiometers, and current shunts. The HIL system's analog output channels generate precise voltage (e.g., 0-5V, ±10V) or current (4-20 mA) loops.

  • High-Resolution DACs: Use 16-bit or 18-bit Digital-to-Analog Converters for fine-grained signal control.
  • Sensor Scaling & Linearization: The plant model calculates the physical value (e.g., 150°C), which is then scaled to the correct voltage using the sensor's transfer function, including non-linear corrections.
  • Application: Validating an Engine Control Unit's (ECU) reading of manifold pressure or coolant temperature.
03

Digital I/O & Frequency Signals

Digital signals represent limit switches, proximity sensors, or Hall effect sensors. Frequency-based signals emulate sensors like variable reluctance sensors (VRS) for gear tooth detection.

  • Digital Lines: Simple TTL-level (0-5V) signals indicate ON/OFF states, triggered by discrete events in the simulation (e.g., a virtual door closing).
  • Frequency Generation: The simulator outputs a signal whose frequency is proportional to a simulated speed. For VRS emulation, the signal amplitude may also vary with frequency to mimic magnetic sensor characteristics.
  • Application: Testing anti-lock braking system (ABS) wheel speed sensors or gearbox control units.
04

Communication Bus Signals

Modern sensors communicate via serial protocols. HIL systems emulate the entire bus traffic, generating the electrical waveforms of the protocol.

  • Controller Area Network (CAN): The HIL simulator acts as multiple virtual sensor nodes, broadcasting CAN frames (e.g., 0x100: Engine_Speed) with simulated data onto a physical CAN bus connected to the DUT.
  • Serial Peripheral Interface (SPI) / I²C: The simulator emulates the master or slave device, generating clock and data line signals for digital sensors like inertial measurement units (IMUs).
  • Ethernet-Based Sensors: For sensors using EtherCAT or TCP/IP, the simulator generates the appropriate Ethernet packets with sensor payloads.
  • Application: Testing an ADAS controller that receives object list data from a simulated radar sensor via CAN.
05

Resolver & Synchro Signals

These are specialized, high-fidelity analog signals used to emulate precise angular position sensors in aerospace, robotics, and high-performance motor control.

  • Resolver Format: The HIL system generates two analog signals: a sine and a cosine (e.g., 2 Vrms, 400 Hz carrier) where the phase shift between them encodes the absolute shaft angle.
  • Synchro Format: Emulates three-wire synchros (S1, S2, S3) with 115V, 400Hz carrier signals where the relative amplitudes define the angle.
  • High Accuracy Requirement: Requires specialized I/O cards with low distortion and precise phase control to avoid introducing error in the DUT's RDC (Resolver-to-Digital Converter).
  • Application: Validating flight control actuators or robotic joint controllers.
06

Strain Gauge & Bridge Sensors

Emulates sensors that measure force, torque, or weight using a Wheatstone bridge configuration. The HIL system must generate the small, differential voltage changes across the bridge.

  • Millivolt-Level Signals: A full-scale output is often only a few millivolts per volt of excitation (e.g., 2 mV/V).
  • Excitation Voltage Simulation: The HIL system may also provide the simulated bridge excitation voltage (e.g., 5V or 10V).
  • Multi-Channel Synchronization: For multi-axis force/torque sensors, multiple bridge signals must be generated in perfect synchrony.
  • Application: Testing load cell inputs on industrial weighing systems or torque feedback in electric power steering systems.
HIL TESTING METHODOLOGIES

Sensor Emulation vs. Related Simulation Techniques

A comparison of sensor emulation with other simulation-based validation techniques, highlighting the integration point of physical hardware and the type of signals exchanged.

CharacteristicSensor Emulation (HIL)Software-in-the-Loop (SIL)Model-in-the-Loop (MIL)Digital Twin

Primary Objective

Validate sensor hardware interfaces & signal integrity with real electrical I/O

Verify algorithmic correctness of production source code

Validate control logic and system model behavior

Provide a virtual replica for design, monitoring, or predictive analytics

Hardware Under Test (HUT)

Physical sensor or ECU input circuitry

Software executable (e.g., .exe, .so) on host PC

Pure algorithmic model (e.g., Simulink block diagram)

Not typically a 'test'; the twin is the virtual asset used for analysis

Simulation Environment

Real-time simulator with physical I/O boards

Non-real-time host machine (e.g., Windows/Linux PC)

Non-real-time simulation software (e.g., MATLAB/Simulink)

Can range from non-real-time to real-time, depending on use case

Signal Interface

Physical electrical signals (analog voltage, PWM, digital pulses)

Software function calls or data passed in memory

Mathematical variables within the simulation tool

API/data stream connection to physical asset (if live)

Real-Time Determinism Required

Tests Electrical Characteristics

Fault Injection Capability

Physical (short/open) & protocol-level

Protocol & data value corruption only

Data value corruption only

Simulated fault conditions in the virtual model

Typical Use Phase

Late-stage validation before system integration

Mid-stage software unit/integration testing

Early-stage algorithm design & requirements testing

Entire lifecycle (design, operation, maintenance)

Latency & Timing Validation

SENSOR EMULATION

Frequently Asked Questions

Sensor emulation is a critical Hardware-in-the-Loop (HIL) technique for validating robotic and embedded systems. These questions address its core mechanisms, applications, and implementation details.

Sensor emulation is a Hardware-in-the-Loop (HIL) testing technique where a real-time simulation generates synthetic sensor data and outputs it as physical electrical signals to the input pins of a Device Under Test (DUT). It works by executing a high-fidelity plant model (e.g., of a robot's dynamics and environment) on a real-time simulator. This model calculates what a physical sensor would measure. The simulator's I/O boards then convert these digital values into precise analog voltages, PWM signals, encoder pulse trains, or digital communication frames (like CAN or SPI) that are electrically identical to those from a real sensor. This creates a closed-loop where the DUT's controller reacts to the emulated signals as if it were connected to real hardware.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.