LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel serial visa read with arduinos, data is delayed

Solved!
Go to solution

Hello,

Currently I am using two arduinos to read in data from temperature and humidity sensors asyncronously. Each arduino sends back 4 floats, separated by commas, with a termination character of '\n'. In labview, this data gets broken up and then pushed to live plots. Additionally, the data gets written out to a file - arduino #1 and arduino #2 have their data sent to different files. It is important to note that the arduinos have different rates by which they send data over the serial comms. Ideally, we'd like the data from each arduino to come in and update the plots in real-time independent from each other. 

I am having an issue where the data does not seem to be displayed real time. I can touch a thermocouple and then ten seconds later the temperature will change. This delay seems to get bigger the longer the program runs for, which is a problem since we use the live output from the plots to determine when to initiate various cooling processes.

I am wondering if due to the different rates of data the arudiunos push, if there is some sort of buffer somewhere that has a "backlog" of the faster arrduino data and it is waiting for the slower arduino's data before it does anything. This is of course a data-flow problem, but I am fairly green with LabView and was looking for some advice or pointers. I'd like to mention that the arduinos are not sending data quickly; they are sending about every two seconds or so. 

0 Kudos
Message 1 of 4
(2,689 Views)
Solution
Accepted by topic author MrScientist

Hello MrScientist,

 

can you please try to use two separate while loops one for each COM port, because if both are in the same loop it can happen that they block each other.

 

A second option is always to read all informations on the COM port and to made a ring buffer and filter out the informations from these buffer.

best regards
Alexander
0 Kudos
Message 2 of 4
(2,629 Views)

Yes, the simple solution is to just have 2 loops, one for each Arduino.  What is happening now is that your loop is only running at the slower of the two communication rates (rates of the messages).  So since one is slower than the other, the faster one will have a build up of messages in its buffer.  After some time, it will appear like a delay.


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 3 of 4
(2,616 Views)

Hey, thanks for responding! That was it! Makes a lot of sense and now I am having no problems. 


0 Kudos
Message 4 of 4
(2,574 Views)