Timer-Based Digitization of Analog Sensors Using Ramp-Crossing Time Encoding
Abstract
1. Introduction
- A time-domain analog-to-digital conversion method that replaces conventional amplitude quantization with ramp-crossing timing, enabling accurate waveform reconstruction using only comparator transitions and timer captures and thereby eliminating the need for dedicated ADC hardware.
- An analytical framework and architectural formulation that characterize the voltage–time mapping, derive closed-form expressions for resolution and timing uncertainty, and establish the operating conditions required for monotonic and single-crossing behavior in practical mixed-signal implementations.
- Comprehensive validation through simulation and hardware experimentation, demonstrating high-fidelity reconstruction of sinusoidal and physiological PPG signals with effective resolutions above 12 bits, and confirming the practicality, efficiency, and scalability of time-based sensing for embedded and resource-constrained instrumentation.
2. System Architecture and Method
2.1. System Architecture
2.2. Timing Behavior
2.3. Implementation Guidelines
- Ramp period Tr, which defines the temporal sampling rate;
- Ramp slope VCC/Tr, which sets the voltage-to-time sensitivity;
- Timer frequency fosc, which determines time-quantization resolution.
3. Theoretical Analysis
3.1. Crossing Condition and Voltage–Time Mapping
3.2. Resolution and Linearity
3.3. Error and Uncertainty
3.4. Quantization and Effective Resolution
3.5. Small-Signal Approximation
3.6. Large-Signal and Dynamic Effects
3.7. Temporal Sampling and Reconstruction
3.8. Discussion
4. Simulation and Experimental Validation
4.1. Simulation Setup
- A 60 Hz sinusoidal waveform representing a typical analog signal derived from mains-powered loads. This signal emulates the fundamental component of household or industrial AC power. It serves as a reference for applications such as measuring electrical energy consumption, monitoring load behavior, or assessing power quality parameters.
- A photoplethysmographic (PPG) signal is a low-frequency, non-sinusoidal biosignal that reflects pulsatile changes in blood volume within peripheral tissues. In this work, a real PPG waveform is used, extracted from the BIDMC PPG and Respiration dataset available on PhysioNet (PhysioNet BIDMC Dataset [15]), which provides clinical-grade recordings acquired at 125 Hz. This type of signal is widely employed in biomedical instrumentation for heart rate estimation, cardiovascular monitoring, and wearable sensing applications, making it an illustrative example of a slowly varying analog waveform suitable for evaluating time-based digitization methods.
4.2. Experimental Setup
- In the first experiment, the current waveform was obtained using a YHDC SCT-013-000 non-invasive current transformer (CT), a widely used sensor for AC mains monitoring. This device provides galvanic isolation, a nominal range of 0–100 A AC, and a 2000:1 transformation ratio. Its current-mode secondary output was converted into a measurable voltage using an external burden resistor mounted on the breadboard. The resulting signal, proportional to the mains current, was applied to the PSoC comparator input for ramp-crossing detection. Figure 3a shows a schematic of this configuration, illustrating the connections among the CT, the DAC ramp generator, the comparator, and the timer/capture subsystem. Figure 3b presents a photograph of the physical setup, including the PSoC 5LP board, the SCT-013-000 sensor clamped to the mains cable, the resistive heater used as a four-level variable load, and the measurement equipment used during testing. A laptop running the reconstruction software and a digital oscilloscope (Keysight DSOX2014A) used for waveform verification are also visible, illustrating the complete hardware environment employed during validation. An OLED display module connected via I2C was included to provide real-time visualization of the reconstructed waveform, although the detailed analysis was performed offline.
- In the second experiment, a commercial optical heart-rate monitor (Pulse Sensor from World Famous Electronics) was used to acquire PPG waveforms. This reflective optical module outputs an analog signal proportional to pulsatile blood-volume changes. Its output was routed directly to the PSoC comparator input, enabling the system to record event timings associated with the evolving amplitude of the PPG waveform. For this test, the DAC generated a 0–4 V sawtooth ramp at 80 Hz, matching the slow dynamics of physiological signals. Figure 4a illustrates the schematic of the PPG acquisition setup, showing the sensor interface, the ramp generator, and the timer/capture logic. Figure 4b shows a photograph of the hardware arrangement, including the PSoC board, oscilloscope probes used for visual verification, and the PPG sensor placed on the subject’s fingertip.
5. Results and Discussion
5.1. Simulated Results
5.1.1. Sinusoidal Signal
5.1.2. PPG Signal
5.2. Experimental Results
5.2.1. Sinusoidal Signal
5.2.2. PPG Signal
5.3. Comparison with Related ADC-Less and Time-Based Techniques
6. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
Appendix A

