LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Communication with XBee Wifi from LabVIEW VI

I'm reaching that frustration point where I cannot get LabVIEW to communicate using TCP with an XBee Wifi module over a wifi network. I've checked and re-checked all of the settings several times, gone through the documentation, and tried multiple VIs, yet nothing seems to work. What am I missing?

 

NOTE: Most of the related help on the forums pertain to communicating with the XBee from LabVIEW using USB. I do not need to configure/communicate directly with the XBee and it's API using LabVIEW. I am using Digi's X-CTU utility. I just need to communicate with/through the Xbee over TCP on our simple network.

 

I've tried the following VI examples (in addition to a few simple custom VIs using TCP Listen, TCP Open Connection, TCP Close Connection and TCP Read/Write):

TCP Active Communicator.vi

TCP Passive Communicator.vi

Simple Data Server.vi

Multiple Connections - Server.vi

 

Everything will either timeout, or I will get the errors shown below. I cannot seem to establish a connection nor send/receive data packets on either end.

 

Here is what does work:

  • I can ping the Xbee radio from the base station using the command prompt. No issues here.
  • I can get the LabVIEW examples I mentioned above working and communicating using TCP while the VIs run on two separate machines within our simple network.

Base Station IP: 192.168.1.101

Xbee Radio IP: 192.168.1.100

PC #2 (for Xbee control using X-CTU): 192.168.1.102

Wireless Access Point: Hawking HOWABN1

 

System diagram:


Photo Feb 01, 2 09 24 PM.jpg

 

 

Errors:

LV Error 1.PNG  LV Error 59.PNG

 

X-CTU/Xbee Configuration & Communication:

X-CTU Modem Configuration.PNG X-CTU Terminal.PNG

 

Thanks!

0 Kudos
Message 1 of 12
(7,790 Views)

What Xbee are you using? and what is the data protocal that the Xbee is using?

 

I believe almost all Xbee devices communicate over ZigBee (IEEE 802 standard) not TCP/IP. 

 

That would explain why the X-CTU comunicating in ZigBee works, but not LabVIEW communicating over TCP/IP. 

 

LabVIEW doesn't natively use ZigBee, but I have seen serial communications sent from LabVIEW through a ZigBee conection. 

 

You may want to look into a similar solution. 

 

 

Applications Engineer
National Instruments
CLD Certified
0 Kudos
Message 2 of 12
(7,732 Views)

It's the Xbee Wi-fi module. 802.11 standard.

 

The module is able to connect to the wireless access point, obtain an IP address automatically via DHCP, and I can ping the module using cmd.exe.

 

Check the third photo set ("Modem Configuration") for the options I have available. Option #5 under Networking is "Timeout for connection on TCP client sockets." Additionally, Option #3 ("IP Protocol") has two variables: (0) - UDP and (1) - TCP.

0 Kudos
Message 3 of 12
(7,723 Views)

Okay. I think I made some progress.

 

Checking things again today, I realized that the port # is in Hex on the X-CTU software (and decimal in the other apps). I got the TCP Passive Communicator.VI to receive one line of data, but after that it errors/times out. I still cannot get the X-CTU software to read data being sent from LabVIEW.

 

In order to troubleshoot, I was watching packets using WireShark (and realizing no TCP connection was established). I also used another TCP listener and PuTTY to help troubleshoot (PuTTY would not work).


At this point, I'm going to switch from using X-CTU to a Python script written by another team member. This seems to be more reliable than the X-CTU software.

0 Kudos
Message 4 of 12
(7,694 Views)

Well, as far a LabVIEW is concerned, make sure have the proper setting enabled under Tools >> Options, then select the VI Server tab. It sounds like you've got the settings right for communication to the other machine's IP, but perhaps you need to double check how you set up the allowance to the wireless devices properly.

 

Where is the communication timing out? In LabVIEW or from X-CTU? Have you tried increasing the time outs in LabVIEW and seeing what happens?

 

What does WireShark say when that one line shows up in LabVIEW?    

Applications Engineer
National Instruments
CLD Certified
0 Kudos
Message 5 of 12
(7,677 Views)

Hi, I am working on a very similar project. Did you end up having any success with solving this?

 

any help or vis that you are able to provide would be greatly appreciated.

 

Thanks

Zack

0 Kudos
Message 6 of 12
(5,729 Views)

Hello Zack,

 

Are you running into errors with your program, or just looking to get started? Maybe you could provide us with some more information on your application so that we know how we can help!

 

Thanks,

0 Kudos
Message 7 of 12
(5,711 Views)


Hi Siana,

 

I am not running into errors. I have a program which works over serial communication using standard XBee Pro Series 1 modules. They are currently set up as a coordinator and end device and work as a way to just transmit analog signals back to the coordinator from the end device to display on a laptop screen. The coordinator is mounted on an xbee explorer and connected to the laptop.

 

I would like to switch to using a XBee S6B (wifi module) or an RN42-XV (bluetooth module) to connect my existing hardware to a laptop running a labview application. This would allow for the end user to not have to connect the explorer to the laptop.

 

The wifi module would be preferable so the end user just needs to connect the laptop running the labview application to the XBee S6B's broadcasting network. That network could then be saved as default.

 

I have not written anything for this yet. I would appreciate any examples or code from either you or ajf200 to help get this project started!

 

Thanks
Zack

0 Kudos
Message 8 of 12
(5,680 Views)

Hi Zack,

 

It’s difficult to direct you towards a specific resource/approach given the third party hardware you’re using. You’ll want to identify the XBee module’s IP address so LabVIEW knows what device to listen for. Do you have your device’s IP address?

 

You also need to know what commands/drivers are necessary for your device to communicate with LabVIEW. Can you provide more information on the devices you are planning on using? In general, your overall approach will be dependent on communication methods necessary for you device (device-specific commands, drivers, networking protocol, etc).

 

Regards,

 

Neil

Neil
Applications Engineering
National Instruments
www.ni.com/support
0 Kudos
Message 9 of 12
(5,635 Views)

@ZackGreg wrote:

Hi, I am working on a very similar project. Did you end up having any success with solving this?

 

any help or vis that you are able to provide would be greatly appreciated.

 

Thanks

Zack


I don't recall that we ever got this solved, and ultimately we ended up going with different hardware for a variety of reasons.

0 Kudos
Message 10 of 12
(5,501 Views)