10-27-2016 12:03 PM - edited 10-27-2016 12:12 PM
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.
Solved! Go to Solution.
10-28-2016 01:44 AM
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.
10-28-2016 07:23 AM
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.
10-31-2016 08:42 AM
Hey, thanks for responding! That was it! Makes a lot of sense and now I am having no problems.