1. What a preprocessing module delivers
1.1 Define the boundary between acquisition and analysis
A sleep vital signs signal preprocessing module organizes sensor or acquisition output into data usable by downstream systems. Tasks may include analog amplification and conditioning, analog-to-digital conversion, digital filtering, resampling, channel organization and quality flags. It may be an analog front-end board, an acquisition module with firmware, or a digital processing unit deployed on a processor. Define its deliverables from the actual inputs, outputs and processing steps.
Map the full path from sensor through analog circuits, ADC, digital processing, storage or communication, and downstream analysis. Mark the portions inside the module. Sleep staging, respiratory events and other analysis outputs require their own models and verification conditions. The quality of a preprocessed waveform is one acceptance object within that path.
1.2 Inputs and outputs of different forms
| Delivered form | Input conditions to establish | Output boundary to describe |
|---|---|---|
| Analog conditioning board | Sensor type, amplitude, source impedance, common mode and offset range | Output level, reference, gain, bandwidth, load drive and recovery |
| AFE and ADC module | Analog interface, supply, clock, channel connections and settings | Code format, status words, actual data rate, channel order and range conversion |
| Digital processing unit | Input units, sampling rate, timestamps, gaps and quality state | Processing version, filtering and resampling rules, delay, valid data and status |
| Integrated multichannel module | Each channel's source, independent settings, synchronization and buffering | Per-channel dictionaries, timing relationships, quality flags and export interface |
List hardware, firmware, parameter files, data format and verification documents together. If only processed waveforms are supplied, establish whether earlier samples and key status information remain accessible. Without them, fault localization and review after algorithm changes become harder.
1.3 Turn signal improvement into measurable requirements
Noise reduction, artifact removal and smoothing need measurement conditions. Set separate requirements for input range, useful passband, stopband attenuation, noise, waveform distortion, delay, gap identification and recovery, then verify them with project data. A smoother curve on a screen does not establish that the required physiological changes survive processing.
Build a paired input/output example library covering normal waveforms, low-amplitude signals, offset changes, saturation, interference, disconnection and setting changes. Acceptance values should follow the project's purpose and device design. This guide does not set filter frequencies or noise limits for all sleep vital signs.
2. Analog conditioning and sampling conditions
2.1 Select a front end for the signal source
Signal sources differ in electrical conditions and physical meaning. TI ADS1299 offers multichannel gain and sampling for EEG and biopotentials; ADS1292R adds a respiration impedance path; AFE4404 addresses optical signal acquisition.[S1][S2][S3] These illustrate device forms and do not establish that one module supports every channel.
| Input signal | Interface and physical meaning to describe | Preprocessing checks |
|---|---|---|
| EEG and other biopotentials | Electrodes and reference, differential voltage, offsets and common mode | High input impedance, input range, common-mode rejection, lead status and required morphology |
| ECG | Electrode connections, measured lead, gain and DC offset | Overload recovery, baseline processing, peak shape and event timing |
| PPG | Photocurrent or sampled optical data, light-source and ambient phases | Transimpedance gain, clipping, phase correspondence and data before/after ambient subtraction |
| Respiration-related signals | Specify impedance, pressure, temperature or belt-sensor output | Excitation or demodulation, baseline, amplitude and actual measurement meaning |
| Digitized auxiliary channels | Units, coordinates or direction, sampling and time format | Channel correspondence, conversion, resampling and synchronization |
For example, ADS1292R channel 1 cannot acquire ECG while respiration measurement is enabled.[S2] Define channel names and uses from the actual operating mode. Changes in respiration impedance also cannot directly be labeled as calibrated airflow or tidal volume.
2.2 Gain, input range and antialiasing
Input range must accommodate small signals, DC offsets, common mode, interference and motion transients. Once the front end or ADC clips, later filtering cannot recover the removed information. Retain input conditions, reference voltage, measured noise and clipping flags when choosing gain, and check conversion after gain changes.
Design antialiasing around the ADC architecture, external filtering and subsequent downsampling together. ADS1299 documentation describes internal digital decimation and external input-filter considerations.[S1] The final output data rate alone does not determine a suitable cutoff for the entire analog front end. Examine the modulator, internal response and interference bands that may fold into the signal.
For sampled inputs, establish effective antialiasing before downsampling as well. Controlled in-band and out-of-band inputs can test amplitude, aliased components and output timing. ADC bit depth describes coding; noise, reference, gain and layout also affect the usable signal range.
2.3 Board materials, passive parts and noise coupling
Board material, connectors, input protection, resistors and capacitors, shielding and supply paths jointly affect front-end behavior. Record tolerance, temperature characteristics and revision of filter components. Replacing parts with the same nominal values still requires checking actual frequency response. Include contamination or moisture around high-impedance inputs in investigations.
| Board factor | Suggested inspection situation | Engineering evidence to retain |
|---|---|---|
| Supply, reference and decoupling | Compare idle, acquisition, storage and wireless operation | Supply/reference changes, output noise and operating logs |
| Input paths and connectors | Signal simulator, different cables and connection states | Noise, common mode and crosstalk with shorted inputs or a defined equivalent source |
| Digital clocks and high-current paths | Change processing or light-source drive loads | Interference spectra, channel relationships and layout revision |
| Passive parts, board and surface treatment | Before/after substitution, assembly and environmental treatment | Passband, offsets, leakage-related faults and material batches |
Noise with shorted inputs does not represent the complete sensor, cable and wearing conditions. Assess coating, cleaning and encapsulation for the actual package and materials, avoiding residues, curing stress or covered contacts that change the interface. Retain analog noise and changes introduced by digital processing separately.
2.4 Startup, overload and recovery segments
Analog circuits and digital filters may need settling after power-up, disconnection, overload or setting changes. ADI AD8232 uses a fast restore circuit to shorten high-pass recovery after particular overload conditions.[S4] Recovery depends on the circuit and configuration, so one waiting interval should not be assigned to all modules.
Observe the complete normal, saturated, recovering and settled sequence under controlled input conditions. Give recovery segments an identifiable status, recording their beginning, end and determination method. When automatic gain, baseline or optical cancellation settings change, retain the settings and effective time together. Do not output the resulting step as a normal physiological change.
3. Digital processing settings, state and delay
3.1 Describe filtering through frequency and waveform responses
For each chain, record input sampling rate, filter type, order or length, coefficients, passband and transition band, gain and phase behavior. High-pass, low-pass, notch and baseline processing serve different purposes. State which slow variations, peak shapes or frequency components must survive, then inspect their changes after processing.
| Processing step | Effect to observe | Limits and settings to declare |
|---|---|---|
| High-pass or baseline processing | Offset and slow interference suppression; retention of required slow signals | Passband, startup/recovery response and waveform baseline changes |
| Low-pass or smoothing | High-frequency suppression, peak amplitude and timing changes | Effective bandwidth, transition band, gain and delay |
| Line-frequency notch | Suppression near the target and changes to neighboring waveform content | Enable conditions, center frequency, width, order and transients |
| Adaptive or artifact processing | Paired input/output in different motion and interference situations | Reference channel, update rules, failure status and modified intervals |
Version the processing order too. Smoothing after clipping may conceal its visual appearance. Thresholding after unit conversion may differ from applying thresholds directly to codes. Identify abnormalities at the front end or earliest observable stage and carry quality status alongside the waveform.
3.2 Block state and numerical implementation
Streaming processing must preserve filter state between adjacent blocks. Reinitializing each block can create periodic edge transients, and separate channels must not accidentally share state. The CMSIS-DSP FIR decimator documentation describes independent instance state and requires attention to overflow and saturation in each fixed-point implementation.[S5]
Deliver coefficient order, numeric format, scaling, rounding, accumulator and overflow handling. Compare fixed-point and floating-point output using identical inputs, including small signals, large transients, offsets and long records. Do not assume all fixed-point functions truncate or saturate identically.
Process the same continuous input as a whole and with different block lengths and boundaries. Check agreement within the declared numerical tolerance. Define state retention, clearing, warmup and invalid intervals separately for restarts, gaps and setting changes. These boundaries should match event flags in the record.
3.3 Resampling and record edges
Declare input/output sampling rates, antialiasing, interpolation or decimation rules and time mapping. The official MNE tutorial explains filtering within resampling and discusses event timing precision and edge effects when processing segments.[S7] These software behaviors point to checks needed for the actual implementation; naming software does not verify a module.
Retain the event time base before resampling, define rounding when mapping events to new samples, and test starts, ends and block crossings. Signal, status and event channels should not automatically receive identical interpolation. Do not join the ends of a gap and filter them as a continuous record. Document edge extension and samples considered unreliable.
3.4 Time meaning of real-time and offline output
SciPy sosfiltfilt applies forward-backward filtering with second-order sections; its related sosfilt interface accepts and returns filter state.[S6] Processing that uses the complete record and real-time processing that receives only arrived samples need separate definitions. An offline result's timing behavior cannot directly establish a real-time module's latency.
| Time component | Measurement or record suggested | Question for the output interface |
|---|---|---|
| Analog and ADC response | Response from a controlled input change to acquired samples | Which acquisition instant does data represent, and when does settling end? |
| Digital filtering | Phase/group delay, transients and actual implementation | Is delay frequency dependent, and is time compensation applied? |
| Block processing and buffering | Block length, earliest/latest emission and load conditions | How long is buffering, and how do waveform time and emission time differ? |
| Transfer and host | Send, receipt, retry and reordering logs | Which field is acquisition time and which is receipt time? |
A simple time shift compensates only portions suitably described by fixed delay; it cannot automatically correct frequency-dependent phase distortion. End-to-end delay measurements should state mode, channel, input, buffering and load, and examine drift and setting changes. Display timing should also agree with data time fields.
4. Waveforms, quality status and traceable interfaces
4.1 Establish a channel data contract
Downstream systems should be able to interpret output independently. Distinguish raw codes, physical quantities and normalized waveforms. State loss of absolute amplitude information after normalization. Where a physical quantity is uncalibrated, retain truthful units or declare that state rather than changing a channel name alone.
| Output item | Definition to deliver | Example to check |
|---|---|---|
| Channel identity | Source, connection, order, polarity and configuration segment | Independent known input/output correspondence for each channel |
| Amplitude and units | Signed format, gain, reference, scale, offset and normalization | Independent conversion from codes to physical values |
| Sampling and time | Actual rate, sequence, time units, clock and synchronization anchors | Continuous records, restart, rollover and midnight crossing |
| Processing version | Firmware, parameter file, coefficients and chain revision | Reproducible output from identical input and a specified version |
| Status and delay | Sample/interval quality, delay, compensation and invalid edges | Downstream correspondence of abnormal and recovery intervals |
Digital interfaces also need frame length, byte order, integrity checks, status words, buffering and retransmission rules. Successful transfer does not establish valid signals, and valid waveforms do not establish correct synchronization. Check sample values, identities and timing relationships separately.
4.2 Quality flags and missing data
Quality status needs a defined source and granularity. Disconnected leads, saturated inputs, suspect motion, communication loss and unsettled algorithms have different causes and should be recorded separately. Verify whether hardware lead-status detection is enabled and how it corresponds to samples in the actual device configuration.[S1][S2]
| Data situation | Suggested handling | Records to retain |
|---|---|---|
| Input or ADC saturation | Mark clipped intervals and avoid normal-amplitude interpretation | Channel, status, range and recovery interval |
| Sensor disconnection | Retain hardware or workflow evidence and detection conditions | Disconnection, reconnection and filter settling times |
| Sample or transfer gaps | Preserve missing intervals and deduplicate retransmission | Sequence, missing cause, duplicates and reordering rules |
| Suspect artifacts | Distinguish marking, deletion, replacement and correction | Rule/version, confidence if used, input and modified interval |
| Startup or setting change | Mark transition state and beginning of valid data | Old/new settings, effective position and state reset rules |
Zero filling can resemble an actual flat line, while interpolation can alter peaks and event timing. If filling is necessary, output the original missing-data flag and filling method, preserving the distinction between synthetic and measured samples. Inadequate-quality intervals can remain indeterminate; report usable duration and exclusion reasons.
4.3 Export and independent system checks
Keep channel labels, units, scaling, sampling and processing records consistent on export. EDF+ specifications provide physical/digital ranges, prefilter information and record timing rules, distinguishing continuous and interrupted recordings.[S8] If using EDF+, verify those fields and timing annotations. Other formats should supply an equivalent dictionary.
Read a short export with an independent parser and compare selected samples, polarity, amplitude, time and gaps. Examine low-amplitude quantization, clipping from insufficient export range, and record boundaries for channels sampled at different rates. Opening a file alone does not establish consistency with acquisition after processing and export.
5. Verification, maintenance and change records
5.1 Accept with controlled inputs and paired waveforms
Define the module's measurement and processing scope before arranging controlled electrical or digital inputs. Analog front ends require test sources matching interface conditions; digital units can use retained raw examples. The following suggestions require project-specific limits and decisions.
| Verification question | Suggested input or situation | Results to deliver |
|---|---|---|
| Are amplitude and frequency content retained? | In-band/out-of-band signals, different amplitudes and offsets | Frequency response, amplitude errors, noise and clipping |
| How do transients affect waveforms? | Steps, impulses, disconnection, overload and recovery | Paired input/output, recovery time and invalid intervals |
| Is block processing consistent? | Change block length and boundaries for identical input | Numerical differences, state management and edge comparisons |
| Are resampling and delay correct? | Continuous input with known timed events | Sampling rate, event mapping, delay and drift |
| Are abnormalities traceable? | Loss, retry, reordering, restart and setting changes | Checks of gaps, duplicates, quality and setting flags |
| Does performance survive integration? | Parallel channels, communication/storage loads and actual connections | Crosstalk, noise, buffering, power and long recordings |
Include before/after samples, conditions, input source, reference version, error calculations and failure examples in the report. Use representative physiological data to assess required morphology and cover intended connections and installation. Acquisition of human data and later analysis follow the project's established workflow. A device example itself does not validate a complete application.
5.2 Maintenance and verification after changes
Inspect connectors, input leads, shielding, supply and support. Clean and store according to actual materials and whole-device instructions. After moisture, contamination, cable replacement or board repair, target input noise, connections, gain, frequency response and recovery according to the problem. Retain abnormal samples, settings and logs before restart.
Create traceable versions when changing coefficients, sampling rate, block length, numeric format, automatic gain or quality rules. Compare again using frozen examples. Passive components, reference or AFE substitution can also change processing input conditions. Handover should include circuits and interfaces, materials and parts, register settings, chains and parameters, status rules, data dictionary, timing/latency descriptions, verification reports and the scope of checks after changes.
Any artifact-removal rate, useful-bandwidth or latency claim should correspond to a specific configuration and test record.
5.3 Technical sources and scope
The following manufacturer and official software documents were checked on 29 September 2026. Device documents support specific front-end examples; software documentation explains stated processing behaviors. Tables are engineering record and test suggestions.
[S1] Texas Instruments: ADS1299-x Data Sheet, SBAS499C. Supports biopotential channels, gain, lead status and sampling/filtering descriptions.
[S2] Texas Instruments: ADS129x Data Sheet, SBAS502C. Supports the ADS1292R respiration impedance path and channel-mode restriction.
[S3] Texas Instruments: AFE4404 Data Sheet, SBAS689D. Supports optical front ends, sampling phases and ambient-related processing conditions.
[S4] Analog Devices: AD8232 Data Sheet, Rev. D. Supports analog high-pass and fast restore examples.
[S5] Arm: CMSIS-DSP v1.17.1, FIR Decimator. Supports decimation, independent state and fixed-point behavior; this does not require the project to use that release.
[S6] SciPy: official scipy.signal.sosfiltfilt documentation. Supports forward-backward filtering; the related sosfilt state interface was also reviewed.
[S7] MNE: Filtering and resampling data, 1.12 documentation. Supports resampling antialiasing, event timing and edge effects.
[S8] EDF+: official format specification. Supports scaling, prefilter fields, timing annotations and interrupted-record format boundaries.