WiFly module: join the network and start reporting data

Jun 15, 2014 08:45

As you remember the WiFly module acts like a controller to your sensor. It has WiFi support, thus can be installed autonomously and does not need any wiring and network cable. All you need is to configure the module to join the network and report the measurements to a server in your local network.


Get Your Network Ready

1. Assign a fixed IPs to your Server and your WiFly

2. Install Apache+PHP+PostgreSQL to your server.
You can use PostgreSQL's Stack builder and select Enterprize DB Apache PHP. This installs necessary software, but I noticed it was somewhat glitchy under Win8. I know I should have used Unix-based system, and may be I will switch one day. :)

3. Connect battery, power module and your WiFly.
Alternatively you can use WiFly USB explorer, also available from SparkFun.


If the lights on the module go on you are ready to

Connect to your WiFly

1. Chose WiFly network
WiFly module is shipped with ad-hoc network available. AFter the module is powered you should have a new unsecured network in your networks list. It is typically named "rowing" or "WiFly". Join that network.

2. Telnet to your module
Using a terminal/telnet connect to 1.2.3.4:2000. In windows putty would do the trick.

3. Configure WiFly, part 1
#Type $$$ to get to command mode
>$$$

# sets the pass phrase
>set wlan phrase ***
# set the network the module should join, in my case, "HOME" is the name of the network
>set wlan ssid HOME
# enable DHCP
>set ip dhcp 1
# set the IP address for the module
>set ip a 10.0.0.199
# tell the module to join the wlan
>set wlan join 1
#save
>save
# and reboot
>reboot

3. Configure WiFly part 2
Now the module should have joined the "HOME" network. Return your PC to "HOME" network, telnet to 10.0.0.199:2000

# enable TCP and HTML client
>set ip proto 18
# set server to connect
>set dns name 10.0.0.9
#set remote port
>set ip remote 80
# this is needed unless you have a real DNS in your network
>set ip host 0
# Auto-connect upon wake
>set sys auto 1
# send data and ID
>set option format 15
# send all sensors data to the server
>set q sensor 0xff
# command to "execute on the remote server
>set com remote GET$/server.php?value=
#wait 2 minutes before going to sleep
>set sys sleep 120
# sleep for 30 minutes
set sys wake 1800
# set device name: I use it to distinguish between my troubleshooting and actual data sent by device;
# may also be useful if you have multiple devices
>set option deviceid fly-level

# set output voltage to certain pins that we will use to power up the sensor
>set sys output 0xc8 0xc8

# save and reboot
>save
>reboot

Looks like you are done :)

wifi, toys, telnet, howto, home automation, rn-xv wifly

Previous post Next post
Up