04-16-2018 09:02 PM
Guys, can anyone suggest a solution to convert this serial read into a time-info waveform data? Since my project is have to take the value from EMG sensor and convert it in frequency domain via FFT.
This is my final project. I will appreciate for your help!
Solved! Go to Solution.
04-16-2018 09:05 PM
Below is the VI.
04-17-2018 06:28 AM
There are a few options here.
1. Assume your device puts a measurement out at a specific rate. Use that rate for the dt.
2. Use the Get Date/Time In Seconds to get the current timestamp and use that as the T0.
Since you are worried about an FFT, I would go with 1 and use a FOR loop to get a bunch of samples into an array before doing the FFT. Having that number of samples being a power of 2 (2, 4, 8, 16, etc) will really help the calculations.
04-17-2018 07:32 PM
ya I have tried option 2 but it didn’t work, it only value changes in time of 0. Other time such as 1s or further are not showing the value.
How to set the sampling rate and array?
04-17-2018 07:42 PM
@tank0210 wrote:How to set the sampling rate and array?
Put the VISA Read inside of a FOR loop with the values autoindexing out. This will build your array. You then use Build Waveform with the array going into Y and your sample rate into dt.
04-18-2018 08:36 AM
Thanks for your help!
By the way how should I control the actual timing in the loop?
Because it seems like running faster than actual time and labview cannot show actual timing.
Or just let it be?
Here is my arduino code on sampling rate.
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delayMicroseconds(1000);
}
04-18-2018 08:57 AM
@tank0210 wrote:
By the way how should I control the actual timing in the loop?
Because it seems like running faster than actual time and labview cannot show actual timing.
On the LabVIEW side, the loop rate should be determined by the rate at which data comes in.
But looking at your timing, you will likely run into problems. With a Baud rate of 9600, you can basically do 960 bytes/second or ~1.04ms/byte. Your Arduino is trying to go faster than that. So the first thing I would do is try to set your Baud rate to be a lot faster. 115200 the fastest commonly used Baud rate, so I would try using that.