| Block | Parameter | Configured Value | Description/Notes |
|---|---|---|---|
| WaveDAC8 (ramp generator) | Output range | VDAC 0—4.080 V | Internal DAC range used for ramp generation. |
| Waveform type | Sawtooth | Linear, periodic ramp. | |
| Amplitude | 4.000 Vpp | Approximately 0–4 V swing. | |
| Offset | 2.040 V | Internal offset required by the DAC. | |
| Frequency | 1.250 kHz | Ramp period Tr = 800 μs. | |
| Samples per period | 200 samples | DAC update resolution for the ramp. | |
| Clock source | Internal, 250 kSPS | Built-in sample clock. | |
| Comparator (Comp) | Hysteresis | Enabled | Reduces chatter around the crossing instant. |
| Speed | Fast | Minimizes propagation delay. | |
| Polarity | Non-inverting | Output goes high when v+ > v−. | |
| Sync mode | Bypass | Avoids additional synchronization delay. | |
| Frequency Divider FreqDiv_1) | Divider | 2 | Divides 32 MHz system clock by 2. |
| Output clock | 16 MHz | Timer tick = 62.5 ns. | |
| Counter (Count, UDB) | Resolution | 16 bits | Time-stamp counter. |
| Period | 65,534 | Free-running up counter. | |
| Clock mode | Up counter | Counts upward continuously. | |
| Capture mode (Advanced) | Rising edge | Captures timer value on comparator edge. | |
| Reload option | On reset | Counter is cleared by firmware reset. | |
| Edge detector (EdgeDetStartCount) | Edge type | Falling Edge | Generates a clean pulse for each comparator transition. |
| Resolution | 12 bits | Conventional reference measurement. | |
| Conversion rate | 100 kSPS | As reported by PSoC Creator. | |
| SAR ADC (reference path) | ADC clock | 1.846 MHz (internal) | Derived from internal clock. |
| Sample mode | Hardware trigger | Synchronized with firmware events. | |
| Input range | Vssa–Vdda (single-ended) | Direct connection to sensor output. | |
| Reference | External Vref = 2.500 V | Precision voltage reference. | |
| UART | Baud rate | 9600 bps | Transmission of timestamps and ADC samples. |
| Framing | 8-N-1 | 8 data bits, no parity, 1 stop bit. | |
| Current sensor front-end | Sensor type | YHDC SCT-013-000 | Non-invasive AC current transformer. |
| Nominal range | 0–100 AAC | Mains current measurement. | |
| Turns ratio | 2000:1 | Current-mode secondary. | |
| Burden resistor | 100 Ω | Converts secondary current to voltage. | |
| Measured signal | 60 Hz sinusoidal | Mains-derived current waveform. |
| Block | Parameter | Configured Value | Description/Notes |
|---|---|---|---|
| WaveDAC8 (ramp generator) | Output range | VDAC 0–4.080 V | Same output range as sinusoidal experiment. |
| Waveform type | Sawtooth | Linear ramp matched to low-frequency PPG dynamics. | |
| Amplitude | 4.000 Vpp | Approximately 0–4 V swing. | |
| Offset | 2.040 V | DAC internal offset. | |
| Ramp frequency | 80 Hz | Ramp period Tr = 12.5 ms. | |
| Samples per period | 1250 samples | Higher sample density to ensure ramp linearity at low frequency. | |
| Clock source | Internal, 100 kSPS | Lower sampling rate than sinusoidal experiment due to longer ramp period. | |
| Comparator (Comp) | Hysteresis | Enabled | Identical to sinusoidal experiment. |
| Speed | Fast | Ensures clean detection of slow-varying PPG crossings. | |
| Polarity | Non-Inverting | As in previous experiment. | |
| Sync mode | Bypass | Avoids internal synchronization delay. | |
| Frequency Divider (FreqDiv_1) | Divider | 2 | Same configuration as sinusoidal experiment. |
| Output clock | 16 MHz | Timer resolution = 62.5 ns. | |
| Counter (Count, UDB) | Resolution | 16 bits | Time-stamp counter. |
| Period | 65,534 | Free-running. | |
| Clock mode | Up counter | Same behavior as before. | |
| Capture mode | Rising edge | Captures timestamp on comparator event. | |
| Reload option | On Reset | Controlled via firmware. | |
| Edge Detector | Edge type | Falling Edge | Extracts clean comparator transitions for timestamping. |
| SAR ADC (reference) | Resolution | 12 bits | Used for ADC–ATC comparison. |
| Conversion rate | 100 kSPS | Sufficient for PPG bandwidth. | |
| Sample mode | Hardware trigger | Synchronization with timing logic. | |
| Input range | Vssa–Vdda | Single-ended. | |
| Reference | External Vref = 2.500 V | Ensures ADC reference stability. | |
| UART | Baud rate | 9600 bps | Same interface used to send timestamps and ADC samples. |
| Sensor type | Pulse Sensor (World Famous Electronics) | Reflective optical photoplethysmography module. | |
| Supply voltage | 5 V | Standard operating voltage. | |
| PPG sensor front-end | Output type | Analog, filtered | Outputs amplitude variations proportional to blood volume changes. |
| Placement | Fingertip | Typical physiological measurement site. | |
| Dominant frequency | ~1.2–1.4 Hz | Corresponding to ~72–84 bpm. |
References
- Pallás-Areny, R.; Webster, J.G. Sensor Signal Conditioning, 2nd ed.; Wiley-Interscience: Hoboken, NJ, USA, 2000. [Google Scholar]
- Abdulhussain, S.H.; Khogali, A.; Yaseen, M.; Oleiwi, Z.S.; Alsharif, M.H.; Abdulhassan, F.F.; Al-bderat, L.; Alarood, A.A. A Comprehensive Review of Sensor Technologies in IoT: Opportunities, Challenges, and Applications. Computers 2025, 14, 342. [Google Scholar] [CrossRef]
- Javaid, M.; Haleem, A.; Singh, R.P.; Suman, R. Significance of Sensors for Industry 4.0: Roles, Capabilities, and Applications. Sens. Actuators Rep. 2021, 3, 100048. [Google Scholar] [CrossRef]
- Reverter, F. The art of directly interfacing sensors to microcontrollers. J. Low. Power Electron. 2012, 2, 265–281. [Google Scholar] [CrossRef]
- Puentes-Conde, G.M.; Sifuentes, E.; Molina, J.; Enríquez-Aguilera, F.; Bravo, G.; Navarro-Enríquez, G. Direct Interface Circuits for Resistive, Capacitive, and Inductive Sensors: A Review. Electronics 2025, 14, 2393. [Google Scholar] [CrossRef]
- Peter, D.; Baker, B.C.; Butler, D.; Darmawaskita, H. Make a Delta-Sigma Converter Using a Microcontroller’s Analog Comparator Module; Microchip Technology Inc.: Chandler, AZ, USA, 1998; pp. 588–593. [Google Scholar]
- Soldera, J.D.B.; Espindola, M.; Olmos, A. Implementing a 10-Bit Sigma-Delta Analog-to-Digital Converter Using the HC9S08Rx MCUFamilyAnalog Comparator. Free. Semicond. 2005, 1–22. Available online: https://www.nxp.com/docs/en/application-note/AN2688.pdf (accessed on 10 June 2025).
- Weber, P.; Windish, C. Build a complete industrial-ADC interface using a microcontroller and a sigma-delta modulator. EDN 2007, 52, 63. [Google Scholar]
- Integrated ADC for Altera Cyclone-IV Devices, Missing Link Electronics, Technical Brief. 2011. Available online: https://www.missinglinkelectronics.com/wp-content/uploads/2012/08/MLE-TB20110419.pdf (accessed on 15 June 2025).
- Bengtsson, L. Direct analog-to-microcontroller interfacing. Sens. Actuators A Phys. 2012, 179, 105–113. [Google Scholar] [CrossRef]
- Grossi, M. Efficient and Accurate Analog Voltage Measurement Using a Direct Sensor-to-Digital Port Interface for Microcontrollers and Field-Programmable Gate Arrays. Sensors 2024, 24, 873. [Google Scholar] [CrossRef] [PubMed]
- Reverter, F.; Gasulla, M.; Pallàs-Areny, R. Timer-Based Demodulation for Amplitude-Modulated Sensor Signals. IEEE Trans. Instrum. Meas. 2017, 66, 3170–3178. [Google Scholar] [CrossRef]
- Widrow, B.; Kollár, I. Quantization Noise: Roundoff Error in Digital Computation, Signal Processing, Control, and Communications; Cambridge University Press: Cambridge, UK, 2008. [Google Scholar]
- Gray, R.M.; Neuhoff, D.L. Quantization. IEEE Trans. Inf. Theory 1998, 44, 2325–2383. [Google Scholar] [CrossRef]
- Pimentel, M.; Johnson, A.; Charlton, P.; Clifton, D. BIDMC PPG and Respiration Dataset, version 1.0.0; PhysioNet: Cambridge, MA, USA, 2018. Available online: https://physionet.org/content/bidmc/1.0.0/ (accessed on 25 November 2025).








