Any hints on how to implement ad hoc mode?

Follower,

Thanks for the library. I’m awaiting delivery of my WiFly shield but reading the forums in the meantime. I want to control my Arduino using my iPhone via WiFly, without a router. I think that means I need ad hoc mode. I’m happy to try to implement it and submit the changes if I succeed, but I could use some hints on how to get started with that if you have any. I’m a professional developer but not a networking/wifi expert by any means. README.txt contains the following:

At the moment adhoc networks of any type are not supported–the module supports them, the library just hasn’t been modified to recognise the different way the module responds when connecting.

I assume this means I will need to tinker with the WiFly via command mode to bring up an adhoc network and analyze the "protocol", then modify the code to handle it.

Thanks for any help you can give.

going to adhoc mode on you wifly is easy and straitforward

there are two ways to go there either by hardware configuration or software setup

this’s taken from the manual for easy future reference when you recive your wifly

To enable adhoc mode via hardware:

Set PIO9 high (3.3V) at power up. On the RN-134 PIO9 is on J1 of the jumper block. When the module

powers up in adhoc mode the WiFly module creates an adhoc network with the following

SSID: WiFly-GSX-XX where XX is the final two bytes of the devices MAC address

Channel: 1

DHCP: OFF

IP address: 169.254.1.1

Netmask: 255.255.0.0

With the adhoc jumper in place the above settings override the current saved configuration settings.

To enable adhoc mode from software:

From command mode, the module is configured for adhoc mode using the join command. You will also

need to set the ssid and channel.

set wlan join 4

set wlan ssid my_adhoc_network

set wlan chan 1

Turn off DHCP and set the IP address and netmask so other devices know where to connect to the adhoc

WiFly GSX. Since auto IP fixes the first two bytes of the IP address you want to use the netmask of

255.255.0.0 so that other device connecting to the module can be reached. Alternatively you can set the

netmask to a smaller subnet if the other device’s IP addresses are begin statically to the same subnet as the

adhoc device

set ip address 169.254.1.1

set ip netmask 255.255.0.0

set ip dhcp 0

Be sure to save your configuration, then upon reboot the module will be in adhoc mode.

Hope it helps

K!mO’s

Thank you, kimokono. That’s very useful. I’ve first got to solve the problem of receiving OSC over UDP on the WiFly, but once I get past that I’ll be ready to try adhoc mode.

I’ve been having problems with adhoc connection. I use the hardware method, and it seemed to work fine. This allowed me to keep the UART conencted to an micro streaming data which still allowing me to program the WiFly. The AdHoc connection sems flakey. Let me explain:

Out of 5 WiFly modules I have tested, they all connect different times (if at all) to the adHoc network. Today, I haven’t been able to get a full connection at all! My method is this: Set pin 9 to 3.3v, then boot (with default wifly settings). I use my Mac to connect to the adhoc network (WiFly-GSX-b0 for instance), then I attempt to telnet into the wifly. “telnet 164.254.1.1 2000” This worked earlier this week, and no longer does. Usually the telnet will timeout, but from time to time I will get a “Connection refused by host” message. I’m not sure what is going on here. Any ideas?

Hi,

I am also with the same project as yours, only i use Android phone. my target is to turn on LED on the arduino remotely. i have tried the adhoc mode on wifly. i downloaded an application called Wifi Scanner for android. it can detect the network how ever, i cant seem to connect to that adhoc which the wifly created. Ive read from forums that there are still problems with adhoc connection most of the Android phones not unless the phone has been rooted. But i dont want to take the risk of rooting my phone. i dont know if iPhone has that disadvantage on adhoc. but significantly, we have the same project. and i also looking forward on how you implemented it. :slight_smile: gud luck. i will also post my project if its successful. this is our final project, and i am having fun on it.

ooppss… i did not notice the post date. i guess this project has been done. i would like to take a glance on how you implemented this project.