Im trying to acquire EMG signals real time using Arduino support package in simulink. I'm using analog Input block for data acquire. But I dont get data at the rate I wanted it to be. for example, for 1k sampling frequency I dont get expexted samples. futhur more, when the filters also added to the block, this becomes more slower and loss huge amount of data.Is there a way to make this process faster, so that i can obtain expected samples.
MATLAB: Real time data acquisition
arduinosimulink
Related Solutions
Simulink Desktop Real-Time does not support USB devices because of the insufficient performance of the USB interface in sample-by-sample mode.
For example, in the USB-6009 data sheet:
there are two sample rates mentioned: 48 kS/s (i.e. 48 kHz) and 150 Hz.
The first sample rate of 48 kHz is for the following use case: when you trigger data acquisition session, the device reads the samples into its internal memory (no USB communication required), and when finished, you read all the samples via USB (when fast response is no more a requirement). This workflow cannot be used in a closed-loop SLDRT model that needs each sample to be processed immediately after it is measured.
On the other hand, there is the second sample rate of 150 Hz, for software-triggered operations on analog output. While this sample-by-sample mode would be suitable for SLDRT, this maximum achievable rate of 150 Hz is simply too low to be of interest for the SLDRT product.
You are getting about 25 Hz. Most people report that they cannot do better than about 40 Hz when using this style of interaction with arduino.
If you want something faster you will need to create code for the arduino that continually does the reading of the digital pin and sending the results back. Even if you only do that when prompted MATLAB sending something to the arduino serial port, you would get better performance; best performance would be if the arduino just continually sent data.
Note that the arduino limits the rate at which it sends serial packets over USB, and that rate is pretty far down and difficult to overcome. There is an arduino-like device that uses a different USB interface that can do better, but the device is not as flexible as arduino in other ways. USB itself limits the number of transactions per second.
USB is the wrong interface to use for real-time serial work; it is a bit better for streaming audio or streaming video, which use different parts of the USB protocol that can guarantee time allocations and bandwidth.
Best Answer