Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

using Raspberry or Arduino running labview to connect to a wifi network

Solved!
Go to solution

Hi,

 

i would like to deploy a labview executable on a raspberry or arduino hardware. the application should:

1) connect to a wifi network and exchange data over it through TCP/IP protocol

2) connect to a compact rio (model 9067) via ethernet connection and exchange data through shared variables (or network stream or TCP/IP)

 

can someone answer to:

 

1) can raspberry run a labview application that manages the wifi network connection (search, open and close connection)? in my windows 10 OS with Labview i can do that by using system exec.vi, but i don't know if raspberry also does

2) can raspberry/arduino read Labview Shared Variables of a library in compact Rio? or can they pass data over ethernet connection with compact Rio?

 

Thanks for the replay

 

Michele

 

 

 

0 Kudos
Message 1 of 6
(298 Views)

Your description is confusing.

 

What you want to do only works on Raspberry Pi (and Beaglebone Black). Arduino can not be used to deploy LabVIEW code to.

 

1) The LabVIEW environment on the Raspberry Pi is running in a Linux Debian environment. It can do quite a lot but not everything since the LabVIEW portion runs inside the Debian installation in a chroot on the Raspbian (chroot is a sort virtual engine that allows to run its own OS with selected parts of the host OS being available to the guest OS, but everything else is securely shielded from the guest OS and not accessible. This also includes the network settings and generally all hardware configuration, so generally executing command line tools to change settings in the host Raspbian environment is not really possible). But there is a possibility to actually reach from the chroot environment to the Raspbian environment through SSH, so with tools like putty you can do such things and SystemExec certainly can call putty. Nevertheless this is going to be quite involved and very likely quite a bit above your comfort level.

 

An application should generally not need to configure the network in order to be able to do network communication. That should be handled separately by configuring the network correctly in the OS.

 

2) I'm not sure if NI ported the shared variable engine to the standard Linux environment in the meantime. Originally they only supported it for their NI Linux RT targets, but the Linux environment used on the Raspberry Pi through the Linx target support is a normal Debian Linux distribution compiled by NI for this use, not the NI Linux RT OS. On normal desktop Linux they only supported in the past tthe Datasocket API, but not the Shared variable engine PSP system. https://www.ni.com/nl-nl/support/documentation/supplemental/06/using-the-labview-shared-variable.htm... So it may be possible now, but even if it would be, getting it all setup correctly on non Windows systems has always been a pretty complicated process.

Rolf Kalbermatter
Averna BV
0 Kudos
Message 2 of 6
(290 Views)

I am not sure what you specifically mean by managing the WIFI network.  It seems to me you just need the Raspberry Pi on the same network as the CompactRIO.  You configure the Raspberry Pi's WIFI connection from the Raspberry Pi's OS.  This has nothing to do with LabVIEW.  By using System Exec.vi you are just interacting with the Windows OS.  On the Raspberry Pi you will need to interaction with the Raspberry Pi's OS.  You can use the same System Exec.vi do do this on the Raspberry Pi.

 

 RPi System Exec.jpg

 

As @rolfk already stated, you will have to use ssh do to where LabVIEW is running on the Raspberry Pi.  In order to get this all to work you will need Chroot SSH trick and probably Run ‘sudo’ Command Without Entering a Password in Linux.

 

I have not used used Shared Variables with the Raspberry Pi but I have ran WebSockets on it so you will be able to exchange data over some form of TCP/IP connection.

David Wilt
The New Standard LLC
0 Kudos
Message 3 of 6
(276 Views)

Thanks @Rolf and @David

 

my description is confusing because it is the first time that i approach myself to Raspberry. I try to explain better my problem. i have a third device that can generate a wifi network (the name of the network depends on the device, so i need to "manage" the wifi network connection, i have to search, connect and then close it). this device stays in access point mode, i know the name of the wifi network ad the IP (static) of the device. i would like to set up a system in which:

 

1) my cRIO sends to raspberry (i would to use Raspberry Pi 4) the name of the network of the device (this should be easy..the raspberry and the compact rio will be connected by ethernet network cable and they will be over the same network)

 

2) then the labview executable running on raspberry has to search and connect to the wifi network, has to exchange data over it (this should also be simple (i hope) when the connection will be established) and finally has to close the connection and returns data to cRIO

 

now, i hope i have clarified why i would manage the network connection on the raspberry OS through labview. Do you see some critical issue on the system i want to set up?  Do you know where i can find documentations/links about raspberry command line to "manage" network connection through Labview System Exec.vi?

 

Best regards

 

Michele

 

 

0 Kudos
Message 4 of 6
(239 Views)

Well Raspbian is basically Linux too, so you can find that all over the internet. The art is to find the useful information in all the crap out there that is half or totally wrong informed and what I can't use at all are youtobe videos that usually only show that it can be done but not exactly how, respectively the screen being way too small to be able to see what they type in the console.

 

Basically there is almost nothing that can't be done in Linux, the difficulty is to find out which script you need to change, and which command line commands you need to issue.

 

An extra difficulty will be that this needs to be done on the Raspbian host OS as it manages the network resources. The LabVIEW Debian Linux guest OS in which the LabVIEW process runs is only a user of that network and can't make real changes to the network infrastructure of the host. Here you will need to use the chroot SSH trick that David mentions to call out from the LabVIEW guest environment to the Raspbian host environment and make the changes there.

Rolf Kalbermatter
Averna BV
Message 5 of 6
(233 Views)
Solution
Accepted by topic author Michele_Bardani

I am a Linux novice myself but it sounds like everything you want to do should be possible.  If you need to actively connect and disconnect from a WIFI network I would start there to figure out your problem.  There are many examples on how to setup a WIFI connection via command line so I believe you should be able to find everything you need.

 

I would first start working with the Raspberry Pi without worrying about LabVIEW.  I would start with an image with has a Desktop and then use VNC to access the Raspberry Pi Desktop.  From there you you should be able to use the network configuration utilities to connect and disconnect from a WIFI network.  Make sure it works from here with your device.  Then I would try to achieve the same thing from a command line terminal directly on the Raspberry Pi.  Since you have the Desktop you would be able to watch your commands work as it connects and disconnects from the WIFI network.  Once you know how to do what you want to do via command line then I would finally work on doing the same thing from LabVIEW.

 

If you have issues getting it to work from LabVIEW after you know the commands then come back here and let us know your specific issue.

David Wilt
The New Standard LLC
Message 6 of 6
(225 Views)