I try to set a XBee WiFi module as ad-hoc point to send and receive data from a computer or another client.
The ad-hoc point is up and the network is visible and also i can connect the computer to this ad-hoc network.
So far so good.
The XBee WiFi module is connected to an Arduino board and the transmission data are send from the arduino microcontroller via SPI to the XBee module.
On the computer i run a small TCP client socket programm to send data to the ad-hoc network.
My question is: how I can connect the XBee module to its own ad-hoc network?
Furthermore, for the TCP transmission i need to specify the IP adress of the server, but in ad-hoc mode there is no IP-adress used!?
So, is it possible to create an ad-hoc network and join them with one XBee WiFi module?
Thank you for your help
I am looking (on page 30 / 38) in the manuals and it looks like you still use an IP address in adhoc mode you would set it and the hosts IP in the MY, DL, and MK fields.
is a nice walk through of how to set this up.
Thank you for the fast answer.
I checked the manual already, but in the manual application, the computer will create the ad-hoc network and the XBee WiFi module is just joining.
In my case i want to create the ad-hoc network with the XBee module and also join.
When the XBee creates the adhoc network there are certain restrictions (at least for the S6B that I am familiar with - but you don’t say which version you are using, the S6 or the new S6B):
- There can only be two XBee nodes in the network - creator and the joiner. Set AH1 on the creator and AH0 on the joiner.
- No DHCP is available (automatic assignment of IP addresses). You must manually configure compatible IP address and subnets using the MY, DL and MK commands for both nodes.
- No wireless security/encryption is available. You must use “open” mode (EE0).
Please see page 37 of the manual.
I do not believe these restrictions apply if you create the ad-hoc network from your PC. In that case multiple XBee’s can join the network, you will have DHCP available and you can use encryption. This is because the PC looks after the DHCP and routing aspects of the network (the Xbee has only very limited abilities in this regard - e.g. only a DHCP client and not server, and very basic routing etc).
I’m using the XBee S6B version of the module.
I set the IP and Subnetmask, but i can’t connect my PC socket to the module. I use just one module instead of two and my module is in the creator mode. So my PC is the joiner.
The destination adress of the creator is set to broadcast.
The network is visible, but i have no idea how to send data!
Edit: I just recognized that for a TCP application a broadcast destination make no sense. I will change my setup to UDP!
I changed to the UDP protocol, but i have still the same problem.
When i creade the ad-hoc network, i can connect with my computer, but i always get the message: unidentified network.
My full configuration is:
CH B (2462MHz)
AH 1 (adhoc creator)
IP 0 (UDP)
MA 1 (static)
DL 255.255.255.255 (broadcast)
CO 2616 (source port)
DE 2616 (destination port)
GW 192.168.2.1 (gateway)
MK 255.255.255.0 (subnetmask)
MY 192.168.2.1 (XBee IP)
EE 0 (no enryption)
The PC network config:
I can’t ping the XBee module or send any data.
I’m not sure what you are trying will work. It seems to me that the XBee adhoc mode is most likely designed for XBee to XBee communications only (due to the limitations). But it may do - I can not say as I have not personally tested it.
The one thing missing from your configuration is setting the SSID of the network:
Also note that the command to set the source port is C0 (note: Zero) and not CO (letter oh).
And in the documentation it explicitly says that DL should specify the address of the alternate node. As it doesn’t say “or broadcast address”, then I’d assume (at least for starters when trying to get things to work) that it doesn’t support broadcasting in this mode. Try DL192.168.2.4 at the XBee.
Now i tried to connect my XBee ad-hoc point with a linux system. It is possible to connect the PC with the XBee module, but i still have no idea how to send data.
I used the X-CTU terminal on the XBee side and netcat on the PC, but there are no incoming data.
I can not imagine that it is not possible to send data from a PC directly to a XBee module with an running ad-hoc network!
Well, at least according to the application note posted by jeremy, it should be possible…
As I said in my previous post: In both the manual and that application note, it says that DL should explicitly point at the destination IP address and not the broadcast address. Have you changed that?
And have you checked the ad hoc SSID is set correctly (ID command) on the xbee to the same network name as the PC is listening on? The application note has it set as “digi”.
And if you are still using UDP it looks like you will need to use the -u option in netcat? Otherwise it will be using TCP and obviously the connection will fail.
You have to make sure you are sending on the correct port.
Default is port 9750 (0x2616)
On the XBee the ports are entered in as Hex, while on the PC ports are in decimal.
I asked about it and it seems the S6B currently has a bug that prevents the use of adhoc mode. Here is hoping they get it added soon.
Yes, i set DL to the PC IP address. The SSID will be also set by the XBee module (ad-hoc creator) and the computer can connect to these network. I changed already back to TCP (DL is set) and tried again. It’s still not working.
I try to run this setup since three days, so I decided to buy a second XBee WiFi module. To connect them should be more easy.
If anyone has some sugestion, please post it here, i think it could be helpfull in future.
Thanks to everybody who tried to help me
I have the same problem. Did you find any solution?
Working with two XBee S6B, and XCTU tool. Also I tried Putty example with same result.
I can join any network and send/received datas, but not working with ad-hoc configuration…
I am in the same situation is there any answers?
Hey, I never found the root cause of the problem and I also never could fix it. Sorry, but I can’t help you.