Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview connection - Rasberry pi

Solved!
Go to solution

Dear
I annoy you to ask if it is possible to connect Labview to a Raspberry pi that is outside my local network.
If it can be done and someone knows how to do it, I would really appreciate if you share it.

Greetings

0 Kudos
Message 1 of 20
(954 Views)

Hello,

 

I believe you could buy an fixed IP address from your ISP.

 

Are you trying to program the raspberry or just accessing the vi from a PC?

 

Maybe you could also configure an ddns on the raspberrypi router (never done this).

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
0 Kudos
Message 2 of 20
(936 Views)

It’s of course doable but the details are entirely independent of LabVIEW. You need to configure the Rasberry PI in a way that it’s IP address is visible to the computer on which you run LabVIEW and depending what your program does potentially vice versa. This is about proper network setup of the Raspberry Pi and since it is based on Linux you can use most techniques that are used on Linux too.

 

But there don’t exist point and click ready solutions to do it. And there doesn’t exist one single solution either. In true Unix/Linux tradition there are many different options, and which one will work for you depends on your specific situation, network setup, interned or cloud service provider. As such even if there exist youtobe tutorials (which I’m sure there are myriads, but often of questionable quality) it will often not work for you or never really worked for the creator of the video either.

You will need to be able to read books about some network configuration basics and learn to get your hands dirty by editing and creating shell scripts and Linux startup scripts. It should not be rocket science unless your network setup is exotic but it sure feels like rocket science if you haven’t written Linux shell scripts before and a good basic understanding about how the IP protocol suite works under the hood.

 

Basically it comes down to getting a simple “ping <numeric IP address of your Raspberry Pi> from your host computer to succeed 100% And don’t use the host name of the Raspberry Pi in your LabVIEW project unless you manage to setup a reliable DNS record for it. But I doubt you work as network guru at a IPS so save yourself the hassle of trying to get this work. Instead use the numeric IP address in the LabVIEW project. And yes don’t expect the LabVIEW project to magically find your Raspberry Pi.It simply can’t! You need to know the public IP address of your Raspberry Pi and enter it manually in the project settings.

Rolf Kalbermatter
Averna BV
0 Kudos
Message 3 of 20
(930 Views)

@rolfk wrote:

It’s of course doable but the details are entirely independent of LabVIEW. You need to configure the Rasberry PI in a way that it’s IP address is visible to the computer on which you run LabVIEW and depending what your program does potentially vice versa. This is about proper network setup of the Raspberry Pi and since it is based on Linux you can use most techniques that are used on Linux too.


I second this statement, it is completely independent of LabVIEW and requires that your programming computer can communicate with the Raspberry Pi as though it is on the same network.

 

I recently did with for a PLC where I wanted to use my programming PC to connect to a remote device which was at a customer.  I actually proved out my concept by using using a Raspberry Pi to make sure I got the network configuration correct.

 

The method that I used was to establish a VPN connection between my programming PC network and the remote device's network.  If there is not IT VPN solution in place to connect the 2 networks, you can use something like TeamViewer, with as point-to-point VPN capabilities.  For the TeamViewer solution you need to use a PC at the remote location as as you access point, this is where you will establish the point-to-point VPN connection, and you need to configure the Raspberry Pi to use the PC IP address as its Gateway Address.  Then you create a route, on your programming PC, to the remote device.  Here is the commend you can enter into the Windows Command Prompt, just replace the <> with the correct IP addresses.

 

route add <IP of remote device> mask 255.255.255.255 <IP of Partner for TeamViewer VPN> metric 1

 

Note:  You can route to more then a single IP address by changing the mask.

 

The route added to your programming PC tells it how to communicate to the remote device and setting the remote device's Gateway Address to the remote PC's IP allows for the communication from the remote device to make it back to your programming PC.

 

I am not sure if this will work in your situation but if it does and you have any issues getting this to work with the TeamViewer VPN let me know and I can provide more details.  The first thing to confirm is that you can Ping the remote device from your programming PC.  I have not specifically tried to then program the Raspberry Pi in this way but it works with the PLC so I don't see why it would not work with a Raspberry Pi and LabVIEW.

David Wilt
The New Standard LLC
0 Kudos
Message 4 of 20
(918 Views)

Dear, thanks for the prompt and interesting answers.
I will quickly get to work trying to make a remote connection with my Rasberry pi and Labview.
Soon, I hope, I will tell you how it went with this.

Total thanks.

0 Kudos
Message 5 of 20
(887 Views)

I have used RealVNC server for this purpose with great success.  Of course, you need to set up an account with them, but it is easy and painless.  Here's a link to get you started - RasPi and RealVNC  

regards,
Bill
0 Kudos
Message 6 of 20
(581 Views)

Hi Bill, thanks for the suggestion.
I ask you, have you really loaded code to leave the Rpi running as headless? Connecting to Rpi remotely with RVNC?

Greetings

0 Kudos
Message 7 of 20
(563 Views)

Yes, see image.headless raspi via realVNC.png

regards,
Bill
0 Kudos
Message 8 of 20
(556 Views)

Bill,

 

Manually coping the rtexe over to update your code?  If so, I did not realize this was possible.

 

Thank You,

David Wilt
The New Standard LLC
0 Kudos
Message 9 of 20
(553 Views)

Dave,

Once the code has been sent to the machine via LabVIEW project in the normal manner, you can "cut and paste" if you want, the updated code into the directory shown.  You do have to open a terminal window and verify that the properties are correct if you do this.   I don't recommend it, but it is doable once the code has been placed the first time via Project method.  

 

I just placed the image into my response because it sounded to me like user Choke wasn't sure it could be done. 

 

We can discuss this further tomorrow at the NOCLUG meeting.  (shameless plug for our user group meeting). 😉

regards,
Bill
0 Kudos
Message 10 of 20
(548 Views)