Setting up the WiFi Radio

[Update 2/26/2016] The XBee S6B is now the recommended WiFi radio

The WiFly had the nasty habit of disconnecting if there were too many WiFi radios around, making it rather useless at large events. I battled with the makers of the Wifly, until they finally acknowledged it's a big bad bug. But they won't fix it!  The hell with them. Short of going all the way to the unbreakable XBee Pro solution  and Audio Board setup, there is now a much better WiFi radio.

The XBee S6B is a pin to pin compatible replacement, and does not have the disconnect problem.

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


It fits in the place of the former WiFly, but works much better in high traffic WiFi areas .

You will need the same breakout boards as before:
  - the XBee Dongle to connect to a USB computer port, only for configuring it




 - the XBee breakout board to connect your programmed S6B to your MarcDuino v1 or v1.5 (for v2 you don't need it, the XBee socket is included on the board).

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



To set up the S6B you use the USB XBee Explorer board and the Xbee XCTU software from Digi: http://www.digi.com/products/xbee-rf...port-utilities

Plug your XBee S6B in the USB breakout and to your computer.

Read in the current config in the XCTU tool. Make 4 modifications:
- Change Infrastructure Mode to SoftAP (default was STA)
- Change SSID to whatever you like. (default was Blank)
- Change IP Protocol to TCP (default was UDP)
- Setup WPA2 password encryption.
Write the changes back to the S6B device.

Next in the R2 Touch app under the wrench menu, make 2 changes:
- change Receiver IP address to 192.168.1.10
- change Receiver Port Number to 9750

After this you just move the S6B module to the XBee Explorer Regulated and power up your R2.

 To connect, go to your iPhone Settings, in the Wifi section, you should see your R2 network, or whatever SSID name you gave it above. Connect to it by selecting it.



Open R2 Touch, the WiFi indicator should turn green (note: it will not turn green if your WiFi receiver is not connected to a working MarcDuino, this is normal).

A few things to check if things don't work

If it doesn't, check that
    1- your iPhone is connected to your s6B or Wifly network (quit the app and go to the iPhone Wifi settings), not to your home Wifi network.
    2- you are using the TCP connection method (in the R2 Touch wrench menu)
    3- your have entered the correct Receiver IP on R2 Touch (see above)
    4 -you have entered the correct Receiver port on R2 Touch (see above)
    5- I haven't tried this yet, but I suspect if you leave your WiFi receiver connected to the XCTU tool you can monitor the traffic it receives from R2 Touch. The data received is going to be mostly garbage, because the receiver is not connected to the MarcDuino yet. The indicator in R2 Touch is NOT going to turn green either. But if you see any traffic, it's enough to confirm that you WiFi connection is established properly.

---------------------------- obsolete stuff below -----------------------------------

Below are the former instructions for the WiFly (not recommended anymore)

The recommended receiver radio is the WiFly RN-XV, available from Sparkfun:
https://www.sparkfun.com/products/11047


With the following high gain antenna:
https://www.sparkfun.com/products/558



Before you can use it, you need to configure it as a WiFi access point. The easiest way to do this is to connect it to a computer USB link via an XBee breakout board (or a serial RS232 port if you have such a thing). You will need one of the following, the USB is the easiest:

    - XBee Dongle to connect to a USB port



    - XBee Serial to connect to a Serial port
    - I use the TeraTerm the terminal program on Windows to send the configuration messages to the WiFly (on the Mac I use the built-in command line utility "screen")
          Teraterm Web Site
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://www.macupdate.com/app/mac/31352/coolterm
http://freeware.the-meiers.org/


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

Configure the WiFly

Enter command mode and find your firmware version

Once the WiFly radio is connected to the computer via the adapter board, and TeraTerm 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.

Type three $$$ in a row (do not press return!), and 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 and only now, type a few returns, and the version of the firmware you have should be in the prompt:
<2.38>
or
<4.00>
or
<4.41>

You should absolutely update your Wifly to firmware 4.41, see "updating the firmware" below.

WiFly Access Point Configuration for firmware 4.41

Make sure you first type $$$ (no return) to get into command mode. Do not type the comments within brackets:

$$$                                [to enter command mode, 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



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. Under the former firmware 2.38, UDP did a better job in congested WiFi environments (large conferences). However TCP configuration is more secure, so that's the R2 Touch default. I have not had enough experience yet under firmware 4.00 to see which is better. It is theoretically possible for someone to connect to your R2 through your WiFly network, and if they now the IP and the port you are using, they could send UDP messages to your WiFly. This is not an issue anymore with firmware 4.41, which implements passphrase protection and encryption. However If you are still uncomfortable with UDP, 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]

Restoring clean defaults

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:
factory R
save
reboot

Updating the WiFly firmware

Roving Networks made a royal mess by programming the wrong ftp update server into their older firmware (2.38 included), so none of the update instructions actually work. After an untold amount of frustration, I finally discovered that their ftp download location is:

ftp://rn.microchip.com/public/

The address of the site currently resolves to 198.175.253.161

It requires a user name of: roving

And a password: Pass123

The file they recommend is wifly7-441.img (as of Jan. 2015).

But I found wifly-EZX.img apparently has the latest version, so probably just use that.

So here is the procedure for updating:

$$$                                               [enter command mode, do not press return]
factory R                                         [factory reset]
save                                              [save clean config]
reboot                                            [reboot from clean config]

$$$                                               [re-enter command mode]
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                   [new ftp address of the 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

$$$                                               [you should be good to go with your new firmware]

Just in case, I downloaded the file and put it in the download section at the bottom of the page. If you have your own ftp server you could put it there, and setup like above to point to your server and get it from there.

Here is a way to check if your WiFly is receiving data

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

Launch the R2 Touch application. 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.
You should not have to change the Wifly port (unless you configure your Wifly otherwise), make sure it is set to the default (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 when you programmed it above. In any case, 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. So you will be seeing "open" followed by an almost immediate "close" as it is not receiving a confirmation from the MarcDuino. The indicator in R2 Touch is NOT going to turn green either. But this test is enough to confirm that you WiFly connection is established properly.

Your Wifly is successfully configured, you can now connect it to your MarcDuino in your R2 as explained here:
Connecting the MarcDuino's
Now you should be able to connect and the indicator on R2 Touch will turn green!

Obsolete configurations for previous firmware versions

I am keeping these for reference only. Use these only for test if your wifly came with another firmware. Upgrade to 4.41 for your final implementation.

WiFly Ad-hoc Configuration for firmware 2.38

Do not use 2.38 anymore. It drops connections often.

(make sure you first type $$$ to get into command mode. Do not type the comments within brackets)

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

Do not use 4.01 anymore.

(make sure you first type $$$ to get into command mode. Do not type the comments within brackets)


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 Firmware Image files

I downloaded the 4.00 and latest firmware files below (both of them should be the same at this point), just in case. I also uploaded the files on an alternate ftp site. You should be able to access them by using these values in the ftp update setup instead of the roving networks ones, in case the roving network site is down.

  • ftp address: 67.205.91.17
  • Username: curiousmarc
  • Password: r2builder
  • Directory: Webshared Files
ċ
wifly7-400.img
(87k)
Curious Marc,
Nov 7, 2013, 11:13 AM
ċ
wifly7-441.img
(89k)
Curious Marc,
Feb 24, 2014, 10:58 PM