WiFly Radio Installation

WiFly Radio Installation Instructions

[Note: the original WiFly radio system is no more recommended, mostly because of the disconnection problems in polluted WiFi environments. The new XBee S6B WiFi radio is a much better radio, and the new installation instructions are here.]

The WiFly RN-XV is available from Sparkfun:

https://www.sparkfun.com/products/11047

The WiFly disconnects easily, so use the following high gain antenna to prevent this:

https://www.sparkfun.com/products/558

You will need a breakout board to connect your XBee radio to the MarcDuino:

https://www.sparkfun.com/products/11373

You will also need another board called an XBee dongle, this one with a USB plug, in order to program the radio from your computer:

https://www.sparkfun.com/products/9819

Download a terminal program

I use the TeraTerm the terminal program on Windows to send the configuration messages to the WiFly

Teraterm Web Site

Download current tera-term version (4.78)

On the Mac you can use the built-in command line "screen" if you are hard core, or the much easier to use app CoolTerm:

http://freeware.the-meiers.org/

Connect to your WiFly via the terminal program, enter the WiFly command mode

  • Plug your WiFly into the USB dongle, the USB dongle to your PC/Mac.

This will automatically create a COM port or serial entry on your computer (on Windows, you can find out on which COM ports it appears by looking at the Serial Ports in the Device Manager).

  • Configure your terminal program for serial communication as follows:

9600 bauds, 8bits, no parity, one stop bit (known as 8N1) on whatever serial COM port number your adapter shows up

  • Enter the WiFly command mode and confirm your firmware version

Once the WiFly radio is connected to the computer via the adapter board, and your terminal program is configured properly, you should see some startup message as soon as you power up or restart the WiFly, which might already have the firmware version indicated in it.

To enter the WiFly command mode, type three $$$ in a row (do not press return!).

After one second the Wifly should print "CMD". You have just entered the command mode. You can now enter commands to configure your WiFly.

Now hit enter a couple times, and the version of the firmware you have should be in the prompt:

<2.38>

or

<4.00>

or

<4.41>

If your firmware version is not 4.41, you need to update it, see "updating the firmware" below.

Configure the WiFly (for firmware 4.41)


Enter the following commands. Make sure you first type $$$ (no return) to get into command mode as explained above. Do not type the comments within brackets:


$$$ [only if you are not already in command mode. It should respond with CMD and a prompt]

set wlan join 7 [enables Access Point mode]

set ip dhcp 4 [enables DHCP server]

set ip address 169.254.1.1 [or choose any other IP address]

set ip gateway 169.254.1.1 [for iPhone to connect, gateway needs to be the same as the IP address]

set ip netmask 255.255.255.0 [note, only one zero at the end]

set wlan rate 0 [throttle down speed for longest reach, default is 12]

set apmode ssid R2D2WiFly [or any other name you choose for you R2 Wifi network]

set apmode pass yourpassword [set your WiFi password here, needs to be at least 8 characters long, max 32]

set wlan channel 1 [or any 2.4GHz channel number you like, I think there are 7]

set ip protocol 0x3 [enables UDP connection mode]

set apmode link_monitor 0 [disable deauthentication of clients]

set comm idle 5 [new for R2 Touch 1.3, helps for link reconnects]

save

reboot



Restoring defaults in case of a mishap


If at any point you get messed up or get a bad configuration prompt, use this to get you back to the factory defaults and start again:


$$$ [only if you are not already in command mode. It should respond with CMD and a prompt]

factory R

save

reboot

Connecting to R2 Touch


Leave the WiFly connected to the computer via the USB board and the terminal session.

Launch the R2 Touch application on your iPhone. Press on the little wrench button to go to the settings:

Once in the R2 Touch settings, choose TCP as the Connection Method.

Enter your Receiver IP address exactly you set it up while configuring your WiFly above.

Change the Wifly port to 2000.

The picture below shows the custom address for my setup (169.254.100.100), but the default is 169.254.1.1 and you should use that unless you have also changed the WiFly IP address. The IP address you enter here should match exactly the one you programmed into the WiFly.

Press done, which will return to the main screen.

