Generator of Aperiodic Pseudorandom Pulse Trains with Variable Parameters Based on Arduino
Abstract
1. Introduction
- programmable statistical models for ISI (exponential distribution) and PW (uniform distribution within a defined range);
- reproducibility of sequences;
- real-time telemetry and software supervision, and
- a safe output chain with opto-isolation and current limitation, suitable for laboratory and field use.
1.1. Problem, Novelty, and Contributions
- Modular APPI generator with programmable ISI (Exp(λ)) and PW (Uniform[PW_min, PW_max]), ensuring full sequence reproducibility;
- Two timing mechanisms: baseline loop and Timer/Interrupt Service Routine (ISR), where Timer/ISR (CTC) enables significant jitter reduction;
- Software interface (PC) for runtime parameterization and telemetry acquisition (event timestamps, pulse widths, planned intervals);
- A safe output chain with optical isolation and a constant-current source, optimized for load integration.
1.2. System Architecture Overview
- Microcontroller layer—event and pulse generation;
- Software layer—parameterization and logging;
- Output layer—opto-isolation and driver/constant-current source (CCS).
- Event schedule: ISI ∼ Exp(λ);
- Pulse width: PW ∼ Uniform[PW_min, PW_max];
- Telemetry: timestamps, widths, and planned pulse intervals.
1.3. Reference Dataset and Visualizations
1.4. Organization of the Manuscript
2. Related Work and Theoretical Background
2.1. Foundations of Aperiodic Pseudo-Random Pulse Generation
2.1.1. Neurostimulation and Complex Patterns
2.1.2. Algorithms and Statistical Modeling
2.1.3. Applications in Sensing and Radar Systems
2.1.4. Safety and Regulatory Aspects
2.2. Definitions and Notation
2.3. Modeling and Design Criteria
- reproducibility (seed/parameters);
- controlled stochastic structure (choice of ISI and PW distributions);
- robust timing (low jitter);
- straightforward hardware integration (opto-isolation, current limiting);
- broadband spectral properties without dominant lines.
2.4. M-Sequence with Jitter
- Uniform (e.g., a shift within the interval ±ΔT);
- Gaussian (shifts with a normal distribution);
- Exponential (shifts based on Poisson statistics).
2.5. Deterministic Structural Approaches (LFSR/m-Sequences)
2.6. Poisson Event Mechanism (Exponential ISI)
Operational Interpretations of Poisson Events for APPI
2.7. Chaotic Maps and Randomization
2.8. Hybrid Architectures
2.9. Statistical and Spectral Properties
- stable ISI and PW distributions consistent with the setup;
- low autocorrelation for τ > 0 (fast decorrelation);
- broadband spectral distribution without strong lines.
2.10. Comparative Analysis of Approaches
2.11. Related Platforms and Positioning of This Work
- the platform (MCU/FPGA);
- output mode and isolation;
- the possibility of aperiodic/pseudo-random protocols (native or “arbitrary”); and
- the level of compliance voltage/current.
- Pulse Pal (v2, Arduino Due (Arduino SRL, Somerville, MA, USA), 4× voltage outputs (Sanworks LLC, Rochester, NY, USA)). An open, programmable voltage-pulse generator with high temporal precision, v2 uses Arduino Due/ATSAM3X8E, a 12-bit bipolar DAC, and a ±10 V range, with microSD parameter storage and separate analog/digital grounds for lower noise. There is no native Poisson mode, but software-defined sequences are available, so Poisson ISI is easily realized via firmware/PC API [23].
- StimJim (dual-channel, current/voltage mode, galvanic isolation (Open Ephys, Lisbon, Portugal)). An open stimulator with two galvanically isolated outputs that generate arbitrary waveforms in current or voltage mode, practical for extracellular stimulation and electrode activation, with output current/voltage measurement. Aperiodic trains are trivial via arbitrary patterns, although Poisson is not “native”.
- Portable, programmable, multichannel HV stimulator (research prototype, no commercial manufacture, 2023). High compliance and multichannel capability with real-time adjustment of parameters (PW/frequency) for peripheral neurons, the work is research-oriented with a clear focus on high-voltage architecture and portability. Poisson is not native, but the arbitrary framework is suitable for such protocols.
- Arduino-based microcurrent stimulator (research prototype, no commercial manufacture, 2023). A low-intensity microcurrent stimulator based on the Arduino platform and modest electronics, the study reports stable timing and current regulation in DC/pulsed mode. Aperiodic sequences are achievable in software (not “native”).
- NeuroStimDuino (shield, 2 channels per board, stacking up to 222, ±60 V compliance (Neuralaxy/Crowd Supply, Portland, OR, USA)). An open Arduino shield for education/research with two independent current channels per board, biphasic, charge-balanced pulses, and opto-isolation of digital/analog domains. Specifications include max. compliance ±60 V, current range ±20 mA, and I2C configuration; Poisson protocols are realized from the controller/firmware.
- Poisson/Uniform ISI/PW in our work is explicitly modeled and verified (K–S/Q–Q/ACF/PSD);
- The safety chain (opto + CCS + compliance) that we define in Section 5 and apply in 6.1 around neuro-stimulation is directly complementary to the StimJim/NeuroStimDuino approach (isolation and current drive);
- High compliance and multichannel capability [25] are relevant to our operating envelope (Figure 23) and the plan for future hardware extensions.
2.12. Implementation Implications
- precise event scheduling (timer/ISR);
- determinism/replicability (seed, parameters);
- safe output (opto + current limiting) with minimal EMC artifacts.
3. Design and Implementation
3.1. System Architecture
- inter-pulse intervals (ISI) modeled by an exponential distribution;
- pulse widths (PW) modeled by a uniform distribution within a defined range.
- statistical flexibility (tunable distribution parameters);
- simple hardware realization;
- integration with a PC GUI via a serial link for real-time telemetry and supervision, as shown in Figure 7a.
3.1.1. Baseline Generator Implementation
- Generation of inter-pulse intervals using the exponential distribution:where is a uniformly distributed random value in (0, 1], and is the parameter that sets the average pulse rate;
- Generation of pulse width using a uniform distribution over the range:
- The digital output (e.g., D8) generates a pulse of duration .
- randomSeed is set, as needed, from a fixed seed (reproducibility) or from physical noise (e.g., analogRead(A0)) for low predictability.
3.1.2. Extended Version with Serial Communication
3.1.3. Integration with the Python GUI Interface
- Connecting to the Arduino (Arduino IDE, v2.2.1) via the serial port;
- Entry of parameters
- Display of real-time pulse logs with timestamps;
- Display of basic statistics: number of pulses generated, average width, current frequency (computed over a window of the last 5 s).
3.1.4. Advantages over Classical Generators
- Parameter variability without the need to change hardware components;
- Full control and monitoring via a software interface;
- Simple algorithm adaptation for different distributions (e.g., normal, Weibull, Gamma) to model specific biological or technical conditions;
- Possibility of mobile use (the system can operate completely stand-alone or with a portable computer).
3.1.5. Notes on Hardware Precision
- For ultra-precise applications (e.g., below 1 μs jitter), it is recommended to use hardware timers (CTC) instead of delay() functions, i.e., blocking delays;
- In neurostimulation, output opto-isolation is recommended (e.g., using 4N25, 6N137 (Broadcom Inc., San Jose, CA, USA (alternative: 4N25—Vishay Intertechnology, Malvern, PA, USA))) for patient electrical safety;
- For driving electrodes, a medical stimulator or TENS unit is required to convert the TTL signal into a controlled voltage and current per medical standards.
3.2. Hardware Realization of the Device
Functional Description of Operation
- a microcontroller layer that generates event schedules and pulses;
- a software (PC) layer for parameterization and telemetry collection;
- an output layer with optical isolation and current limiting (CCS) to the load.
- Pulse generation: the MCU samples and , schedules the event, and generates a TTL pulse (see Pseudo-code 2);
- Electrical isolation: the signal passes through the optocoupler for galvanic isolation (medical safety);
- Output adaptation: TTL is converted to a defined voltage/current (TENS/CCS or a dedicated driver);
- Application: electrodes (bio) or standard connectors (BNC) for technical loads. The isolation driver chain is shown in Figure 8.
3.3. Event and Pulse Generation (Model and Realization)
- the prescribed statistical profile of the APPI train;
- reproducibility (deterministic PRNG/seed);
- adaptability during the experiment.
3.4. Firmware: Baseline Loop and Timer/ISR (CTC)
- Baseline loop—simple, blocking, higher jitter due to background activities;
- Timer/ISR (CTC)—a hardware timer generates a “tick”, the ISR only “triggers,” while the next event and PW are computed in the main loop (short ISR, more deterministic timing). The skeleton is in Pseudo-code 3.
3.5. Serial Protocol and PC Tool (Telemetry and Control)
3.6. Methodology of Timing Measurement and Results
- generation of planned instants;
- measurement of ;
- metrics: , p95/p99, maximum, fraction .
3.7. Safety and Load Integration
4. Experimental Evaluation and Statistical Verification
4.1. Electrical Stimulation of the Nervous System in Neurophysiology
- Studying the anatomy and functional connectivity of neural pathways;
- Mapping cortical and peripheral motor areas;
- Analyzing synaptic plasticity and neuroadaptation;
- Testing and validating neuroprosthetic interfaces.
- Rehabilitation after stroke (reactivation of motor areas through repeated stimulation);
- Patients with spinal cord injury (Functional Electrical Stimulation, FES);
- Control of chronic pain (spinal and peripheral nerve stimulation);
4.1.1. The Problem of Nervous System Adaptation
- Habituation (reduced response due to repeated stimulation);
- Receptor desensitization (e.g., decreased ion-channel activity);
- Reorganization of neural networks toward reduced reactivity to predictable signals.
- Mimic the natural, unpredictable activity of neuronal networks;
- Reduce the likelihood that the CNS will recognize and filter out the stimulation signal;
- Increase the duration and stability of the therapeutic effect.
4.1.2. Advantages of Aperiodic Pseudo-Random Signals
- Biological realism—the natural neuronal firing pattern exhibits significant variability in inter-spike intervals (ISI);
- Reduced adaptation—unpredictability prevents rapid habituation;
- Flexible parameter control—independent adjustment of mean frequency, inter-pulse interval distribution, and pulse width is possible;
- Reproducibility—although they appear random, identical sequences can be generated for controlled experiments.
4.1.3. Implementation Using Arduino Mega
- Define the parameter λ (mean pulse frequency);
- Set the minimum and maximum pulse width;
- Monitor in real time the number of generated pulses, current frequency, and average width.
4.1.4. Serial Communication and Data Logging
- The pulse generation time (timestamp since device start, in milliseconds);
- The pulse width in microseconds;
- The interval to the next pulse in milliseconds.
4.1.5. Correlating Stimulation with Biological Response
- Quantify response latency;
- Analyze changes in amplitude over time;
- Assess the impact of different inter-pulse interval distributions on maintaining muscle tone or neural activity.
4.1.6. Possible System Improvements
- Multichannel stimulation with independently controlled channels;
- Wireless data transfer and control via Bluetooth or Wi-Fi;
- Integration with artificial intelligence for adaptive adjustment of stimulation parameters;
- Miniaturization and battery power for portable, long-term use in clinical settings.
4.2. Dataset, Protocol, and Metrics
- experimental timing logs from the implementation (400 events each) for the baseline loop and Timer/ISR (CTC) (Section 3).
4.3. Parameter Estimation and Descriptive Statistics
4.4. Goodness-of-Fit Tests (K–S) and Decision Criteria
- and
- .
4.5. Spectral Analysis (Periodogram of the Binned Pulse Train)
4.6. Autocorrelation (ACF) and the Memoryless Property
- the first lag, where ∣ACF∣ < 0.05 and
- the mean absolute ACF over the first 2 s window.
4.7. Timing Stability and Implications for Integration
5. Load Integration, Safety, and EMC Aspects
5.1. Load Model and Measurement Setup
5.2. Voltage Dynamics on Under CC Excitation
Refined Load Scenarios
5.3. Source Compliance and Delivered Current
5.4. Spectral Characteristics on the Load
5.5. Thermal Assessment
5.6. Safety and EMC Aspects
5.7. Reproducibility and the “Bench” Simulation Script
6. Discussion, Applications, Limitations, and Future Work
6.1. Neurostimulation Applications (Bipolar, Charge-Balanced APPI Stimulation)
6.1.1. Motivation and Design Criteria
6.1.2. Excitation Waveform and Event Distribution
- Poisson arrivals with intensity [Hz],
- a biphasic current per event, amplitude and duration PW per phase, with an inter-phase gap .
6.1.3. Adaptation and Temporal Variability
6.1.4. Operating Envelope and Compliance-Voltage Margins
6.1.5. Recommended Settings and Safety–EMC Considerations
6.1.6. Implementation Guidelines (Firmware)
6.2. Interpretation of Results Relative to Objectives
6.3. Operating Envelope and Tuning Guidelines
6.4. Mapping to Applications
6.5. Robustness to Seed and Sample Variations
6.5.1. Expanded Parameter Range and Repeatability Verification
6.5.2. Extreme-Parameter Validation
6.6. Limitations and Countermeasures
6.7. Recommendations for Practical Use
- Timing mode. Use Timer/ISR (CTC) for all requirements with strict jitter; keep the baseline loop for education and rapid prototyping.
- Setting . Operate within the “cool” zones from Figure 27, with a 10–20% margin below Vcomp.
- EMC. Control edge rate (series R/RC snubber); ensure proper return path and shielding.
- Validation. Confirm ISI/PW statistics (K–S, Q–Q) for every significant parameter change; for the spectrum, use longer records and multiple seeds.
- Traceability. Always enable telemetry and store CSV logs (time, PW, planned intervals) for measurement replication.
6.8. Future Work
- introducing non-homogeneous Poisson processes and adaptive distributions (e.g., controlled refractoriness);
- programmable edge shaping (slew) and additional output modes (e.g., bipolar excitation waveform);
- formal EMC/safety characterization according to relevant standards (outside the scope of this work), and
- a hardware platform with higher timer resolutions and rise times.
7. Conclusions
7.1. Summary of Contributions
- Broadband spectral properties without stable lines. The periodogram of the binned pulse train confirms an even energy distribution in the band of interest (see Figure 16 and Table 12; complete data are provided in the Supplementary Table S2);
- Rapid decorrelation. Autocorrelation analysis shows a rapid decay of the ACF without periodicity (see Figure 17 and Table 13; complete data are provided in the Supplementary Table S3);
- Safe load integration. A CC source with optical isolation, compliance, and current limiting enables stable operation with an load, spectral characteristics on the load remain smooth (see Figure 18, Figure 19, Figure 20, Figure 21 and Figure 22 and Table 14, Table 15, Table 16, Table 17, Table 18 and Table 19);
7.2. Quantitative Conclusions from Measurements
- Timing. The Timer/ISR (CTC) variant systematically reduces p95/p99 jitter relative to the baseline loop (Table 9), which is critical for time-sensitive protocols;
- Spectrum and ACF. The periodogram shows no stable lines (Figure 16, Table 12 and Supplementary Table S2), and the ACF is near zero already at short lags (Figure 17, Table 13, and Supplementary Table S3).
7.3. Engineering Implications
- Tuning and PW. Plan operation within the “cool” zones of the map (Figure 27), with a 10–20% margin below ;
- EMC and edges. Controlling edge rate (series R or RC snubber) and maintaining a clean return path reduces unwanted emissions; target values are summarized in Table 19.
- Traceability and replication. Conduct all experiments with event telemetry, and an archive of CSV logs and scripts is recommended (Pseudo-code 5).
7.4. Limitations and Validation of Findings
7.5. Recommendations for Application
- LPI communications/radar testing. , , focus on broadband behavior and absence of lines (Figure 16, Table 12 and Supplementary Tables).
7.6. Future Work
- non-homogeneous Poisson processes and adaptive refractoriness (dynamic );
- programmable slew and bipolar excitation modes;
- formal EMC/safety characterization against target standards (outside the scope of this work), and
- a more advanced hardware platform with finer timer resolution and improved thermal budget.
7.7. Replicability and Availability of Data/Code
7.8. Safety Notes
7.9. Concluding Remarks
7.10. Data and Code Availability
Supplementary Materials
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Steinhardt, C.R.; Mitchell, D.E.; Cullen, K.E.; Fridman, G.Y. Pulsatile Electrical Stimulation Creates Predictable, Correctable Disruptions in Neural Firing. Nat. Commun. 2024, 15, 5861. [Google Scholar] [CrossRef]
- Lee, L.H.N.; Huang, C.S.; Wang, R.W.; Lai, H.J.; Chung, C.C.; Yang, Y.C.; Kuo, C.C. Deep brain stimulation rectifies the noisy cortex and irresponsive subthalamus to improve parkinsonian locomotor activities. NPJ Parkinsons Dis. 2022, 8, 77. [Google Scholar] [CrossRef]
- Kromer, J.A.; Tass, P.A. Coordinated reset stimulation of plastic neural networks with spatially dependent synaptic connections. Front. Netw. Physiol. 2024, 4, 1351815. [Google Scholar] [CrossRef]
- Tass, P.A. A Model of Desynchronizing Deep Brain Stimulation. In Computational Neuroscience—Theoretical Insights into Brain Function; Springer: Cham, Switzerland, 2017; pp. 169–186. [Google Scholar] [CrossRef]
- Khaledi-Nasab, A.; Kromer, J.A.; Tass, P.A. Long-Lasting desynchronization of plastic neuronal networks by Double-Random coordinated reset stimulation. Front. Netw. Physiol. 2022, 2, 864859. [Google Scholar] [CrossRef]
- Golomb, S.W. Shift Register Sequences, 1967 ed.; Aegean Park Press: Laguna Hills, CA, USA, 1982. [Google Scholar]
- Grymel, M. New Programmable LFSR Counters with Automatic Encoding and State Extension. Electronics 2024, 13, 405. [Google Scholar] [CrossRef]
- Palacios-Luengas, L.; Medina-Ramírez, R.C.; Marcelín-Jiménez, R.; Rodriguez-Colina, E.; Castillo-Soria, F.R.; Vázquez-Medina, R. Enhanced Chaotic Pseudorandom Number Generation Using Multiple Bernoulli Maps with Field Programmable Gate Array Optimizations. Information 2022, 15, 667. [Google Scholar] [CrossRef]
- Alawida, M.; Samsudin, A.; Teh, J.S.; Alkhawaldeh, R.S. A New Hybrid Digital Chaotic System with Applications in Image Encryption. Signal Process. 2019, 160, 45–58. [Google Scholar] [CrossRef]
- Yu, F.; Li, L.; He, B.; Liu, L.; Qian, S.; Huang, Y.; Cai, S.; Song, Y.; Tang, Q.; Wan, Q.; et al. Design and FPGA Implementation of a Pseudorandom Number Generator Based on a Four-Wing Memristive Hyperchaotic System and Bernoulli Map. IEEE Access 2019, 7, 181884–181898. [Google Scholar] [CrossRef]
- Naik, R.B.; Singh, U. A Review on Applications of Chaotic Maps in Pseudo-Random Number Generators and Encryption. Ann. Data Sci. 2022, 11, 25–50. [Google Scholar] [CrossRef] [PubMed]
- Gehan, H.; Naud, R.; Destexhe, A. Interval correlations and spike-train adaptation. PLoS Comput. Biol. 2021, 17, e1008915. [Google Scholar] [CrossRef]
- Schluck, G.; Wu, W.; Srivastava, A. Intensity Estimation for Poisson Process with Compositional Noise. Front. Appl. Math. Stat. 2021, 7, 648984. [Google Scholar] [CrossRef]
- Kingman, J.F.C. Poisson Processes; Oxford University Press: Oxford, UK, 1992. [Google Scholar]
- Ross, S.M. Introduction to Probability Models, 12th ed.; Academic Press: Amsterdam, The Netherlands, 2019. [Google Scholar]
- De Palo, F.; Galati, G.; Pavan, G.; Wasserzier, C.; Savci, K. Introduction to Noise Radar and Its Waveforms. Sensors 2020, 20, 5187. [Google Scholar] [CrossRef] [PubMed]
- Xu, Y.; Li, S.; Zhang, H.; Peng, Y.; Zhang, T.; Liao, G. Pseudorandom-Phase-Coded Noise Waveforms for Low Probability of Intercept. Sensors 2023, 23, 5008. [Google Scholar] [CrossRef]
- Du, K.; Luo, M.; Jing, X.; Wang, H.; Zhu, W.; Zhou, C. Pulse repetition interval modulation recognition for LPI radar based on deep representation learning. Digit. Signal Process. 2022, 131, 103562. [Google Scholar] [CrossRef]
- IEC 60601-1:2005+AMD1:2012+AMD2:2020 (CSV); Medical Electrical Equipment—Part 1: General Requirements for Basic Safety and Essential Performance. IEC: Geneva, Switzerland, 2020.
- IEC 60601-1-2:2014+AMD1:2020 (CSV); Medical Electrical Equipment—Part 1-2: EMC—Requirements and Tests. IEC: Geneva, Switzerland, 2020.
- U.S. FDA. Electromagnetic Compatibility (EMC) of Medical Devices: Guidance for Industry and FDA Staff. 2022. Available online: https://www.fda.gov/media/162391/download (accessed on 8 September 2025).
- Microchip Technology. ATmega640/1280/1281/2560/2561 Datasheet; Rev. DS40002211A, 2024. Available online: https://ww1.microchip.com/downloads/en/devicedoc/atmega640-1280-1281-2560-2561-datasheet-ds40002211a.pdf (accessed on 8 September 2025).
- Sanders, J.I.; Kepecs, A. A Low-Cost Programmable Pulse Generator for Physiology and Behavior (Pulse Pal). Front. Neuroeng. 2014, 7, 43. [Google Scholar] [CrossRef]
- Cermak, N.; Wilson, M.A.; Schiller, J.; Newman, J.P. Stimjim: Open-source hardware for precise electrical stimulation. bioRxiv 2019, 757716. [Google Scholar] [CrossRef]
- Trout, M.A.; Harrison, A.T.; Brinton, M.R.; George, J.A. A portable, programmable, multichannel stimulator with high compliance voltage for noninvasive neural stimulation. Sci. Rep. 2023, 13, 3469. [Google Scholar] [CrossRef]
- Lattanzi, D.; Pagliarini, M.; Rebecchi, F.; Frontalini, F.; Ambrogini, P. Developing and testing an Arduino-based microcurrent stimulator. Heliyon 2023, 10, e23281. [Google Scholar] [CrossRef]
- Neuralaxy. NeuroStimDuino v2.1 (Product Page, Specs). Crowd Supply, 2023. Available online: https://www.crowdsupply.com/neuralaxy/neurostimduino (accessed on 8 September 2025).
- SciPy: Scipy.stats.kstest (Kolmogorov–Smirnov Test) Documentation. SciPy Manual 2024–2025. Available online: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kstest.html (accessed on 8 September 2025).
- SciPy Developers. scipy.signal.periodogram/welch Documentation. SciPy Manual 2024–2025. Available online: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.welch.html (accessed on 8 September 2025).
- Statsmodels Developers. statsmodels.tsa.stattools.acf Documentation. Statsmodels 0.14.4, 2025. Available online: https://www.statsmodels.org/stable/generated/statsmodels.tsa.stattools.acf.html (accessed on 8 September 2025).
- NumPy Developers. numpy.correlate Documentation. NumPy 2.1, 2024–2025. Available online: https://numpy.org/doc/stable/reference/generated/numpy.correlate.html (accessed on 8 September 2025).
- Texas Instruments. AN-1515: A Comprehensive Study of the Howland Current Pump; Rev. C, 2022. Available online: https://www.ti.com/lit/an/snoa474c/snoa474c.pdf (accessed on 8 September 2025).
- Texas Instruments. Analysis of the Improved Howland Current Pump; App Note, 2023. Available online: https://www.ti.com/lit/an/sboa437a/sboa437a.pdf?ts=1763645164460&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FINA592 (accessed on 8 September 2025).
- Vishay Semiconductors. 4N25, 4N26, 4N27, 4N28—Optocoupler, Phototransistor Output, with Base Connection. Datasheet, Document Number: 83725, Rev. 1.8 (07-Jan-2010). Available online: https://www.vishay.com/docs/83725/4n25.pdf (accessed on 15 September 2025).
- Vishay Semiconductors. 6N137, VO2601, VO2611, VO2630, VO2631, VO4661—High Speed Optocoupler, Single and Dual, 10 MBd. Datasheet, Document Number: 84732, Rev. 2.2 (15-Mar-2023). Available online: https://www.vishay.com/docs/84732/6n137.pdf (accessed on 15 September 2025).
- Ma, Y.; Wu, W. A Novel Point-Process Model for Neuronal Spike Trains. Front. Appl. Math. Stat. 2024, 10, 1349665. [Google Scholar] [CrossRef]
- Doguet, P.; Garnier, J.; Nieuwenhuys, A.; Godfraind, C.; Botquin, Y.; Lemaire, A.; Justice, J.; Nonclercq, A.; El Tahry, R.; Corbett, B.; et al. An Optoelectronic Implantable Neurostimulation Platform Allowing Full MRI Safety and Optical Sensing and Communication. Sci. Rep. 2024, 14, 11110. [Google Scholar] [CrossRef]
- Starkey, P.T.; Turnbaugh, C.; Miller, P.; LeBlanc, K.-J.; Meyer, D.H. Experimental Timing and Control Using Microcontrollers. Rev. Sci. Instrum. 2024, 95, 104707. [Google Scholar] [CrossRef]




























