ni.com checkout is currently experiencing issues.

Support teams are actively working on the resolution.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically plotting data in mixed signal graph

Hi, 

I am working on a project where I receive a string of numbers continuously from Arduino and then converting the string into a 2D array of x columns (x different data) and n number of rows which gets updated continuously as long as I run the program. It's basically output from x number of sensors. 

However, the type and number of sensors are not fixed. For example, I might be reading data from a single temperature sensor or 2 humidity sensor at a given instance. hence, I would like my LabVIEW program to recognize this and dynamically change the UI (Graph, Numerical Indicators).

To recognize the type of sensor, I am reading the device ID of the sensor, comparing it with a constant number and then printing whether it is a temperature or humidity sensor. For the number of sensors, I am reading the array size and determining the number of sensors from number of columns. 

The problem arises when I try to plot the graph. Please have a look at the attached screenshots.

When i read one sensor, i want the graph to plot value from one sensor. when, i read 2 sensors, i want the graph to dynamically plot values of 2 sensors. However, i'm not able to do it. 

 

If I am missing any basic logic behind it, please bear with me. I am beginner with LabVIEW. 

Can anyone help me with this?

Thanks in advance. 

 

Regards,

VigViv

Download All
0 Kudos
Message 1 of 7
(1,171 Views)

Hi,

 

Can you send your VIs? You told that you are receiving data from the Arduino, but I can't see how you do that.

Also I will be thankful if you can describe the logic of VI (for example using the comments).

 

Thank you in advance.

0 Kudos
Message 2 of 7
(1,147 Views)

Hi VigViv,

 


@VigViv wrote:

The problem arises when I try to plot the graph. Please have a look at the attached screenshots.


We still cannot debug images using LabVIEW.

When you need real help then you should attach your VI.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 7
(1,144 Views)

Hi hovo90, 

Apologies for the late reply. Arduino sends data to PC through serial port and I am using NI VISA to read this data from serial port. My block diagram is messy as i have not yet decided on certain algorithms yet. I am still working on them. once I am done with it, i will clean it and put labels.  

and yes, i will attach the program below. 

 

regards,

VigViv 

0 Kudos
Message 4 of 7
(1,110 Views)

Hi GerdW,

 

Apologies for the late reply. I think I found the solution. however, I am attaching a sample program and open to other ideas / solutions if it makes my life easier. Should i use case structure to dynamically add more array splitters? I need to split the 2D array as many times the number of columns in it. and then i need to plot a graph with n-1 columns. (1st column indicates the sensor type and doesn't needed to plotted. 

 

regards,

VigViv

0 Kudos
Message 5 of 7
(1,103 Views)

Hi VigViv,

 


@VigViv wrote:
Should i use case structure to dynamically add more array splitters? I need to split the 2D array as many times the number of columns in it. and then i need to plot a graph with n-1 columns. (1st column indicates the sensor type and doesn't needed to plotted. 

Using a case structure to handle an unknown number of entries is nonsense: use a loop to handle more than one array element!

 

In the snippet I used a Map to store your unknown number of sensor data (ID+value) entries:

It's the first time I used a Map ever - so check for errors on your own!

But the basic principle stays the same: each sensorID makes a new map entry, where you add the new data value (aka sample) to the array. Then you can read all map elements to create plots using a loop…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(1,096 Views)

Hi GerdW,

 

Thanks for your reply. I'll look into it.

 

regards,

VigViv

0 Kudos
Message 7 of 7
(1,087 Views)