LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW and Arduino Uno

So I've found that LabVIEW is reading my data from the Arduino, but I'm not sure what's going wrong after that. Here's an image of my VI.snip1.PNG

 

Now, when I open up the "Arduino Init" block (seen on the left in the above picture) I get the following:

Snip2.PNG

Note that this is only the right side of "Arduino Init". When I open the Arduino send/receive I get this:

Send_Receive_LabVIEW.PNG

Notice how in the "Read Buffer" you can see "x: 320". This x value is the same as the acceleration given out by the Arduino. Now when I click the run button, it reads the acceleration value, displays it in "Read Buffer" and then the program stops, when I click run again it provides the y acceleration value, and when I click run again it provides the z acceleration, and this keeps repeating. 

 

But I can't seem to graph what's coming out of send/receive. The graphs keep showing 0's or sometimes the graph time axis doesn't even begin to move. Could this possibly be because its reading "x:320"? Do I need to change it to just read the number, in this case "320"?

0 Kudos
Message 11 of 19
(3,211 Views)
I don't understand what you are doing. I can't bow the VI right now and the other images don't show your VISA Read. Since you are sending a termination character, the configure serial port should have this enabled and you would set the number of bytes to read to some high number (i.e. 100). Setting out to 8 means incomplete reasons as you mention. When you get complete string, you can use the Scan From String to get the numeric values.
0 Kudos
Message 12 of 19
(3,186 Views)

"Since you are sending a termination charcter, the configure serial port should have this enabled." 

 

Could you eleborate on this? I have no idea how to enable this on the configure serial port.

 

I understand what you are saying about the bytes though, it makes much more sense now.

0 Kudos
Message 13 of 19
(3,179 Views)
There is an input to the VISA Configure Serial Port to enable/disable the termination character for a read. Really obvious as long as you have Context Help turned on. You simply wire a Boolean true to it to enable the termination character that you specify with the same function. What it means is that the read will automatically terminate when the character is detected. You just have to make sure the number of characters to read is higher than what you would expect.
0 Kudos
Message 14 of 19
(3,167 Views)

Snip3.PNG

So I was looking at all the components on my block diagram with "Context Help" on and I found that the Context Help for the "I2C init" block says "Arduino Uno Analog Pin 4 - SDA (data line)" and "Arduino Uno Analog Pin 5 -SCL (clock line)". I'm using the SDA and SCL pins, but I'm using the digital ones. I included a picture of the Arduino Uno below, I'm using "(I2C) SCL" and "(I2C) SDA" (top left of the board) NOT the analog  "(I2C) SCL" -- (A5) and "(I2C) SDA" -- (A4). Do I need to use a different "I2C Init" or is using this one okay?

ArduinoUno.png

 

Message 15 of 19
(3,162 Views)

First you need to be clear what code you are runing on the Arduino. Is it your own code that you have shown or is it the LIFA code?

0 Kudos
Message 16 of 19
(3,083 Views)

Thank you for replying, but it's been too problematic trying to interface the Arduino Uno and LabVIEW. I'm just going to try to use a different program such as Matlab.

0 Kudos
Message 17 of 19
(3,066 Views)

What makes you think that you can do better with Matlab, a program for calculations? 

Message 18 of 19
(3,058 Views)

I'm going to actually try it out later and I'll let you know if it works. But here's the link I found, it's only a few lines of code to get the data from Arduino into Matlab:

 

http://allaboutee.com/2011/07/04/how-to-send-data-from-the-arduino-to-matlab/

 

 

I tried making LabVIEW work with the Arduino for hours and I just could not get it to work so I figured Matlab was at least worth a shot.

0 Kudos
Message 19 of 19
(3,036 Views)