| Contribution | Description |
|---|---|
| Modular APPI generator | ISI ~ Exp(λ), PW ~ Uniform, full reproducibility |
| Timing mechanisms | Baseline loop and Timer/ISR (CTC) (reduced jitter) |
| Software interface | Real-time parameterization and telemetry |
| Output chain | Optical isolation and CCS (safety) |
| Parameter | Value |
|---|---|
| Duration | 60 s |
| (mean rate) | 2 Hz |
| PW_min/PW_max | 50 µs/1000 µs |
| Model | Event Definition | Segment Duration | Event–Pulse Ratio | Advantages | Typical Applications |
|---|---|---|---|---|---|
| A | Pulse start | PW fixed or random, pause = to next event | ≈1:1 | Precise control of pulse count, simple telemetry | Neurostimulation (biphasic event), test signals |
| B | State change (1⇄0) | Each segment random (Exp) | ≈2:1 (events–pulses) | Symmetric control of pulses and pauses, duty control | ON/OFF protocols, system switch simulations |
| C | Segment start + Bernoulli(p) | Segment random, type by Bernoulli | <1:1 (depends on p) |
| Approach | Pros | Spectral/ISI Traits | HW Complexity | Control Knobs | Reproducibility | Typical Use |
|---|---|---|---|---|---|---|
| M-sequence + jitter | low | |||||
| LFSR/m-seq | Fast, low-cost, deterministic | Flat-ish, lines if not “whitened” | Very low | Polynomial, seed | High | Testing, communications |
| Poisson | Natural ISI, simple event timer | Exponential ISI, broadband | Moderate (timer + RNG) | High | Neuro-stim, modeling | |
| Chaos | High entropy, sensitivity to initial | Broadband, parameter-dependent | Medium | μ, thresholds | Medium | Randomization, security |
| Hybrids | Flexibility and entropy | Tunable spectrum and ISI | Medium–higher | Multiple params | High | Tailoring APPI profiles |
| a | |||||||
|---|---|---|---|---|---|---|---|
| Platform | Year/Status | Base Platform | Channels | Output Mode | Isolation | Poisson Mode (Native) | Primary Sources |
| Pulse Pal v2 | 2014 (v1); v2 active 2025 | Arduino Due (ATSAM3X8E) | 4× voltage; 2× TTL trig. | Voltage (±10 V), 12-bit DAC | Opto on trigger channels | No (software sequences) | [23] |
| StimJim | ~2019–2025 | Open-hardware MCU (Open Ephys) | 2 | Current/voltage; up to ~±15 V or ±3 mA (model-dep.) | Galvanically isolated outputs | No (arbitrary waveforms) | [24] |
| Multichannel HV stimulator | 2023 | Custom MCU system | Multiple | High compliance (HV); n.a. | not available | No (arbitrary supported) | [25] |
| Arduino-based microcurrent stimulator | 2023 | Arduino | not available | Microcurrent; DC/pulsed | not available | No (possible in software) | [26] |
| NeuroStimDuino (v2.1) | 2021–2023 (v2.1) | Arduino shield + dsPIC33F (I2C) | 2 per board (stack up to 222) | Constant current; biphasic; up to ±20 mA | Opto separation of digital/analog; safety functions | No (I2C arbitrary patterns) | [27] |
| FPGA random pulse generator | 2013 (historical) | FPGA (65 nm) | Multichannel | Voltage/TTL (tunable PDF) | not available | Yes (explicit Poisson/Uniform for ISI) | |
| This work (APPI generator) | 2025 (this work) | ATmega2560 (Arduino Mega) | 1 (prototype)/up to N (future) | TTL → opto → CCS (current) | Opto isolation (digital→output) | Yes (native Poisson/Uniform) | — |
| b | |||||||
| Platform | Jitter Index (%) * | Power Consumption (mA @5V) * | Note | ||||
| Pulse Pal v2 | ~0.2–0.5 | ~50–60 | Software waveforms; microSD; high temporal precision | ||||
| StimJim | ~0.5–1 | ~40 | Low-cost, dual-current/voltage measurement | ||||
| Multichannel HV stimulator | not available | not available | Portable; real-time PW/frequency adjustment | ||||
| Arduino-based microcurrent stimulator | ~1–2 | ~30–40 | Stable timing; current regulation | ||||
| NeuroStimDuino (v2.1) | ~0.5–1 | ~50 | Open, educational; current measurement; ±60 V compliance | ||||
| FPGA random pulse generator | <0.1 | n.a. | — | ||||
| This work (APPI generator) | 0.06–0.07 (Timer/ISR) | ~105 | Reproducible Poisson/Uniform timing; GUI telemetry; safe CCS output | ||||
| RefDes | Part | Qty | Notes |
|---|---|---|---|
| U1 | Arduino Mega 2560 | 1 | Core MCU board |
| U2 | Optocoupler 6N137/4N25 | 1 | Isolation |
| Q1 | Logic-level N-MOSFET IRLZ44N (Infineon Technologies AG, Neubiberg, Germany) | 1 | Pulse driver (if needed/optional) |
| R | Resistor set | 6 | Limiters, pull-ups |
| C | Capacitors | 4 | Decoupling |
| J1 | Terminal block/BNC | 1 | Electrode/load interface |
| PS | 5 V supply (USB/DC) | 1 | System power |
| Module | I_typ (mA) | I_peak (mA) |
|---|---|---|
| Arduino Mega | 70 | 90 |
| Optocoupler + driver | 15 | 25 |
| Misc (LEDs, USB bridge) | 20 | 30 |
| TOTAL | 105 | 145 |
| Signal | Arduino Pin | Direction | Notes |
|---|---|---|---|
| Pulse_OUT | D8 | Output | TTL pulse to opto input |
| Serial RX/TX | USB | Bidirectional | Control and logs |
| AnalogSeed | A0 | Input | PRNG seed (as needed) |
| Scenario | Mean_Jitter_ms | Std_Jitter_ms | p95_Jitter_ms | p99_Jitter_ms | Max_Jitter_ms | Miss_Rate_5 ms [%] |
|---|---|---|---|---|---|---|
| Baseline loop | 0.451107 | 2.983185 | 4.941738 | 11.83103 | 13.75583 | 5.0% |
| Timer/ISR (CTC) | 0.025930 | 0.283594 | 0.335850 | 0.530392 | 2.274297 | 0.0 |
| lambda_mle_Hz | isi_mean_s | isi_std_s | pw_min_µs | pw_max_µs | pw_mean_µs | pw_std_µs | duration_s | num_events |
|---|---|---|---|---|---|---|---|---|
| 2.2242 | 0.4496 | 0.431429 | 50 | 1000 | 532.8626 | 296.7227 | 59.65008 | 131 |
| Test | D | p_Value | n |
|---|---|---|---|
| KS ISI vs. Exp() | 0.063707 | 0.667005 | 130 |
| KS PW vs. Uniform[min,max] | 0.078007 | 0.402701 | 131 |
| fs_Hz | N_bins | dominant_freq_Hz | max_to_mean_power_ratio |
|---|---|---|---|
| 1000 | 59,651 | 268.8639 | 8.834078 |
| decorrelation_lag_ms (<0.05) | mean_abs_acf_first_2 s |
|---|---|
| 60 | 0.01 |
| Vsupply [V] | Ilimit [A] | Vcompliance [V] | R [Ω] | C [F] | dt [µs] | Window [s] |
|---|---|---|---|---|---|---|
| 12 | 0.01 | 10 | 1000 | 1.0 × 10−7 | 1 | 0.5 |
| time_s | pulse_width_µs |
|---|---|
| 0.475443 | 134 |
| pulse_start_s | pulse_width_µs | vmax [V] | rise_time_10_90 [µs] | Droop [V] | energy_pulse [mJ] |
|---|---|---|---|---|---|
| 0.475443 | 134 | 7.372874 | 102 | 0 | 0.003287 |
| [Hz] | dominant_freq [Hz] | Max/Mean Power Ratio | |
|---|---|---|---|
| 1000 | 59,651 | 268.8639 | 8.834078 |
| Pload,avg [mW] | PCCS,avg [mW] | Ptotal,avg [mW] | Duty [%] |
|---|---|---|---|
| 0.012076 | 0.020158 | 0.032234 | 0.0268 |
| Parameter | Target (Design) |
|---|---|
| Isolation test voltage (1 min) | ≥2.5 kV DC |
| Creepage/Clearance (logic ↔ output) | ≥6 mm |
| ≥30% (datasheet-dep.) | |
| Output current limit (CCS) | 10 mA (programmable) |
| Output compliance voltage | 10 V (nominal) |
| EMC edge-rate control | RC snubber/series R |
| Parameter | Recommendation | Rationale |
|---|---|---|
| Pulse form | Biphasic, charge-balanced (cathodic-first), inter-phase gap 25–100 µs | Avoid net DC, reduce electrode polarization [13,14] |
| ) | 0.5–5 mA (bench), start low and step | Within open-source stimulator ranges [13,14] |
| PW per phase | 100–500 µs | Common for peripheral stimulation [11,12,13,14] |
| Rate ( or PRF) | 1–5 Hz | Aperiodic timing reduces adaptation [11,12] |
| Aperiodic timing | Poisson-like (Exp ISI) with logging | Memoryless intervals mitigate anticipation [11,12] |
| Compliance margin | Headroom vs. impedance drift [19,20] | |
| Isolation and CCS | Opto + CCS with limit and monitoring | Safety boundary and current control [19,20,21,32] |
| Item | Target/Note |
|---|---|
| Edge control/EMC | Series R/RC snubber, shield cabling [32,33] |
| Galvanic isolation boundary | Maintain creepage/clearance, dedicated return path [32,34,35] |
| Current limit and monitor | with fault latch [19,20,21] |
| Compliance voltage | per electrode impedance, margin 10–20% [19,20] |
| Charge balance | Symmetric biphasic or active reset, log net charge [13,14] |
| Telemetry and logs | per pulse (CSV) |
| Application | Key Requirements | Recommended Settings | Safety/Notes |
|---|---|---|---|
| Neurostimulation (in vitro) | Low jitter; reproducible APPI; CCS (limited I); isolation | ; Timer/ISR (CTC) | ; electrode interface; event logging |
| LPI comms/radar test | Broadband spectrum; minimal lines; long runs | ; Timer/ISR (CTC) | EMC shielding; duty control |
| EMC stress/device screening | Edge-rate shaping; controllable duty; isolation | ; Timer/ISR (CTC) | |
| Device characterization | Repeatability; parameter sweep; telemetry | ; Timer/ISR (CTC) | Use Figure 27 map; keep CSV logs |
| Education/lab training | Simplicity; visibility of effects | ; baseline/Timer | Lower currents; SOPs |
| a | ||||||
|---|---|---|---|---|---|---|
| Seed | n_events | lambda_mle_Hz | KS_ISI_D | KS_ISI_p | KS_PW_D | KS_PW_p |
| 1001 | 72 | 2.411722 | 0.050877 | 0.992894 | 0.121374 | 0.239323 |
| 1002 | 62 | 2.160015 | 0.071973 | 0.91012 | 0.139015 | 0.181965 |
| 1003 | 44 | 1.502904 | 0.107805 | 0.699679 | 0.132057 | 0.42675 |
| 1004 | 55 | 1.864443 | 0.087445 | 0.803393 | 0.118852 | 0.418878 |
| 1005 | 61 | 2.002346 | 0.091119 | 0.701545 | 0.067714 | 0.942441 |
| b | ||||||
| λ (Hz) | PW (µs–ms) | Mean(ISI) Deviation (%) | Jitter RMS (µs) | Repeatability (10 Runs) | Pass/Fail | |
| 0.1 | 100 ms | <0.3 | 284 | Stable | ✔ | |
| 1 | 10 ms | <0.3 | 276 | Stable | ✔ | |
| 10 | 1 ms | <0.3 | 262 | Stable | ✔ | |
| 100 | 10 µs | <0.3 | 286 | Stable | ✔ | |
| Limitation | Mitigation |
|---|---|
| Finite record effects (periodogram/ACF) | Longer duration, multiple seeds, average spectra |
| Timer resolution/MCU jitter | Timer/ISR (CTC), keep ISR short, stable clock |
| Compliance saturation (high R or long PW) | Use Figure 27, reduce PW or , increase Vcomp within safety |
| EMC emissions from fast edges | Series R/RC snubber, careful layout, shielding |
| PW quantization at short widths | , characterize error |
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. |
© 2025 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 (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Andrijević, N.; Lovreković, Z.; Milovanović, M.; Božilović Đokić, D.; Tomašević, V. Generator of Aperiodic Pseudorandom Pulse Trains with Variable Parameters Based on Arduino. Electronics 2025, 14, 4577. https://doi.org/10.3390/electronics14234577
Andrijević N, Lovreković Z, Milovanović M, Božilović Đokić D, Tomašević V. Generator of Aperiodic Pseudorandom Pulse Trains with Variable Parameters Based on Arduino. Electronics. 2025; 14(23):4577. https://doi.org/10.3390/electronics14234577
Chicago/Turabian StyleAndrijević, Nebojša, Zoran Lovreković, Marina Milovanović, Dragana Božilović Đokić, and Vladimir Tomašević. 2025. "Generator of Aperiodic Pseudorandom Pulse Trains with Variable Parameters Based on Arduino" Electronics 14, no. 23: 4577. https://doi.org/10.3390/electronics14234577
APA StyleAndrijević, N., Lovreković, Z., Milovanović, M., Božilović Đokić, D., & Tomašević, V. (2025). Generator of Aperiodic Pseudorandom Pulse Trains with Variable Parameters Based on Arduino. Electronics, 14(23), 4577. https://doi.org/10.3390/electronics14234577

