Use LabVIEW to Program Arduino!

So apparently what I would consider to be an extremely highly valued item has appeared on the set of 3rd party tools for LabVIEW. Unfortunately, it is not fee, but there is a $99 version that I think DMS would be eligible for. The regular kit sells for $499.

I downloaded and installled the evaluation and discovered that the kit has all new functions specific for use on arduino. You cannot use traditional LabVIEW functions, but thats OK, this looks to me like a pretty nice set in the picture below. The boxes you see are the headers and lists of functions appear when you click a box. You can drop functions on the block diagram, like I have done in the left of the image file.

The big advantage to LabVIEW is the following: No syntax, no compiling, graphical format is intuitive to how many engineers think. So lets analyze my tiny program I wrote to the left of the function headers. The big box is a for loop. This for loop is configured to run 10 iterations. Upon each iteration of the loop the ‘i’ counter will step thru [0,9]. The two up/down arrow boxes work together to form a shift register. Upon i=0, 2 enters the register from outside. Then that same 2 is multiplied by 0 and 0 is stored in the upward pointing shift register half. The 0 works itsway up, back around to the down pointing register half, and reenters the loop upon i=1. That 1 gets multiplied by 1 (for i) and stored in the upward pointing shift register half, etc. etc. And finally, the output, after all loop iterations are complete, flows down the blue wire to the build array function, where I stopped coding for this sample. Easy, right?

If you get this, you can quickly whip up arduino code in this fashion and port it into device in seconds. I thought that was worth mentioning to the electronics enthusiasts around.

3 Likes

Is this an add on to Lab View? Is that what cost $99?

We have lab view installed on the electronics computer.

Robert Davidson

Yes it is a labview add on. It costs $499.

However, due to the fact that makerspace is non-profit, I believe DMS would be eligible to purchase and use the student/home version as the attached legalese allows non-profits to pay the lower prices for what is in most cases fully featured versions of the original (in other words its the same thing).

Also, take a look at the categories for the functions. Some of the cool ones I see are:

SPI, i2c, SDcard, Tones, RGB LED strip, serial, servo, etc.

According to website I was reading last night, changes to arduino can be implemented (as it is already connected and powered on) as easy as modify the block diagram (like you see in my post picture above), and press a button to have the arduino clearned and programmed for immediate testing. I want, i want…

It is the home/student version that is $99. And that is all we would need as I understand things.;

MatLab supports Arduino also:


http://playground.arduino.cc/Interfacing/Matlab

Ran across this some while back in NASA Tech Briefs.

The LabView addon looks interesting.

And to make things even more interesting, you can call your matlab from LabVIEW, and call LabVIEW from Matlab. Check it out:

So I read into the matlab docs, and it appears that you get the ability to control ports and such via matlab like SPI, i2c, PWM, sensors, etc. With Simulink you can develop algorithms to run on the Arduino processor.

As i understand things with the LabVIEW plugin, you can write code using the functions in the provided function selection panel (regular labview function panel no good). The screen shot I included earlier was my little piece of code I shared earlier that did the 10 iteration loop. It appears that needed functions to do full blown programming are included in the arduino functions. It reminds me a lot of early versions of LabVIEW, back when I learned in 1997. No event structures, no classes, wow I just noticed no clusters either. Well, the device is not that large, so I guess they opted to avoid wasting resources with frivolous things like beautiful code. Regardless, this is a full blown programming language option for arduino. But you had better have a big screen, because I just noticed there does not seem to be a way to do sub-vis either.

It may be nice to be able to throw something together quickly and easily, but I recommend that anyone interested in Arduino take advantage of the resources at DMS to learn to program them the traditional way. We have classes and people to answer questions.

When I am trying to get something done, I am usually looking for the quicker, easier method. But that’s just me.

While certainly I did not post this as a path to circumvent traditional programming methodologies for arduino, nor do I have interest in taking away from the classes being taught at Makerspace, which I am sure are wonderful, I am putting this out there so that all can see an additional alternative for getting a given users code down in an arduino device.

Perhaps something worth considering are classes in LabVIEW up at makerspace as well. Increasingly, I notice that LabVIEW is growing in popularity and range of targetable devices. Now you can program your arduino in LabVIEW, Rasberry Pi can be programmed with LabVIEW, and of course your PC or Apple devices can be programmed in this language as well. One language can cover most of the important platforms out there (even FPGAs). And it does so without requiring sytnax or compliling. Thats worth noticing IMO, and I don’t think it hurts anyone interested in programming to know this language as well.

Now that I think more about it, there is also the catch that using LabVIEW requires that you pay money to have the software, and it is licensed per seat usually (it changed through the years… now has runtime licenses). So if you want to rep out volumes of something, then yes I would agree that traditional programming methods are preferred.

Also, I’m not sure a LabVIEW generated application is what I would really want to distribute to a mass of customers. Its fine to dole out to your buddies on the team, or maybe deploy on a few test systems. It is a rapid prototype/test development/internal use sort of thing, and it can save considerable development time in these areas.

For mass distribution, text based languages are generally preferred. May take a bit longer, but the result is generally more polished and easier to distribute.

I would like to correct a statement I made about LabVIEW Arduino not supporting sub-vis. Yes you can use sub-vis in labview arduino, see this video:

I did not intend to denigrate using LabVIEW Arduino. If you are building your own hardware using simple discrete components, the LabVIEW approach may well be the quickest way to get up and running.

I was thinking that many projects use parts which come with sample code or libraries. The same with adapting code others have written for their projects. Chances are, it is for traditional development. If LabVIEW Arduino had broad device support or if it has a means to readily assimilate traditional code, then I need to take my own advice and learn LabVIEW while I have access to it at DMS.

I know that full blown labview can for sure integrate code from other soruces. There is a thing called the ‘code interface node’ that you use to specify the code module you need to run in unison with LV, and it has a breakout with inputs and outputs of various datatypes that one can use to wire their LV program to.

LabVIEW for Arduino uses its own special sets of commands/functions as items placed on the block diagram. I included a picture earlier that shows the pallet of all the headings under which the block diagram functions can be found. In other words, if you look at my picture, in the tool a programmer could click ‘array’ and a set of array block diagram objects would appear and are available for placing on block diagram. FYI, once placed, you can right click and select help to read a nice description of what the object does. LabVIEW programmers spent much time reading these help files. There may be some code interface options within this pallet, but I don’t know right now for 2 reasons.

OK, so let me clarify that there are two pallets of LabVIEW functions on my machine currently. One is regular LabVIEW for PC functions (I have been using these for almost 20 years). When I installed the arduino software, a new pallet appeared. I have never in my 20 years seen a new pallet, but thats what they did. So if I want to write an arduino program, I must use these functions from the Arduino pallet. I can ONLY use those functions, as were I to use one of the traditional functions, I suspect the program would not compile properly for targeting arduino. So all of the functions in the new arduino pallet are specifically formulated to work on arduino.

Back to the two reasons. You see, if I could, I would simply dig around in the arduino pallet I have and tell you if there is a code interface node. Alas, but I have not purchased the software, so my pallet no longer works. This is reason 1 why I cannot answer the code interface node question at the moment. And #2 is that even if the pallet did work and I could not find a code interface node, I would not be convinced that you could not use code from other environments due to the fact that I installed the student version because it has a fee evaluations which has since lapsed for me. So the full blown $500 commercial version I have never seen. The pallet in my earlier post to this thread is STUDENT VERSION. The commercial one is much cooler, I would wager, and I wonder what DMS could do to tout the non-profit status and maybe get us an extended eval or something. Then we would know for sure the beauties and downsides of working with arduino like this.