Close

Configuring a WiFly Module (Old, check out ESP8266)

A project log for Air Gesture AC Dimmer/Switch

A Touchless Gesture Mains AC Dimming Switch

johnnyJohnny 07/06/2014 at 17:180 Comments

In this project log, I'm going to explain how to setup a WiFly module using an XBee explorer, so you can start using it with a microcontroller on your home network.

Required Parts:

Required Software:

*NOTE* - Make sure you use the switch on explorer to supply 3.3V! Don't worry about the UART RX pin though, it's 5V tolerant.


Getting Started:

Step Four

- Now just click "Open".


Command Mode

Command mode is the mode in which your WiFly module will accept commands via UART to change settings and perform actions. When powered up, by default the module is not in command mode. We need to enter command mode so we can start configuring the device. To enter command mode, make sure nothing is transmitted to the module for 250ms or more, then you must send "$$" and wait another 250ms or more afterwards.

What You Type:

$$

Response:

CMD

The "CMD" response from the module let's you know you're now in command mode.

Connecting to Your Network

Now that you are in command mode, lets tell the WyFly module what type of security our WiFi network has. I have WPA2-PSK. Yours may be different. Check your router settings.

Based on the table above, I enter the following command and press enter:

set wlan auth 4

because the module will echo back to you in command mode, you will see:

set wlan auth 4
AOK
<4.00>

The "AOK" is a response from the module verifying that the module understands and has performed the command successfully. The "<4.00>" response is the firmware version of the module. From now on I'll just show the responses.

Next I want to set my WiFi's SSID. My command is:

set wlan ssid TP_LINK_B3DFFE
AOK
<4.00>

Next give it your password:

set wlan phrase password
AOK
<4.00>

I want my module to auto-connect to the network when it is powered on, so:

set wlan join 1 
AOK
<4.00>

When the module is working as a HTTP server, I don't want certain command responses to get through to the client. So I turn them off.

set comm remote 0
AOK
<4.00>
set comm open 0
AOK
<4.00>
set comm close 0
AOK
<4.00>

Next I set the port I wish to work on. Because I want to use this as a HTTP server, I set my port to 80:

set ip localport 80
AOK
<4.00>

And finally I need to save my settings and reboot so they take effect:

save
Storing in config
<4.00> reboot
*Reboot*

Now my WyFly module is ready to use! I recommend setting your baud rate higher then 9600, I use 38400 makes pages load faster.

For more information and commands, go to: http://ww1.microchip.com/downloads/en/DeviceDoc/50002230A.pdf

All the best.

Discussions