Generally, I prefer to do tutorials about open hardware and software, but this one is different. The number of people using LabView and Arduino is so big that it starts to be interesting being able to use both together.
So, do you remember our last post about Arduino?
Today we are going to repeat it but with Labview
communicating with the Arduino UNO board.
0 Step. You have a copy of Labview 2013 or newer version installed.
1 Step. Install Arduino Toolkit in Labview. To do that, we can simply follow the indications from National Instruments listed here.
2 Step. Install VI Package Manager (VIPM) from it’s webpage. Simply follow the installing default steps. This software will help you manage different toolkits for LabView.
3 Step. Run VIPM. Since it is the first time, it will take a while to detect all the packages from Internet. Once it is finished, look for the LabView to Arduino and click Install.
simply follow the steps and it will be installed without any problem.
4 Step. Connect your Arduino to the USB port. If you don’t have it yet, at this point you need to have installed the Arduino IDE and drivers.
5 Step. Upload into the Arduino board the new firmware that will allow it to communicate with LabView. (NI tutorial here). The file you need to load into the Arduino will be in a folder created when you installed the Arduino-LabView toolbox. Open and browse to LIFA_Base.ino found in C:\Program Files\National Instruments\LabVIEW 201x\vi.lib\LabVIEW Interface for Arduino\Firmware\LIFA_Base
Make sure you select the UNO board and the correct COM port.
Now the Arduino is ready to comunicate with LabView and Labview has the palette with VIs to send and read instruction from the Arduino. Let’s do something.
5 Step. Start LabView and open a new VI.
You will notice now that in the block diagram view, there is an Arduino palette.
6 Step. Drag and drop Init and Close. This will be necessary to initialize the communication and VERY IMPORTANT to close the port once we finish using it.
7 Step. Add a constant for the “Bits Per Packet” input of the Init (Right click Create>Constant), and add controls for the rest of them (Right click Create>Constant). Remember to arrange them in the Front Panel.
8 Step. Now create a while loop (Remember to create a buttom to stop the loop). This loop will run continuously taking values from the Arduino. (I also placed an indicator on the Error Output of the Close VI).
Inside the loop we put the Low Level “Analog Read Pin” and a waveform chart. Edit the properties of the waveform as you prefer. In my case, I remove the autosizing of both x and y axis.
9 Step. You might notice the constant “0” attached to the read VI, it indicates we are using pin A0. Next step is to connect something into the pin A0 that generates a voltage. In our case we can use the photodiode from the last tutorial (one pin to A0 another one to GND).
10 Step. Now everything is ready to run. Make sure you select the correct board, the baudrate and the correct COM port (you can check in the Arduino IDE if you don’t know the port). And Voilá!