| Method/Ref. | Platform | Conversion Principle | Required Hardware | Advantages | Limitations |
|---|---|---|---|---|---|
| Peter et al. (1998) [6] | PIC16 | First-order ΔΣ loop using a comparator | 2 resistors + capacitor | Simple; flexible input range; minimal external parts | Limited DC accuracy; relies on internal reference |
| Soldera et al. (2005) [7] | HC9S08Rx MCU | Continuous-time ΔΣ | Comparator + RC + timers | ~10-bit resolution; embedded filtering | Low bandwidth; high OSR required |
| Weber & Windish (2007) [8] | MSP430 + AD7400 | External ΔΣ modulator | Dedicated modulator + MCU | Industrial precision; high linearity | Higher cost; external IC required |
| FPGA LVDS DSM (2011) [9] | Altera Cyclone IV | ΔΣ using LVDS as a comparator | 2 resistors + capacitor | 60 dB SNR (~10 bits); up to 500 kS/s | Requires HDL design; parameter tuning |
| Bengtsson (2012) [10] | PIC18F458/FPGA | RC charge/discharge + Schmitt trigger | 2 resistors + capacitor | No ADC or comparator; ~12-bit equivalent | Strongly nonlinear; LUT required; ~65 Hz BW |
| Grossi (2024) [11] | FPGA/MCU | Astable multivibrator; duty cycle | 2 resistors + capacitor | Improved linearity; no pre-charge; no LUT | Limited sampling rate (10–128 Hz) |
| Reverter et al. (2017) [12] | MCU | Triangular-ramp crossing (AM demodulation) | DAC/PWM + comparator | Precise envelope extraction | Not intended for arbitrary waveforms |
| This work | MCU | Sawtooth ramp-crossing time encoding | PWM/DAC + comparator + timer | Single crossing; constant slope; linear mapping; higher efficiency | Requires a stable ramp |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Bravo, G.; Sifuentes, E.; Puentes-Conde, G.M.; Enríquez-Aguilera, F.; Cota-Ruiz, J.; Díaz-Roman, J.; Castro, A. Timer-Based Digitization of Analog Sensors Using Ramp-Crossing Time Encoding. Technologies 2026, 14, 72. https://doi.org/10.3390/technologies14010072
Bravo G, Sifuentes E, Puentes-Conde GM, Enríquez-Aguilera F, Cota-Ruiz J, Díaz-Roman J, Castro A. Timer-Based Digitization of Analog Sensors Using Ramp-Crossing Time Encoding. Technologies. 2026; 14(1):72. https://doi.org/10.3390/technologies14010072
Chicago/Turabian StyleBravo, Gabriel, Ernesto Sifuentes, Geu M. Puentes-Conde, Francisco Enríquez-Aguilera, Juan Cota-Ruiz, Jose Díaz-Roman, and Arnulfo Castro. 2026. "Timer-Based Digitization of Analog Sensors Using Ramp-Crossing Time Encoding" Technologies 14, no. 1: 72. https://doi.org/10.3390/technologies14010072
APA StyleBravo, G., Sifuentes, E., Puentes-Conde, G. M., Enríquez-Aguilera, F., Cota-Ruiz, J., Díaz-Roman, J., & Castro, A. (2026). Timer-Based Digitization of Analog Sensors Using Ramp-Crossing Time Encoding. Technologies, 14(1), 72. https://doi.org/10.3390/technologies14010072

