This document provides an overview and instructions for using a Wi-Fi module in a communication PIC microcontroller lab. It defines Wi-Fi and the 802.11 networking standards. It describes the WiFly module and how to configure it, including connecting to wireless networks, setting communication parameters, and forwarding TCP packets. The lab portion involves testing the module on TeraTerm Pro, developing a moving car application, and an Android APK.
2. Wi-Fi Definition
Wi-Fi is the name of a popular wireless networking technology that uses radio waves to
provide wireless high-speed Internet and network connections.
A common misconception is that the term Wi-Fi is short for “Wireless Fidelity“
The Protocol
Built on the IEEE802.11 standards
Wireless Local area Network (WLAN)
Consumer Wi-Fi growth (2009-2010)
158% growth in Wi-Fi consumer electronics
90% Wi-Fi enabled cell phones
3 in 4 consumers considered buying a Wi-Fi enabled device
Embedded Systems
'Evangelizes on the huge availability of “hotspots‟
Provides data with a ultra low cost transport
3. Specification
A computer's wireless adapter translates data into a radio signal
and transmits it using an antenna.
A wireless router receives the signal and decodes it. The router
sends the information to the Internet Ethernet connection.
Wi-Fi communication can transmit and receive radio waves
They transmit at frequencies of 2.4 GHz or 5 GHz.The higher
frequency allows the signal to carry more data.
4. Specification
They use 802.11 networking standards, which come in several flavors
802.11a transmits at 5 GHz and can move up to 54 Mbps. It also
uses orthogonal frequency-division multiplexing (OFDM). This
greatly reduces interference.
802.11b is the slowest and least expensive standard, it transmits in the 2.4
GHz frequency band. It can handle up to 11 Mbps, and it
uses complementary code keying (CCK) modulation to improve
speeds.
802.11g transmits at 2.4 GHz, it can handle up to 54 Mbps. 802.11g is
faster because it uses the same OFDM
802.11n is the newest standard that is widely available. It can achieve speeds
as high as 140 Mbps.
5. Specification
Wi-Fi radios can transmit on any of three frequency bands. Or,
they can "frequency hop" rapidly between the different bands.
Frequency hopping helps reduce interference and lets multiple
devices use the same wireless connection simultaneously.
13 Channels
Android App
12. Data Mode and Command Mode
Data Mode (Default State)
TheWiFLY module is effectively a data pipe
TCP/UDP header are stripped or added transparent to the UART
Data written to the UART is sent out over Wi-Fi
Data received overWi-Fi is read from the UART
Command Mode ($$$)
Special configuration mode entered by $$$ (Default)
Used to assign data such as SSID, IP, pass phrases etc.
13. Command Mode
Entered by $$$
Performed using ASCII commands
Configuration setting are stored in the modules flash
Changes are persistent and are reloaded after power cycling
Changes are kept using the “SAVE” command
Many settings require a reboot to take effect.
14. Command Mode
Commands use a keyword followed by additional information
Command rules
Case sensitive
Spaces cannot be used, a “$‟ is a substitute (Default).
e.g. “MY NETWORK” = “MY$NETWORK”
Shorthand's can be used
set uart baudrate 115200 valid
set uart b 115200 valid
set u b 115200 valid
s uart baudrate 115200 NOT valid.
15. Command Mode
Set: Immediate effect, permanent if saved to config file
Get: Retrieve and display the permanently stored information
Status: Current status of interface, IP address, etc.
Action: Perform actions such as scan, connect, disconnect
File: Upgrade, load and save configuration, delete files, etc.
16. Join Network
Search for networks
scan
Join a network
join # 1 (remember the spaces)
leave
join <SSID string>
leave
Auto join a network with persistent configurations
set wlan ssid <string>
set wlan pass <string>
save
reboot
18. Join modes
Turn off auto join and join manually
set wlan join 0
save and reboot
Go into command mode
join
The module will join the access point
Auto join to any Access Point with open security
set wlan ssid xxx
set wlan join 2
set wlan auth 0
save and reboot
The module will now attempt to join any network that is in open mode (no security)
19. Authentications mode
set wlan auth <value>
You only need to set this parameter if you are using automatic join mode 2, i.e., the
set wlan join 2 command.
20. Channel
set wlan channel <value>
This command sets the WLAN channel, where <value> is a decimal number
from 1 to 13 representing a fixed channel
If you set the channel to 0, the modules performs a scan using the SSID for
all the channels set in the channel mask.
21. Password Phrase
set wlan phrase PASSWORD
This command sets the passphrase for WPA and WPA2 security
modes, where <string> is 1 to 64 characters (64 bytes)
22. Password Phrase
set wlan rate <value>
This command sets the wireless data rate, where <value> is a value shown 0-
15.
Lowering the data rate increases the effective range of the module.
23. Change Device ID
Setting the Device ID
Enter command mode
get option
set o d xxxxxx (o=optional, d=deviceID)
save and reboot
24. Connect to Host (TCP)
Auto connect requires remote host’s IP address & port #
to be stored in the module:
set ip host <host IP address>
set ip remote <port>
TCP port on the module is 2000
TCP client and server mode
Default mode initiates and accepts TCP connections
Currently support only one active connection at a time.
Concurrent TCP connections will be supported in the future
25. Comm. Strings
A microcontroller can look for the comm strings on a UART as an indication of
TCP connection status:
reboot
Associate with your AP
set ip host <Host IP address>
set ip remote 5000
set comm open HAPPY
set comm close HOLIDAYS
set comm remote NEW_YEAR
save and reboot
open
Close
Tip:The microcontroller can read the open and close strings on the UART to determine
the status of TCP connection
26. Forwarding TCP packets
Forwarding packets based on Flush Timer
set comm timer 1000
save
open
Type any text once the TCP connection is opened. After you stop, a TCP packet will
be sent out 1 second later
Forward packets based on a “match character‟
set comm timer 0
set comm match 65
This parameter expects either an ASCII decimal character or a HEX value of the
match character. {65=CAPS A}
save then open
Type 12345678A
A TCP packet will be sent out after you type the character “A”.