Simulink & Arduino losing precision with multiple digital input blocks
Show older comments
Hi everyone, I have an issue with losing precision using a TTL pulse for synchronization using Simulink & Arduino.
For context: I want to synchronize a recording of brain activity to other measurements I am performing. For this, I am sending a semi-random pulse using Arduino_01 to the hardware recording brain activity (IMEC-PXIe Acquisition module), while also sending it to Arduino_02 that I’m using as DAQ, recording timestamps for pulses, speed on a wheel, and other measurements. (See Figure 01 for recording hardware diagram)

This works fine when Arduino_02 only records the TTL pulse, i.e., using a single Digital Input Arduino block. (Figure 02).

However, when I include other digital input blocks (to record other signals), it seems as if the sampling of the TTL pulse is reduced, leading to a different number of pulses between the IMEC module and the data recorded on MATLAB . (See Figure 03 to illustrate the effects of the problem).

I explored other alternatives, such as using an NI-USB-6001 to do the same, but I ran into the exact same situation: When using more than one digital input, it’s as if there is a loss in the sampling at which the TTL is being record. Any help would be greatly appreciated since I really don’t have an idea of how to solve this issue.
1 Comment
Arun Kumar
on 25 Apr 2022
Edited: Arun Kumar
on 25 Apr 2022
Hi Lucis,
Please consider using External Interrupt block available in the Simulink support packge for Arduino hardware and see if you face the same issue.
Answers (0)
Categories
Find more on Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!