Wi-Fi - Grid Connect

advertisement
Wi-Fi™
May, 2011
www.rovingnetworks.com
CONFIDENTIAL
Wi-Fi™ Overview
• The Protocol
– Built on the IEEE802.11 standards
– Conformance testing performed by the non-profit
Wi-Fi Alliance (formed 1999)
• 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
• 34% laptops
• 15% Wi-Fi connected 3DTVs
• Embedded Systems
– Evangelizes on the huge availability of „hotspots‟
– Provides data with a ultra low cost transport
www.rovingnetworks.com
CONFIDENTIAL
Wi-Fi™ Overview
• Roving‟s Wi-Fi Solution
– Industry‟s lowest power, complete systemon-module solution
• 4uA Sleep
• 30mA Rx
• Tx variable depending on PA options
– Compact surface mount design
– Quick and simple to integrate
– Complete TCP/IP solution – No external
processor or drivers required
•
Feature rich, robust firmware
•
Standard build: Serial Port Profile
•
Extensions:
–
WebScan™
–
Sensor
www.rovingnetworks.com
CONFIDENTIAL
Firmware
May, 2011
www.rovingnetworks.com
CONFIDENTIAL
Roving Firmware
• Standard firmware
– Simplifies customer design
– No register level configurations
– Manages standard TCP/IP services
• e.g. HTTP, DHCP, FTP
• Firmware extensions
– Builds on the robust standard firmware
– Provides application specific extensions
• Sensor
– Remote provisioning
– Automatic sensor data acquisitions
– Data logging
• WebScan™
– RTLS (Real Time Location System)
www.rovingnetworks.com
CONFIDENTIAL
Firmware Extensions
• Sensor
– Real time sensor monitoring
• Makes use of the Roving Silicon
• Monitors I/O and ADC‟s status
• Data Logger:
– Stores data in the event of disconnection
from an access point until reconnection
where data can be sent to a server
• Allows for remote provisioning
• Allows for remote software upgrade
www.rovingnetworks.com
CONFIDENTIAL
Firmware Extensions
• WebScan
– RTLS : Real Time Location System
• Makes use of the Roving Silicon
• Uses I/O, ADC‟s, RFID and timers for
wakeup and data generation purposes
• Measures RSSI levels for triangulation
• Creates full data packet for server upload
www.rovingnetworks.com
CONFIDENTIAL
Firmware Extensions
• WebScan
Example Application:
•
•
•
•
•
•
Goods are monitored by a tag
attached to the pallet
Pallets arrive at docking bay A
Tag wakes by n MAG exciter
positioned near the docking bay
door.
Tag probe for access points and
measures their RSSI level
The RSSI data is sent by the tag, to
the company‟s server via Wi-Fi.
Tag also reports logged data
•
•
•
www.rovingnetworks.com
CONFIDENTIAL
Refrigeration truck
temperatures
Tag wake up reasons
Battery life
Wi-Fi Lab - Introduction
May, 2011
www.rovingnetworks.com
CONFIDENTIAL
Agenda
• Introducing WiFLY
– Firmware
– Hardware architecture
– Capabilities
• Hands-On WiFi Labs
–
–
–
–
–
–
Association and UDP
TCP connections and embedded applications
Roaming and FTP
HTML client and sensors
Location tracking (optional)
AdHoc and further FTP (optional)
• Resources
www.rovingnetworks.com
CONFIDENTIAL
Data Mode and Command Mode
A
B
UART
WiFLY
Module
Wi-Fi
$$$
Command
Mode
•
Data Mode (Default State)
– The WiFLY 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 over WiFi is read from the UART
Command Mode ($$$)
– Special configuration mode entered by $$$
•
Used to assign data such as SSID, pass phrases etc.
www.rovingnetworks.com
CONFIDENTIAL
Command Mode – Configuration Settings
– Performed using ASCII commands
• User Guide:
http://www.rovingnetworks.com/documents/WiFlyGSX-um.pdf
– 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.
www.rovingnetworks.com
CONFIDENTIAL
Command Mode - Syntax
– Commands use a keyword followed by
additional information
– Command rules
• Case sensitive
• Spaces cannot be used, a „$‟ is a
substitute.
e.g. “MY NETWORK” = “MY$NETWORK”
– Shorthand's can be used
•
•
•
•
set uart baudrate 115200
set uart b 115200
set u b 115200
s uart baudrate 115200
www.rovingnetworks.com
valid
valid
valid
NOT valid.
CONFIDENTIAL
Command Mode - Keywords
– Set: Immediate effect, permanent if saved to config file
–
–
–
–
Set Command
Function
AdHoc
controls the adhoc parameters
Broadcast
controls the broadcast hello/heartbeat UDP message
COMM
communication and data transfer, matching characters
DNS
DNS host and domain
FTP
FTP host address and login information
IP
IP settings
Option
optional and not frequently used parameters
Sys
system settings such as sleep and wake timers
Time
Real time clock settings
UART
serial port settings such as baudrate and parity
WLAN
wireless interface, such as SSID, chan, and security options
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.
www.rovingnetworks.com
CONFIDENTIAL
Hardware Architecture – Roving‟s Key Features
• 2.4 GHz IEEE 802.11b/g TRx
• Ultra low-power consumption
• 4uA sleep
• 40mA RX/Connected
• 200mA max TX
• Sparc 32 bit micro
• Embedded TCP/UDP/IP
stacks
• Hardware interfaces
• UART : 1 Mbps streaming
• SPI slave : 2.7 Mbps
streaming
• 10 GPIOs
• 8 analog sensor inputs
• 14bit, 35uSec frequency
• 0 to 1.2V
• Security – HW encryption
enigine
• WEP128
• WPA-PSK
• WPA2-PSK (TKIP and
AES)
• Real-time clock
• 1MB flash memory for data
logging
• 2KB NV RAM
• Battery boost regulator
• Status and control
www.rovingnetworks.com
CONFIDENTIAL
Hardware Architecture – Roving Silicon
www.rovingnetworks.com
CONFIDENTIAL
Hardware Architecture – Development Environment
www.rovingnetworks.com
CONFIDENTIAL
Wi-Fi Lab
May, 2011
www.rovingnetworks.com
CONFIDENTIAL
Lab Prerequisites
• Hardware
– Complete RN-134K or RN-174K evaluation kit
– Configured Access Point (AP)
• Security: WEP-128, WPA-TKIP or WPA2-AES
– FTP server to upload data and store data on
• Utility Software
– Available from http://www.rovingnetworks.com support page
– TeraTerm
:terminal emulator
– PortPeeker
:packet sniffer
www.rovingnetworks.com
CONFIDENTIAL
Lab 1: Association and UDP
• Lab Overview
–
–
–
–
–
–
–
–
Infrastructure and AdHoc networks
Hardware setup
Configuration parameters and factory resets
Scan / Join / Authentication
Broadcast UDP
Device name
Sensor mask
UDP auto-pair
www.rovingnetworks.com
CONFIDENTIAL
Lab 1: Association and UDP
192.168.0.3
Roving
Device
174.201.25.16
192.168.0.1
Access Point
DHCP server
192.168.0.2
Roving
Device
To internet
Roving
Device
Infrastructure Networking
169.254.1.2
– Security modes supported
•
•
•
•
WEP 64, WEP 128 OLD / NOT SECURE
WPA1 TKIP
WPA2 AES Has not been compromised
Enterprise not supported at this time
– Finding devices on the network
www.rovingnetworks.com
CONFIDENTIAL
Roving
Device
169.254.1.1
169.254.1.3
169.254.1.3
Roving
Device
Adhoc Networking
Roving
Device
Lab 1: Hardware Setup
Connecting the Evaluation board
– Connect the WiFly kit to your computer
– Connect the battery
• Blue LED will light up (RN-134 only)
• Green LED should blink slowly
– Use the device manager to find the
assigned COM port
www.rovingnetworks.com
CONFIDENTIAL
Lab 1: Configuring the Module through the UART
Launch command mode
– Run Tera Term
– Open the assigned COMM port
• Serial port settings: 9600 baud,
8 bits, No Parity, 1 stop bit
– Type $$$
– Module will respond with <CMD>
Review and reset the configuration
– Check the config and f/w version
• get e
• ver
– Perform factory reset
(will start the module in a known state)
• factory R
• reboot
www.rovingnetworks.com
CONFIDENTIAL
Lab 1: Joining/Associating with a Networks
Search for networks
– Enter command mode ($$$)
• scan
Join a network
•
•
•
•
join # 1 (remember the spaces)
leave
join <SSID string> e.g. RovingNET
leave
Auto join a network with persistent
configurations
•
•
•
•
set wlan ssid <string>
set wlan pass <string>
save
reboot
TIP: If the Network is secure you must set the pass
phrase first with the “set wlan pass <string>” command
before trying to join the network
www.rovingnetworks.com
CONFIDENTIAL
Lab 1: Interim Summary
The lab, so far, configured the module via the UART
(in command mode)
Using Port Peeker we can see what happens at the Wi-Fi side
www.rovingnetworks.com
CONFIDENTIAL
Lab 1: Configure & Capture UDP with Port Peeker
Associate PC with the same AP as
the module
– Enter command mode, retrieve module‟s
IP address (see previous slides)
– Ensure PC is on the same subnet
Launch & configure Port Peeker
–
–
–
–
Click „configure‟
Set port number „55555‟ (default)
Set protocol to „UDP‟
Click „OK‟
Start UDP packet capture
– Click „start‟
– If both PC and module and module are on
the same subnet, you will see the
broadcast packets
– With multiple nodes on the network
remember to look for YOUR IP address.
www.rovingnetworks.com
CONFIDENTIAL
Lab 1: UDP Broadcast
UDP broadcast are sent by the module at the
specified intervals.
A UDP broadcast contains information that can
identify a WiFly module on the network.
• Setting the UDP broadcast interval
– Enter command mode
• get broadcast
(observe current interval)
• set b i 3
(b=broadcast, i=interval)
• save and reboot
– Review UDP messages in Port Peeker
• Enable sensors data in a UDP broadcast
– Enter command mode
• set q s 0xff
(set sensor mask)
• save to make persistent
– reboot is not required
– Review UDP messages in Port Peeker
•Sensor data highlighted
www.rovingnetworks.com
CONFIDENTIAL
Lab 1: Setting the Device Name
Device names can be used to identify a product on a
network.
A Device ID can be appended to the UDP broadcast
message
• Setting the Device ID
– Enter command mode
• get option
• set o d RockAndRollWiFi (o=optional, d=deviceID)
• save and reboot
– Review UDP messages in Port Peeker
• Setting the Broadcast UDP port
– Enter command mode
• get broadcast
• set b p 50000
(b=broadcast, p=port)
• Save and reboot is not required.
– Remember to reconfigure PortPeeker to listen for UDP
packets on port 50000
– Review UDP messages in Port Peeker
TIP: The UDP broadcast is on by default to turn it off
set the interval to 0
www.rovingnetworks.com
CONFIDENTIAL
Lab1 – Sending UDP packets
UDP mode is not enabled by default on modules
Set the remote host, port and protocol to send UDP
packets
– Enter command mode
• factory R
• Associate with your AP
• set ip host <IP address of your computer>
• set ip remote 50000
• set ip proto 1 (ip protocol bit mask 1 = UDP)
• set comm timer 1000 <<< try 10 see the change
• get ip
• save and reboot
– Type any characters and they will appear in
PortPeeker
Bit Position
0
1
2
3
4
Protocol
UDP
TCP Server & Client (Default)
Secure (only receive packets with IP address
matches the store host IP)
TCP Client only
HTTP client mode
TIP: The IP protocol value is a bit mask so you can
enable both TCP and UDP messages.
www.rovingnetworks.com
CONFIDENTIAL
Lab 1: UDP Auto Pairing Mode (Optional Slide)
Using a similar concept to Bluetooth pairing, IP addresses can be stored
so a module can quickly sending UDP messages.
To perform this lab, 2 modules are required
•
On module #one, clear the host IP address, port and set auto pair
mode.
– Enter command mode
• set ip host 0.0.0.0
• set ip remote 2000
• set ip local 2000
• set ip flag 0x40
• save and reboot
•
On module #two, set the host IP and port of the first module
– Enter command mode
• set ip host <module #one IP address>
• set ip remote 2000
• set comm timer 1000
• save and reboot
– Type characters, they will appear in the terminal window of module
#one
•
Now the magic, from module #one
– Type characters and they should appear on the terminal window of
the second module
www.rovingnetworks.com
CONFIDENTIAL
Lab 1 : Conclusion
• The RN-134K or RN-174K with a terminal emulator and
serial cable can make a simple but highly effective
development environment.
• Joining a network is as simple process
• A broadcast UDP can be used to find modules on a
network through the use of device names and MAC
addresses
• The module sends UART data as UDP packets when
associated to a network and in UDP mode.
www.rovingnetworks.com
CONFIDENTIAL
Lab 2: TCP
• Objective:
–
–
–
–
–
–
Connect from the module to a remote host using TCP
Connecting to the module from remote host using TCP
TCP modes
Auto connect features
Alternative functions of GPIOs
Forwarding TCP packets based on events
• Prerequisites:
–
–
–
–
–
RN-134K set as in previous lab
Module associated to Access Point (AP)
Computer associated to same AP
Telnet client (TeraTerm)
PortPeeker application on computer
www.rovingnetworks.com
CONFIDENTIAL
Lab 2: TCP Connections
Remote
Host
RN-134
192.168.1.50
Listen on port 2000
Access Point
DHCP server
192.168.1.200
Listen on port 5000
TCP connections are Point to Point
Provide reliable, guaranteed, in order delivery of data
Also known as sockets
open 192.168.1.200 5000
open 192.168.1.50 2000
WiFly module opens TCP connection
Remote Host opens TCP connection
•
•
•
•
•
•
•
Sensing Applications
Sending data to web server
Data acquisition systems
Fleet management
www.rovingnetworks.com
Industrial control
Home automation
Universal Remotes
CONFIDENTIAL
Lab 2: Setup PortPeeker
•
Associate computer with your AP
•
Launch PortPeeker on your PC
•
Configure PortPeeker:
–
Click on “Configure”.
•
–
Set port number 5000
•
–
•
Note your PC‟s IP address form the „Interface‟
box
This port number much match remote port of
the WiFly module
Set protocol to TCP
Click on “Start” to capture TCP
packets
www.rovingnetworks.com
CONFIDENTIAL
Lab 2: Opening TCP connection from WiFly module
With WiFly module connected to the PC
over USB-Serial cable, open Tera Term on
the serial COM port
•
Before proceeding restore the WiFly
module to factory default parameters
–
–
–
–
•
•
enter command mode
factory R
Associate with your AP
save and reboot
To open TCP connection
–
open <IP addr of remote host> 5000
–
You will see *OPEN* on Serial Port (Tera Term
window) and a packet with *HELLO* message on
PortPeeker
To close the TCP connection:
–
–
–
Get into command mode
close
You will see close string *CLOS* on TeraTerm
www.rovingnetworks.com
CONFIDENTIAL
Lab 2: Connecting from Remote Host to WiFly module
•
From command mode get the IP address of
module
–
•
get ip
Open a Telnet connection from PC using
TeraTerm (use existing instance):
–
–
–
–
–
–
Click on File New connection
Select “TCP/IP”
Select Service as Telnet
In “Host” field, type in the IP address of module from
above step
TCP port # is 2000 (default port on which listens)
Click OK
•
*HELLO* message will be shown on Telnet
window indicating successful TCP connection
•
Start typing in Telnet window, data will appear
on the Serial Port window and vice versa
•
Remote configure of module over telnet is
possible by entering command mode
www.rovingnetworks.com
CONFIDENTIAL
*HELLO*
Lab 2: TCP modes
• Module supports three TCP modes
– 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
– TCP client ONLY mode
• ONLY initiates TCP connections. Cannot accept incoming connections
– Secure mode
• ONLY receives packets from a host that matches the stored host
IP address
Refer to user manual for more details on TCP modes
www.rovingnetworks.com
CONFIDENTIAL
Lab 2: TCP Client Mode
•
Set up WiFly module in TCP Client mode
using:
–
–
set ip proto 8
save and reboot
•
Open a new telnet connection to the
module from TeraTerm
•
The second connection will be refused
This indicates TCP_Client mode works
correctly
www.rovingnetworks.com
CONFIDENTIAL
Lab 2 - Auto Connect Feature
•
The module can be configured to automatically open a TCP connection to a remote
host on power up or waking from sleep.
The auto connect function is controlled by the autoconn setting
–
–
–
•
set ip host <host IP address>
set ip remote <port>
Once a TCP connection is opened, it can be closed in several ways
–
–
–
•
// Attempts to open TCP connection immediately once only
// Attempts to open TCP connection every x seconds
// Attempts to open TCP connection once and go back to sleep immediately when
connection is closed
Auto connect requires remote host‟s IP address & port # to be stored in the module
–
–
•
set sys auto 1
set sys auto x
set sys auto 255
close command
Idle timer
remote host
The idle timer closes the TCP connection after a preset # of seconds with no activity
(no Tx or Rx) on the TCP link
–
set com idle <x seconds>
www.rovingnetworks.com
//Closes the TCP connection after x seconds of inactivity
CONFIDENTIAL
Lab 2: Auto Connect Feature (Timers)
•
Setup module to attempt a TCP connection every 10 seconds, then drop the
TCP connection after 3 seconds of no activity.
–
–
–
–
–
–
set ip host <IP address>
set ip remote 5000
set sys auto 10
set comm idle 3
save
reboot
*OPEN**CLOS*
…
•
On PortPeeker the connection will be seen to open and close
•
In TeraTerm, you will see the open and close string when each connection is
opened and closed
www.rovingnetworks.com
CONFIDENTIAL
Lab 2: Alternative functions of GPIOs
•
GPIOs 4, 5 and 6 are used by firmware to blink status LEDs on eval board.
(For standard functions of LEDs, refer to section 2.4 in user manual)
GPIO
•
Description
4 (GRN)
output
HIGH once associated, authenticated and have IP address.
5 (RED)
input
Set HIGH to trigger TCP connection, LOW to disconnect.
6 (YLW)
output
HIGH when connected over TCP, LOW when disconnected.
The micro controller can open or close the TCP connection to the stored remote host
by driving GPIO 5 HIGH or LOW
–
•
Function
This requires a hardware configuration that is not part of this lab
The micro controller can monitor the TCP connection status by reading GPIO 6
–
–
HIGH
LOW
= connected
= not connected
www.rovingnetworks.com
CONFIDENTIAL
Lab 2: Alternative functions of GPIOs
•
To enable alternative functions:
–
–
–
–
–
•
Once the module associates to AP
–
–
–
•
set wlan ssid <blah>
set sys iofunc 0x70
save
reboot
LEDs on the eval board will not come ON
Associate with your AP
save and reboot
Green LED ON (GPIO4)
Connect / Disconnect TCP connection
–
–
–
–
–
–
Go into command mode
open <host ip><port>
Red LED blinks and connection is closed because on the RN-134 board, GPIO 5 is pulled to GND
Go into command mode
leave
// disassociate from the Access Point
Green LED OFF
www.rovingnetworks.com
CONFIDENTIAL
Lab 2: Setting Comm Strings
•
A microcontroller can look for the comm strings on a UART as an indication of
TCP connection status
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
–
factory Reset
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 HAPPY_NEW_YEAR
save and reboot
Enter command mode
open
See open string in TeraTerm
See remote string in PortPeeker
Enter command mode
close
See close string in TeraTerm
Tip:
The micro controller can read the open and close strings on the UART to determine the status
of TCP connection
www.rovingnetworks.com
CONFIDENTIAL
Lab 2: Forwarding TCP packets
•
When data is written to the module‟s UART, TCP packets are forwarded based
on the following three events:
– Flush timer
– Flush size
– Match character
A TCP packet is sent out when any of the three events are met
•
The three parameters are logically „OR‟d to determine when a TCP packet is
sent out.
When configured correctly, the module can be optimized for low latency or for
high throughput.
– For low latency, a lower value of flush timer and flush size is recommended
– For high throughput, a higher value of flush timer and flush size is recommended
Tip:
The module tries to automatically optimize for bandwidth by increasing the default flush
size with higher baud rates
www.rovingnetworks.com
CONFIDENTIAL
Lab 2: 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 c t 0
(why do we send this command ?)
set comm match 65
•
–
–
–
–
•
This parameter expects either an ASCII decimal
character or a HEX value of the match character. {65=CAPS A}
save
open
Type 12345678A
A TCP packet will be sent out after you type the character “A”.
Observe the packet in PortPeeker
What do you learn from using the „get c‟ command?
www.rovingnetworks.com
CONFIDENTIAL
Lab 2: Conclusion
• The module can open a TCP connection to a remote host and
can accept incoming connections from a remote host
• Auto connect is used to automatically open a TCP connection
• Idle timer can be used to automatically close the TCP
connection
• Alternative functions of GPIO allow control and monitoring of
TCP connections from a micro controller
• Comm open, close and remote strings can indicate the status
of the TCP connection
• TCP packets are forwarded based on:
•
•
•
packet size
match character
flush timer
www.rovingnetworks.com
CONFIDENTIAL
Lab 3: Association/Roaming and FTP
• Objective:
– Wake and sleep timers
– Auto join
– Roaming configuration
• Linkmon/IP flags
– FTP
• Prerequisites:
– It is assumed that the user has completed lab 1 and 2.
– The eval board and the computer are set up as described in lab 1
www.rovingnetworks.com
CONFIDENTIAL
Lab 3: Association/Roaming
Where in the World Wide
and Web
FTP are you?
192.168.0.1
Roving
Device
www.google.com
192.168.0.2
74.125.19.103
10.10.10.2
10.10.10.3
Access Point
SSID RovingNet
DHCP server
DNS server
Internet
10.10.10.3
101.11.2.15
Worldwide
Web
135.201.25.15
•
Local Network
10.10.10.1
Password required depending on security
Multiple security modes
Multiple AP with same SSID and/or password
Each Wi-Fi device needs it‟s own unique IP address
–
–
•
To internet
Intra-net
Module associates to an Access Point based on SSID
–
–
–
•
Router
DHCP server
Gateway
Provided by DHCP server
Gateway bridges multiple networks – typically Internet with Intranet
Dynamic Name Service (DNS)
•
Maps URL (www.google.com) to an IP Address 74.125.19.103
www.rovingnetworks.com
Access Point
SSID RovingNet1
Bridge
CONFIDENTIAL
10.10.10.4
Roving
Device
Lab 3: Wake and Sleep Timers
There are several ways to wake up a module including,
the FORCE WAKE signal, sensors or the internal timers.
•
Before proceeding restore the factory default
parameters and the training AP
–
–
–
–
•
Set wake timer –
# of seconds in deep sleep mode before wake up
–
•
enter command mode
factory R
Associate module with AP
save and reboot
set sys wake 10
Set the sleep timer –
# of seconds before entering deep sleep mode
–
–
–
set sys sleep 5
save and reboot
LEDs cycle on and off (except blue),
see in TeraTerm the module reboot on wake up
www.rovingnetworks.com
Tip: do not set the sleep timer to be less than
2 seconds or it becomes difficult to break into
command mode and reconfigure the module
with out it going to sleep before finishing
CONFIDENTIAL
Lab 3: Join modes
It is useful in many situations to have the module
attempt to associate to a network automatically.
Association is controlled with the join command or
the setting the join parameter.
•
Turn off auto join and join manually
–
–
–
–
–
–
–
–
•
Enter command mode
factory R & reboot
Associate the module with your AP
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 garbage
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)
TIP: If the Network is secure you must set the pass phrase first with the
“set wlan pass my_pass” command before trying to join the network
www.rovingnetworks.com
CONFIDENTIAL
Lab 3: Roaming (Optional Slide)
Roaming mode allows the module to wake up, search for
nearby access points, make a connection, off load data
and return to sleep.
Roaming is used in asset tracking, fleet management and
remote sensor applications
•
Combine broadcast UDP, wake timers and auto join
–
–
–
–
–
–
–
–
–
Enter command mode
factory R and reboot
set broad interval 3
set opt device <Your Unique Name>
set wlan join 2
set wlan auth 0
set sys sleep 15
set sys wake 5
save and reboot
•
Open PortPeeker to receive UDP broadcast messages (Lab 1)
•
Confirm modules broadcast UDP message
•
Take module close to the AP_SSID1 access point
•
Next, move to near the AP_SSID2 access point.
–
In PortPeeker you will see the AP MAC address in the broadcast
UDP message change
www.rovingnetworks.com
CONFIDENTIAL
LAB 3: FTP Update (REQUIRES internet access)
The FTP client on the module is used for
updating firmware and for putting/getting data
files.
By default the FTP server, user /pass is set to
the roving server on the internet.
Simply associate to a network with internet
connectivity and type „ftp update‟
• Use the local FTP server
–
–
–
–
Enter command mode
factory R
Associate the module with your AP.
save and reboot
• Update the firmware
–
–
–
–
–
–
Enter command mode
ftp update
ver
reboot
Enter command mode
ver
TIP: After downloading the new firmware, it is recommended
to restore the module to factory defaults before using it
www.rovingnetworks.com
CONFIDENTIAL
LAB 3: Setting the firmware boot image
Firmware is stored on the embedded flash
memory file system.
The boot image is the version of firmware
that the module is currently running.
After a successful firmware update the boot
image will be changed to the new firmware
file
• View the files on the flash file system
–
–
Enter command mode
ls
• Change the boot image
–
–
–
Enter command mode
boot image <file num>
reboot
www.rovingnetworks.com
CONFIDENTIAL
LAB 3: FTP put and get
An FTP client can stream files to and from an FTP server, useful
in data logger applications.
FTP servers can accept multiple clients concurrently.
•
Configure the FTP setup
–
–
–
–
–
–
–
–
–
•
Enter command mode
factory R & reboot
Associate the module with your AP
set ftp address <FTP_server_address>
set ftp user <FTP_server_login>
set ftp pass <FTP_server_login>
set ftp dir <FTP_server_directory>
set ftp timer 20
save and reboot
.
{ftp svr addr}
{roving}
{Pass123}
{public}
Create and read back a file on the server
–
–
–
–
Enter command mode
ftp put <file name>
Type some characters, then wait until you see the *CLOS*
ftp get <file name>
www.rovingnetworks.com
CONFIDENTIAL
Lab 3: Conclusion
•
Sleep and wake timers allow a module to go into deep sleep power
savings mode and periodically connect to a network
•
Roaming modes allow a module to connect to an AP with the
strongest signal that matches the SSID or authentication mode
•
FTP can be used to update the firmware on a module
•
FTP put and get commands can transfer files
•
FTP put combined with sleep/wake & roaming is an ideal solution
for data logging applications.
www.rovingnetworks.com
CONFIDENTIAL
Lab 4: HTTP client
• Objective:
– Post data to web server
• Uses built-in feature. No need for external processor
– Configure HTTP client mode
– Periodically send sensor data a web server
– Wake on UART data
• Prerequisites:
–
–
–
–
Hardware as in previous labs
Module associated to Access Point (AP) with internet connectivity
Tera Term running on PC
Web server configured to accept HTTP messages (Roving Website)
www.rovingnetworks.com
CONFIDENTIAL
Lab 4: Solutions Architecture
Host Web
Server
Application
RN-370
GPS
Unit
AP
RN-370
Weather
Station
Internet
RN-370
Remote
Sensors
AP
RN-370
Weighing
Gauge
www.rovingnetworks.com
CONFIDENTIAL
Lab 4: Enabling HTTP client mode
• HTTP client mode is disabled by default. To enable
– set ip proto 18
• In this mode, the WiFly module will connect to the web server
using either the IP address or URL
• The web server listens on port 80 (default web server port) for
incoming connections
• For each incoming request, the web server responds with “200
OK” then closes the connection
www.rovingnetworks.com
CONFIDENTIAL
Lab 4: Auto Posting sensor data
•
In HTTP client mode the module sends the following request message
–
–
•
GET /server.php?value=0F3000001111222233334444555566667777\n\n
This request message is comprised of the comm remote string and sensor readings
To configure HTTP client mode and request message
–
–
–
–
–
–
–
–
–
–
–
–
Go into command mode
Associate the module to your AP
set ip proto 18
set ip host 0
set dns name www.rovingnetworks.com
set ip remote 80
set comm remote GET$/server3.php?value=
set q sensor 0xff
set option format 7
save and reboot
Enter command mode
open
Format:
2 Bytes
GPIO
0F30
// Enable HTTP and TCP protocols
// Set IP address if known
// Set DNS name if not
// standard web server port
// $ is replaced by space character
// sample all sensors inputs
// send header and sample sensor data
Chan 0
Chan 1
Chan 2
Chan 3
Chan 4
Chan 5
Chan 6
Chan 7
0000
1111
2222
3333
4444
5555
6666
7777
www.rovingnetworks.com
CONFIDENTIAL
Lab 4: The Web Server
•
Open your web browser
–
•
The PC must be associated with your AP
connected to the internet
In address bar type
www.rovingnetworks.com/result.htm
–
–
Scroll to the bottom of the log to see the
data
All the data from the module looks the same
*OPEN*HTTP/1.1 200 OK
Date: Fri, 19 Nov 2010 19:24:07 GMT
Server: Apache
X-Powered-By: PHP/5.2.13
Connection: close
Content-Type: text/html
Server accepted values <br />
ID: 0<br />
VALUE: 0D16CF2907ED3EB640AB07E607F4321C3219
RTC: 0
*CLOS*
www.rovingnetworks.com
CONFIDENTIAL
GPIO values
Sensor Data
Lab 4: Add Device Name and RTC to Sensor Data
It is useful to append the Device ID and RTC
value to sensor data so a server can identify
when and for whom data came
–
Device String: Appends &id= < value>, where value is the
device ID string set with set opt device <string>
–
Real Time Clock: Appends &rtc=<time>, where time is real
time clock value in message as 32 bit HEX value in format
aabbccddeeff
• Turn off auto connect
–
–
–
Go into command mode
set sys auto 0
save and reboot
*OPEN*SEND-WEBPOST
HTTP/1.1 200 OK
Date: Mon, 06 Dec 2010 17:56:28 GMT
Server: Apache
X-Powered-By: PHP/5.2.13
Connection: close
Content-Type: text/html
Server accepted values <br />
Device ID
ID: servertest<br />
VALUE: 0D16CF2908043E854020080108043236323A
RTC: 3ad82
*CLOS*
Real Time Clock
• Append device name and RTC
–
–
–
–
–
TeraTerm Output:
Go into command mode
set option device <string>
time
// get network time
set option format 31
save and reboot
• Post the data
–
–
Go into command mode
open
www.rovingnetworks.com
CONFIDENTIAL
Lab 4: Auto posting UART data
•
The module is capable of waking on UART data, associating
to an AP and sending the request message containing the UART data.
–
–
–
–
–
–
–
–
–
–
–
–
–
•
factory R & reboot
Associate the module to your AP
set ip proto 18
set ip host 0
set dns name www.rovingnetworks.com
set ip remote 80
set comm remote GET$/server3.php?value=
set uart mode 2
set sys trigger 1
set sys sleep 10
set option format 1
set comm timer 2500
save and reboot
// set HTTP client mode
// IP address of web server
// OR DNS name
// web server port
// set request message header
// automatically connect using trigger mode
// wake up on uart RX data
// Put WiFly module to sleep after 10 seconds
// sends out HTTP header
// allows multiple keystrokes per request
In Tera Term, type characters to wake up the module,
associate to the AP and send data as a HTTP message to the web server
–
Note you can not send both sensor data and UART data in the same request message
www.rovingnetworks.com
CONFIDENTIAL
Lab 4: Auto posting serial data
When the serial UART data comes in, the module auto
connects to the web server, and automatically send:
GET /server3.php?value=<users serial data> \n\n
OPEN*SEND-WEBPOST
HTTP/1.1 200 OK
Date: Mon, 06 Dec 2010 18:25:36 GMT
Server: Apache
X-Powered-By: PHP/5.2.13
Connection: close
Content-Type: text/html
Note:
Server accepted values <br />
ID: 0<br />
VALUE: oving
RTC: 0
*CLOS*
Data with first byte missing
www.rovingnetworks.com
Company Confidential
The first byte of data will be dropped since
the module needs time to initialize before it
can start sending data over the wireless
interface.
To avoid this, the module should wake up on
CTS signal using set sys trigger 2 or send
the first byte twice.
CONFIDENTIAL
Lab 4: Conclusion
• The WiFly module supports HTTP client mode natively
• When configured, the module can append
–
–
–
–
–
GPIO values
Sensor data
Real-time clock
Device name
UART data
• The module can be configured to wake up on UART data
– this may result in dropping the first byte
– waking up on CTS is a better option
www.rovingnetworks.com
Company Confidential
CONFIDENTIAL
Download