If all is well, you should see some traffic to the terminal. It's going to be mostly garbage, because the WiFly is not connected to the MarcDuino yet. The indicator in R2 Touch is NOT going to turn green either. You might be seeing "open" followed by an almost immediate "close" as the app is not receiving a confirmation from the MarcDuino. But if you see any traffic, this test is enough to confirm that you WiFly connection is established properly.

Your Wifly is now configured, you can connect it to your MarcDuino as explained here:


Updating the firmware to 4.41

Only necessary if you don't have 4.41 firmware on your WiFly. Updating is complicated: you can only update using Microchip's ftp server.

$$$ [enter command mode, do not press enter]

factory R [factory reset]

save [save clean config]

reboot [reboot from clean config]


$$$ [re-enter command mode, do not press enter]

set wlan join 1 [join WiFi from ssid and passphrase]

set wlan ssid Your-Home-Wifi-SSID-Here

set wlan phrase Your-Home-Wifi-Password-Here

set ip dhcp 1 [get ip info from dhcp server]

set ftp address 198.175.253.161 [ftp address of ftp://rn.microchip.com/public/, microchip's update server]

set ftp dir public [optional, download dir, default setting should be already OK]

set ftp user roving [optional, ftp user name, default setting should be already OK]

set ftp pass Pass123 [optional, ftp password, default setting should be already OK]


save

reboot


[upon reboot it should now say that it is connecting to your WiFi network]


$$$

ftp update wifly-EZX.img [downloads the latest firmware]

reboot


or:


$$$

ftp update wifly7-441.img [specifically downloads 4.41]

reboot


then:


$$$

factory R [so it does not complain about a "CFG-ERR" or bad config]

save

reboot


$$$ [Phew! You should be good to go with your new firmware]

Note: As of April 2021, I don't think microchip's ftp server is still up, so the following procedure will not work anymore. The (complicated) workaround is to setup your own local ftp server, put the firmware update file provided below on it, and adapt the above instructions to download from this location.

Arcane Option: Disabling UDP Support


There are two ways to connect to the WiFly, either for UDP or TCP communication, which you can choose from the R2 Touch settings. R2 Touch uses TCP, which is secure. But under firmware 2.38, UDP was left open which is unsecure.This is not an issue anymore with firmware 4.41, which implements passphrase protection and encryption. However If you are still uncomfortable with UDP or are using the older firmware, you can disable it with this command:


set ip protocol 0x2 [disables UDP connections, only TCP accepted]


To revert to supporting UPD connection, use:

set ip protocol 0x3 [enables UDP connections]

Obsolete configurations for previous firmware versions

For reference only. These firmware versions are obsolete, update to 4.41 instead.

WiFly Ad-hoc Configuration for firmware 2.38

$$$ [enter command mode, do not press enter]

set wlan join 4 [enables Ad-hoc mode]

set ip dhcp 0 [disables DHCP server]

set ip address 169.254.1.1 [or choose any other IP address starting with 169.254]

set ip gateway 169.254.1.1 [for iPhone to connect, gateway nees to be the same as the IP address]

set ip netmask 255.255.0.0 [note, two zeros at the end]

set wlan rate 0 [throttle down speed for longest reach, default is 12]

set wlan ssid R2D2WiFly [or any other name you choose for you R2 Wifi network]

set wlan channel 1 [or any 2.4GHz channel number you like, I think there are 7]

set ip flags 0x6 [TCP close on connection lost]

set ip protocol 0x3 [enables UDP connection mode]

save

reboot


WiFly Access Point Configuration for firmware 4.00 and 4.01


$$$ [enter command mode, do not press enter]

set wlan join 7 [enables Access Point mode]

set ip dhcp 4 [enables DHCP server]

set ip address 169.254.1.1 [or choose any other IP address]

set ip gateway 169.254.1.1 [for iPhone to connect, gateway nees to be the same as the IP address]

set ip netmask 255.255.255.0 [note, only one zero at the end]

set wlan rate 0 [throttle down speed for longest reach, default is 12]

set wlan ssid R2D2WiFly [or any other name you choose for you R2 Wifi network]

set wlan channel 1 [or any 2.4GHz channel number you like, I think there are 7]

set ip protocol 0x3 [enables UDP connection mode]

set wlan fmon 0 [disables auto deauthentication of clients, default is 3600]

save

reboot

WiFly Technical Reference Documentation