From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I read continous streams of data?

Hi,

 

I have connected my gyroscope via bluetooth and managed to create a block diagram but it keeps reading values one by one. I want to know how to receive continous streams of data and plot it? Any advice will be really appreciated, please find below a file of work. 

 

Regards, 

 

Okor29

0 Kudos
Message 1 of 46
(2,695 Views)

Ah, Bytes at Port (again!) rears its Ugly Head!  Most (but not all!) devices that send data via VISA use a Termination Character, usually <LF>, 0x0A.  What they expect is that the VISA Reader will be configured to Read Until Termination Character (default <LF>), which is exactly how your VISA is configured (look at the unused terminals on your VISA Configure Serial Port function, the ones on the top).  This is a Good Thing -- it means you can say "Read 1000 bytes", knowing that you'll get 10-50 (who knows, but <1000) at a time and can parse them knowing you got an "entire chunk" of data.

 

Go back and see what/how your Gyroscope sends data to you.  If it comes back as a string of numbers, maybe separated by commas (or maybe single numbers) and the string (if printed) would look like rows of text, ending in <CR><LF> (or End-of-Line), then the above should work.  If your VISA is sending more funky data streams, then you (and, if we are to be helpful, we) need to know what these look like.  Read Your Fine Manual.

 

Bob Schor

0 Kudos
Message 2 of 46
(2,653 Views)

And again,  so, you have a gyroscope.   That tells us nothing about the communication layers.  VISA, is physical layer agnostic and session layer savvy.  

 

What is the model number?  Have YOU read the manual? Is there a section in the manual that you want help interpreting into LabVIEW code?

 

Please post snippets for me.  I can't get at my laptop just my phone.

 

Hints to heavy hitters.  I'll kudos the snot out of y'all helping out while i'm pcless


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 46
(2,650 Views)

Well, back to my famous line...

 

DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (still haven't found a way to emphasize that enough)

You instrument has some type of protocol so that you know when a message/data packet is complete.

 

If you can read the data in a text file, that means it is sending data in an ASCII format and any good instrument that does this ends the message with a termination character (typically a Line Feed, 0xA, \n).  So in this case, you just enable the termination character with the VISA Configure Serial Port and tell the VISA Read to read more bytes than you ever expect in a message (I typically use 50 or 100, a general library will use 4096).  The VISA Read will stop reading when that termination character is read.  You now have the entire message and you can parse it accordingly.

 

The other option is a binary/hex format which is a little more complicated.  First, you will want to turn off the termination character.  But after than, you need to read the protocol very carefully.  These usually will have a length byte or command ID so that you know how many bytes are in the message.  Again, read the protocol in the manual and follow it to the T.

 

And do notice that neither of these methods use the Bytes At Port.  So, again, DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 46
(2,629 Views)

Thank you for your suggestions. So Bob the unused terminals on my VISA configure serial port function (termination character and enebale termination character) I should use also and input a character? Apologies if I sound vague as I am using this software for the first time. 

 

- Okor29

0 Kudos
Message 5 of 46
(2,621 Views)

Hi Jeff, What I want to interpret is the yaw, pitch and roll of the gyroscope as it is being moved on a platform. Are you asking also for the model number of te gyroscope and snippets of the manual? 

 

- Okor29

0 Kudos
Message 6 of 46
(2,619 Views)

@Okor29 wrote:

Are you asking also for the model number of te gyroscope and snippets of the manual?


If you have a PDF of the manual, that would be very helpful.  As a backup, we need to know the model of the gyroscope so we can search for a manual.

 

Until that protocol has been defined, there is no real help we can give you.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 46
(2,616 Views)

Hi crossrulz, 

 

Please find document of manual attached.

 

- Okor29 

0 Kudos
Message 8 of 46
(2,603 Views)

@Okor29 wrote:

Hi Jeff, What I want to interpret is the yaw, pitch and roll of the gyroscope as it is being moved on a platform. Are you asking also for the model number of te gyroscope and snippets of the manual? 

 

- Okor29


The manufactures manual should define the data structure of the gyroscopes communication.   If it doesn't... .you need a better gyroscope;)

Snippets of your vi. (Menu, Edit, create snippet...) would help ME see your code today.  I am moving and my PC is still working on updates for NI Software.   I need a solid state hard drive


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 46
(2,599 Views)

This gyroscope only appears to have I2C and SPI interfaces... What hardware are you using to access it with VISA?

0 Kudos
Message 10 of 46
(2,594 Views)