LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying two signals using LabVIEW from Arduino board

Solved!
Go to solution

Hi, I'm currently working on a LabVIEW program that requires me to display two signals measured by two rotation speed sensors which sense the rotational speed of two wheels. I want these two signals displayed in one chart so that both signals will be easier to compare during a run test. These sensors have the same type/model that connected to an Arduino board. I use VISA resource name to connect the Arduino board to LabVIEW via COM port. I designed the block diagram as attached.  However, I'm facing problems that the two signals on displaying chart show weird. it looks both signals are shifted to each other. Any advice? 

Download All
0 Kudos
Message 1 of 23
(2,959 Views)
Solution
Accepted by hasan1612

First,  DON'T USE BYTES AT PORT!  It is the wrong thing to use 99% of the time.

 

What does the data string look like coming from the Arduino?  If it is something with both values and ends with a termination character, you should set up your VISA Configure to rely on that.  Just read a number of bytes larger than your longest message.  Write now you are getting whatever is in the port, and it might be a short message.  It probably only contains one of the values and not the other, so you wind up getting a zero out of the parsing of the string for whichever value you didn't get.

 

If your message was sent as H:###,R:#### <CR>  (carriage return) then use a scan from string with a format of H:%d,R:%d<CR> and you'll get both values with one function rather than the 4 you have there now!

Message 2 of 23
(2,918 Views)

Solved!! Thank you very much for your advice. Smiley Happy

0 Kudos
Message 3 of 23
(2,890 Views)

You could also consider putting the plotting of the data into a case structure and wire the selector to the error terminal.  On No Error, the data plots.  Do nothing in the Error case.  That way a random VISA error or parsing error doesn't cause zeroes in your data.

Message 4 of 23
(2,881 Views)

It looks better design. Thanks alot for the advice. Smiley Happy

0 Kudos
Message 5 of 23
(2,867 Views)

hasan i got the same problem like you but in my case the graph values coming too slow. Might be Labview donot acquire the change which is coming from the Arduino.

 

Please help me. 

Maaz

 

Check my video you might know then my point

 

https://www.youtube.com/watch?v=PNBun-Pmrjo&feature=youtu.be

 

0 Kudos
Message 6 of 23
(2,828 Views)

Please tell me what you change in VI. Please share the VI after the alternation. I really want to look into it. 


@hasan1612 wrote:

Solved!! Thank you very much for your advice. Smiley Happy


 

Thanks 

 

Maaz

0 Kudos
Message 7 of 23
(2,811 Views)

Hi Maaz,

To be honest, I haven't been skillful on Labview yet. But based on my experience, you need to set up the time elapse of the output data/signal in Arduino code which is sent to Labview (time delay, millis, etc), or you can use the timer in Labview and set an appropriate time constant (as shown in attached fig). The data will be displayed depending on data sending freq and display setting time.  

0 Kudos
Message 8 of 23
(2,810 Views)

In my case, I didn't use time setting in my lab view, but I let the data displays in LabView due to data sending freq from Arduino by setting millis value (since I wrote the code for rotation sensor). 

You may take a look at mine here: 

https://youtu.be/yEzcP8U2Nz8

https://youtu.be/kuBCcNRFj3w

0 Kudos
Message 9 of 23
(2,806 Views)

@hasan1612 wrote:

Hi Maaz,

To be honest, I haven't been skillful on Labview yet. But based on my experience, you need to set up the time elapse of the output data/signal in Arduino code which is sent to Labview (time delay, millis, etc), or you can use the timer in Labview and set an appropriate time constant (as shown in attached fig). The data will be displayed depending on data sending freq and display setting time.  


Hey Hasan, 

I m also beginner like you. Not know much about Labview. 

I get the correct reading for example i set voltage now 27 Volts on power supply but i cannot see the current here 😞 Current is in blue. Please tell me what should i do in order too see both simulatenously i just change a little by seeing your VI. Implemented but i cannot see the other graph ;(

0 Kudos
Message 10 of 23
(2,802 Views)