LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA stable or new sampling frequency

Solved!
Go to solution

Hello,

 

I acquire an ECG signal using the Arduino Uno and VISA. The problem is that the sampling frequency is not stable so I cannot define the time axis for the RR interval acquisition. Is there any other way how to set a new sampling frequency or how to stabilize the original one? The sample rate is around 95 S/s. Is it 9600/1024?

 

Thank you,

Dan

0 Kudos
Message 1 of 14
(3,001 Views)

If you can acquire a timestamp (or relative time) together with your measurements then you don't need a constant dt - you can use an XY Graph to display, and multiple arrays (or complex numbers) to hold the data set together with the time values.


GCentral
0 Kudos
Message 2 of 14
(2,998 Views)

Post your code and we can give advice.

Tim
GHSP
0 Kudos
Message 3 of 14
(2,995 Views)

How is it possible to acquire timestamp? Could you please show me any example? Here is my code.

0 Kudos
Message 4 of 14
(2,980 Views)
Solution
Accepted by topic author dan23

Here's a simple modification:

visa_olimexv2_BD.png

 

I added a Re/Im to Complex node, and changed the representation of your shift register value, then replaced the waveform chart with an XY graph.

Note that this is recording the time you receive the data - not the time the data was measured!

If this distinction is important (it may well be) you'll need to try and acquire the time on the Arduino and transmit pairs of data (time and value).


GCentral
Message 5 of 14
(2,970 Views)

Thank you very much, I will try it out. 

0 Kudos
Message 6 of 14
(2,963 Views)

Just in case you don't know, the image I posted is a VI Snippet and should be possible to drag onto a block diagram to place the code.

 

That being said, it's only a small modification to the code you uploaded, and the forums + snippet system can be a bit fiddly (can't drag directly from the browser anymore, need to download, then fiddle with windows above and below... urgh.)

 

But in general, you can see the snippets by the outline, and they can be useful if it isn't basically just the code you already have 🙂


GCentral
0 Kudos
Message 7 of 14
(2,956 Views)

One small recommendation if you use the approach in cbutcher's snippet and timestamp your *receipt* of the message:

 

Use some sequencing method (this is one decent place for a single frame sequence structure) to make sure you query your timestamp immediately *after* returning from the VISA Read.  That'll do a better job of capturing the receipt time.  But realize that his caveat still holds true -- timestamping the receipt is still less true than timestamping at the source.

 

(I was gonna modify in place, but although the snippet was labelled 2015, my attempts to drag it into 2016 failed, identifying it as a 2019 snippet?)

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 8 of 14
(2,934 Views)

Thank you, I really appreciate these recommendations.  

0 Kudos
Message 9 of 14
(2,928 Views)

If I could ask you about one more question. How to calculate the sampling frequency/sample rate in this case?

0 Kudos
Message 10 of 14
(2,926 Views)