LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino Uno, LabVIEW, Real-Time?

Hello community,

I purchased an Arduino UNO along with DC Motor perpherals (MotoMama for example) for a project, as well as installed the appropriate drivers and interface for the Arduino - I am now waiting for my order.  I have come to a realization that this project is very time critical and I would like to know how "real-time" a system like this would be.

Are there tools in which I can validate how much processing each VI is handling in real-time and perhaps determine delays.  It looks like that the Arduino is being used as a hardware interface and the computer running LabVIEW is doing the processing.  Unlike (say CodeVision AVG) that allows the user to compile the code into the ATMEL chip - using that software, it allows you to step through each line of code and determine how much time it takes.  Are there tools like this in LabVIEW?

Ultimately, I prefer a real-time processing power +50 KHz, how can I test this to insure that the system is acting accordingly.

Dan

0 Kudos
Message 1 of 13
(12,989 Views)

I'm not all that familiar with RT systems but regarding Arduino, you need to realize that the the serial communication is likely your slowest part so you can't ever get faster than the serial communication will allow.  So, everytime you use a LIFA VI it has to send a message to Arduino and wait for it to send a response.

Arduino in the context of LIFA is a nifty break out board with some special features.

Regarding getting execution time, I believe you can get some information regarding performance under the tools menu's "Profile" submenu.

0 Kudos
Message 2 of 13
(5,504 Views)

If you need a fast sampling rate for a close loop system you should do all of the processing on an Arduinoo board and just use Labview as a graphical interface for supervisory control.

hrh1818

0 Kudos
Message 3 of 13
(5,504 Views)

Hello hrh1818

Correct me if I am wrong, but I have to use the LIFA firmware onto the Arduino.  Is it possible to add in my own code and give it processing instructions whilst keeping the LIFA?  Essentially custom programming and LabVIEW interfacing?

Dan

0 Kudos
Message 4 of 13
(5,504 Views)

Hello Dan,

Yes, it is possible. Presently I am trying to do such a thing. So far I figured out how the Arduino code works and how it is interfaced to the LabVIEW. You can trace how the commands are send by looking into the premade Arduino interface blocks. At the lowest level most of them are just VISA read/write commands so it should be possible to even create your own functions in the Arduino code and call them from your custom made LabVIEW blocks.

Regards,

Wojciech

0 Kudos
Message 5 of 13
(5,504 Views)

What my project entails is a 3DOF master/slave controller using DC motors.  I recieve position/direction from 3 encoders (quadrature) from the master and slave (12 pins say 300Hz), PWM for 3 DC motors (+6 pins (3KHz closed loop control) and VCC and GRND (2 pins).  Looks like the UNO can do this (correct me if I am wrong) in RT or near to it.  Above are my parameters I would like to reach.

Your thoughts?

Dan

0 Kudos
Message 6 of 13
(5,504 Views)

The Uno doesn't have enough digital pins to do what you described. The Uno only has 14 digital pins and 2 pins must be reserved for serial communication with Labview.  You will need to use an Arduino Mega to get enough digital pins. 

hrh1818

0 Kudos
Message 7 of 13
(5,504 Views)

Upon further review I question your statement abut the encoders needing 12 pins.  Actually each encoder uses 2 digital pins.  Hence for 3 encoders you need 6 digital pins.  Each H bridge motor driver requires 2 digital pins.  Hence for 3 DC motors you need 6 digital pins.   Therefor a total of 12 digital pins are required and from a digital pin viewpoint an Ardyuino uno could be used.

However, from the viewpoint of interrupts and best perforfmance an Arduino Mega must be used.   See the following web page for more informnation.

<http://www.pjrc.com/teensy/td_libs_Encoder.html>

Notice the comments about best, good, and low performance and the table showing the number of interrupts.

heh1818

0 Kudos
Message 8 of 13
(5,504 Views)

hrh1818 wrote:

Upon further review I question your statement abut the encoders needing 12 pins.  Actually each encoder uses 2 digital pins.  Hence for 3 encoders you need 6 digital pins.  Each H bridge motor driver requires 2 digital pins.  Hence for 3 DC motors you need 6 digital pins.   Therefor a total of 12 digital pins are required and from a digital pin viewpoint an Ardyuino uno could be used.

However, from the viewpoint of interrupts and best perforfmance an Arduino Mega must be used.   See the following web page for more informnation.

<http://www.pjrc.com/teensy/td_libs_Encoder.html>

Notice the comments about best, good, and low performance and the table showing the number of interrupts.

heh1818

That's exactly what I was gonna say .

0 Kudos
Message 9 of 13
(5,504 Views)

Thanks for the response, it seems the UNO can be used for this application. I will have to go over and make sure I have enough pins again.

Regarding performance, this is not performing like an embedded system - rather a hardware interface.  With the speeds I mentioned for sampling and outputing rates, would the Arduino + LV reach anywhere near RT?  I will be validating the UNO as before going the Mega (since I already perchased everything). I love the versatility of LV but I want be as close to an embedded RT system as possible.

For digital reads ~300-500Hz (3 encoders)

PWM outputs ~3Khz (3 DC motors)

Also, would developing Arduino code to perform sampling and outputing as functions and then using LIFA to call those functions within LV a possibility? Where can I read up on these inquries.

Thoughts and thanks.

Dan

0 Kudos
Message 10 of 13
(5,504 Views)