HOW TO: Establish TCP Connections to XBee Nodes Using Python on a ConnectPort X Coordinator

The Xbee_Transport python scripts create TCP sockets on your Digi gateway which would correspond to the XBee radios on the PAN.  This will allow a TCP socket or telnet connection directly the desired XBee radio on the PAN 

http://www.digi.com/wiki/developer/index.php/Xbee_transport#xbee_transport.py

1.  Download the zip file containing the sources at the bottom of the URL and unzip them on your system.

2.  Point your web browser to the IP address of your Digi coordinator (login as root).

3.  Select Python from the menu, then Browse and  Upload the 3 files.

4.  Telnet to the Digi coordinator (login as root).  Run the script to discover your Xbee modules and assign a 4000 TCP socket number:

py xbee_generator.py

The output file is placed into the FS/WEB/python directory named as 'bind_table.py'.  For example:

http://(ip_of_gateway)/FS/WEB/python/bind_table.py

5.  Once completed run the transport script:

py xbee_transport.py

6.  Once this is run, you will then be able to make a TCP connection using the 4000 socket numbers assigned.  This can be tested using telnet:

telnet (ip_of_connectport_x) 4000

7.  Once this is confirmed to work successfully, configure the script to start automatically.  From the Digi coordinator web interface, select the Python menu, followed by the Python Auto-start tab.  Type in the xbee_generator.py and xbee_transport.py files and place a check mark in front.

This will automatically start the scripts whenever the ConnectPort unit is rebooted.

Last updated: Jan 01, 2024

Recently Viewed

No recently viewed articles

Did you find this article helpful?