LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems communicating with ethernet device

Hi everyone, I'm a noob to LabVIEW and I'd like some help~

 

The GPIO device https://numato.com/docs/32-channel-ethernet-gpio-module-with-analog-inputs/  I'm using is only configurable over Ethernet. In order to configure it I will have to log in to the TCP/IP connection. I could control the I/Os with Hyper Terminal. Now I want to control it with LabVIEW but I don't know how to log in wirelessly within LabVIEW.

I know this is pretty dumb but how can I enter username and password after reading? 

0 Kudos
Message 1 of 10
(1,687 Views)

According to the manual for your Device (thank you for providing the link!), this is really a "Serial" device that can communicate either over an Ethernet port (using a Serial Communication over Ethernet program such as PuTTY) or as a Serial Port over the USB connection.

 

LabVIEW knows how to do Serial Communication with VISA, and you can communicate to a Serial Device (which is what you really have) either through USB or through TCP/IP.  Here's what I'd suggest you try:

  1. Plug your device into your PC.  I recommend that you connect both via USB and via Ethernet.  Note that you cannot plug your device directly into your PC with an "ordinary" Ethernet Cable -- you need to use a "Cross-over" cable, or, better, plug the device in the same Network as your PC.
    • The easiest way to do the latter is if you have a router, say to connect to WiFi, and it has Ethernet ports as well, plug into an Ethernet Port, and plug your PC into another Ethernet port.
  2. Open MAX.
  3. Look at Devices and Interfaces.  What you hope to find is your device, possibly showing up as a VISA device, a USB device, and/or a "Network" device.  If you don't find it, or don't understand what MAX is showing you, expand all of the entries in Devices and Interfaces and reply with a picture of what MAX is showing you.
  4. Once you find your (VISA) Device, try to open a Test Panel and configure VISA for serial communication using the same settings for Baud Rate and other features that you used when you used PuTTY.

LabVIEW includes VISA functions to do just what MAX lets you do.  They can be found on the Instrument I/O Palette on the Block Diagram (under VISA, of course).

 

Bob Schor

Message 2 of 10
(1,665 Views)

Thank you so much for responding Bob!

 

My goal is to make a GUI on LabVIEW for I/O control over ethernet. My Laptop and my device are using the same Ethernet network but my laptop will not connect to the device (but for testing purposes I can connect with a USB). Will this still be considered Serial? 

 

Actually, I have done all these steps yesterday. Unfortunately when I was at step 3, Max didn't show me anything so I added the TCP/IP resource manually, which it worked because there isn't a cross(x) next to it. That is a good-to-go sign right?

 

What VISA or TCP functions/commands will I need for this device if I want to control it with Ethernet?

The pics I posted earlier were the ones using TCP, but I am still struggling with what functions I should be using, and the entire Host&Client thing with TCP.

Please help.

0 Kudos
Message 3 of 10
(1,654 Views)

The MAX screen shows it all!  You are, indeed, using "VISA over TCP/IP".

 

I noticed that you "blocked out" the IP Address on your Front Panel -- you didn't need to do that, because it is part of the 192.168.x.x "non-routable" IP addresses used by most WiFi Routers. "Non-routable" basically means that it basically defines a "Private Network", one that involves your Router and anything/everything connected to it (like your GPIO cards).  If I wanted to "hack in" to your (I presume "home") Network, I'd have to connect to the only "listener", your Router, and (of course) you have configured your Router to use WPA2 security, right?

 

Notice the entry under Network Devices that says "TCPIO::192.168.10.189" and other stuff.  That's your "189gpio" device.  Note the entry below it shows an Error on the Device icon -- that is from a formerly-connected gpio that was assigned an IP Address of 192.168.10.240, but is not currently connected.

 

Look at the remaining numbers: "::23:SOCKET".  This means that you have a VISA connection over TCP/IP (a.k.a. Ethernet, or WiFi) that uses "Socket" 23.

 

Go back to your Computer, plug in your GPIO, open MAX, and click on the Network Device that shows a "working device" (like Socket 23 in the picture you sent).  Then look in the right-hand pane and see if you "see your Device".  If so, try to open a Test Panel and establish a VISA connection.

 

So now you need to learn how to "talk serial" to your device using VISA.  Here is a link to a tutorial on setting up such communication -- it discusses Communication using "true" Serial Ports (a.k.a. RS-232).  There's a bit of a "trick" to configure a Serial Port over Ethernet -- I've done it, but I'll have to go look for "how I did that".  Or, better, do what I just did and Web Search for "LabVIEW Serial Communication over Ethernet" and look at the October 2020 Knowledge Base article (print it out for yourself).

 

Good luck.  This should get you "mostly there".

 

Bob Schor

Message 4 of 10
(1,635 Views)

I have used a similar module from Numato (32-channel relay, also Ethernet).  I was very impressed with it, especially for the price.

 

1. The USB connection is just for configuring the device.

 

2. These devices use a Telnet protocol to communicate.  Which means you will have to handle Telnet option codes.

 

So I did not use VISA for my driver.  I used the TCP/IP functions.  Part of connecting is to specify the connection port (23 is specifically allocated for Telnet by some internet authority).  There is a simple TCP Write, which will just send what you tell it.  And then the TCP Read has an option to read a specific number of bytes or to stop at a Carriage Return + Line Feed.  I typically use the CRLF option for this.  So I read a line and then I have to search for 0xFF and then either 0xFD or 0xFE.  For each of those I found, I replied back the exact same code to act as an acknowledgement of the option code.  If you don't do this, the rest of the session will not work.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 10
(1,618 Views)

I like Crossrulz' method, particularly because he's actually used these boards!

 

Bob Schor

0 Kudos
Message 6 of 10
(1,609 Views)

@Bob_Schor wrote:

I like Crossrulz' method, particularly because he's actually used these boards!


I liked the method because I could reuse the class I had already made for other Telnet interfaces.  I just had to add the handling of the option codes for these boards since the previous interfaces did not use them.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 10
(1,590 Views)

Thank you so much for replying crossrulz! Notes taken!

 

I have tried to run some examples using TCP/IP functions but I am still a bit confused. From what you said, I will need to make a host vi and client vi, the host will be my laptop/the network and the client will be GPIO device, right?

 

Would you mind explain a little more about "For each of those I found, I replied back the exact same code to act as an acknowledgement of the option code." and how to code it please? Does it mean I can enter the log in info (If you could see the two screenshots attached to the first post)?

0 Kudos
Message 8 of 10
(1,558 Views)

@EE_KK wrote:

From what you said, I will need to make a host vi and client vi, the host will be my laptop/the network and the client will be GPIO device, right?


No, you will only need to make a client VI.  The GPIO device is already the server.

 


@EE_KK wrote:

Would you mind explain a little more about "For each of those I found, I replied back the exact same code to act as an acknowledgement of the option code." and how to code it please? Does it mean I can enter the log in info (If you could see the two screenshots attached to the first post)?


I somehow know you would ask for that.

 

Read Data:

 

Respond to Option Code:

 

Log In:


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 10
(1,554 Views)

I realized I don't have the telnet functions installed so I went looking for the package, but I can't find it, and https://forums.ni.com/t5/LabVIEW/Deprecation-of-Internet-ToolKit-so-no-more-Telnet-support/td-p/2381... . Does it mean I can't use telnet functions anymore? 😞 This is the very first time using LabVIEW so I'm not familiar with all the elements, would you label the items please? I really appreciate your time and help!

0 Kudos
Message 10 of 10
(1,543 Views)