Get Informed out of Data

Full width home advertisement

Raspbian

DataScience

Post Page Advertisement [Top]

Using Raspberry Pi 4 as an instrument in LabVIEW

Using Raspberry Pi 4 as an instrument in LabVIEW

 To be honest, it will be a commercial shift between the hardware and Operating system, with OpenSource leading to only hardware prices.

Pretty much too similar to MATLAB, LabVIEW being centered around MAC and Windows, but with PLC's cost being higher and programming gets new dimensions, the combo of commercial value gets dropped.

Hence, LabVIEW starts support Maker boards like raspberry pi, Arduino for more IoT and analytics scope with their visual programming language.

For me, LabVIEW is very much similar to Node-Red but the use case made it look different, and also LabVIEW comes with powerful industrial support in terms of commercialization.

Also, LabVIEW is a product making stream with respect to scientific computing and Data Acquisition.

Over the years, LabVIEW being used as a design software that can use a raspberry pi as hardware, but we need a programming PC to combine the power.

In April 2020, a 64-bit Linux version of LabVIEW is announced but, ubuntu ports for ARM support still not yet supported.

still, we can do more hardware programming with both,

Let's get into using raspberry pi as the hardware inside LabVIEW,

You will be connecting to Raspberry pi using their IP address via SSH. This is still true if you connect the target directly to your computer, as it creates an ethernet connection over USB.

  • The latest versions of the Debian OS on the Raspberry Pi disables SSH as a security precaution. Please consult the getting started content for the Raspberry Pi to re-enable SSH before proceeding.

You will need the username and password of your pi, so please note these if you changed them from the defaults. Once you have the IP address of your target and SSH is enabled.

Before connecting from LabVIEW, in Raspbian OS, we need to install LINX

Install LINX

sudo sh -c 'echo "deb [trusted=yes] http://feeds.labviewmakerhub.com/debian/ binary/" >> /etc/apt/sources.list'

sudo apt-get update

sudo apt-get install -y lvrt20-schroot

 

# Move the nisysserver.service and labview.service files to the systemctl folder

sudo mv /etc/systemd/system/multi-user.target.wants/nisysserver.service /lib/systemd/system

sudo mv /etc/systemd/system/multi-user.target.wants/labview.service /lib/systemd/system

# link liblinxdevice.so to the Raspberry PI device driver file liblinxdevice_rpi2.so

sudo schroot -c labview -d /usr/lib -- ln -s liblinxdevice_rpi2.so liblinxdevice.so

# Enable the nisysserver.service and labview.service to start on boot

sudo systemctl enable nisysserver.service

sudo systemctl enable labview.service

# Start the nisysserver.service and labview.service

sudo systemctl start nisysserver.service

sudo systemctl start labview.service

Configure the Raspberry Pi 4 for Use with LabVIEW

  • Screen Shot 2019-11-26 at 7.47.03 AMLaunch LabVIEW 2020
  • Create a New Project
  • Open the Target Configuration Wizard from Tools >> MakerHub >> LINX >> LINX Target Configuration Wizard
  • Select the type of target from the drop-down
  • Enter the IP address, username and password of your target and click ‘Connect’
  • On the Installation Tab, install the run-time dependencies. Note that these will be downloaded from an online repository, so ensure you have an internet connection.

Note: The package that gets installed includes the LV runtime, the .so files that allow LV to perform I/O, and the chroot configuration that lets LV run on a hard-float target. Craig and Ken know the details, but this includes a refasonable number of directory links to let your LV program access the linux file system and services. The files are mostly located in the /srv/chroot/labview. 

Once the installation of the run-times is completed, your target should be ready for use. You can click the button to Open the Examples or return to your empty project.

Create Your Project

Perhaps the easiest way to do this is to open the shipping example that is linked to pi,

 Configuration Page. If you prefer to start from scratch, do the following:

  1. Right-click on the project item and select New >> Targets and DevicesScreen Shot 2019-11-26 at 7.46.01 AM
  2. Add your target (two options)
    1. Option 1: Expand the LINX category to auto-discover your device on a local network
    2. Option 2: Manually select your device type by selecting the ‘New Target or Device Option.’ If you’ve manually added the target, you will need to specify the IP address by right-clicking on the target in the project and selecting ‘Properties’
  3. Connect to your target. Right-click on the project item and select ‘Connect’
  4. Save your project

Your target is now connected and ready for programming

Development

This will feel very familiar to any experienced LabVIEW programmer. Create your top-level VI and develop the code that you wish to run on the target. To interact with the device and any peripherals, you will use the API that is installed in this location:

Screen Shot 2019-11-26 at 7.45.11 AM

The API uses a standard configure >> read/write >> close method that should feel familiar to DAQ programmers. You will need to consult the pin map of your device, which is linked to from within LabVIEW, here:

Help >> MakerHub >> LINX >> Pinout

You can execute your code at any time on the target by clicking the run button of your VI. This will download any changes to the target and begin execution. Normal probes and breakpoints can be used to interactively control execution and debug your application.


No comments:

Post a Comment

Bottom Ad [Post Page]