WiSnap User Manual 4.41 05282015-ML
Page 11
The
join 1
setting ensures that when the module wakes up, it tries to join the access point that matches the stored SSID,
passkey and channel. Channel =0 (the default) will force auto-scanning. Setting the channel will reduce the time it takes the
WiSnap to find and associate.
Step 2:
Set up the IP address and port number of the remote server, so the WiSnap can connect when it wakes up.
Command
Result
1
set ip host 10.20.20.75
Set the host IP address
2
set ip remote 3000
Set the remote port
3
set sys autoconn 2
Try to connect to the host every 2 seconds
4
save
Save configuration
NOTE:
If autoconn = 1, the WiSnap will only make one attempt to auto connect.
Step 3:
Set the wake up and sleep conditions. By default the adapter will wake whenever there is data written to the serial
interface. You can also configure the device to wake up on CTS, on a PIO or timer. See the command reference for details. We
are going to set this up to wake on a timer then sleep after 2 minutes if there is no connection or if connected and no data has
been transferred for 30 seconds.
Command
Result
1
set sys sleep 120
Sleep after 2 minutes if no connection
2
set sys trigger 2
Wake on CTS
3
set conn idle 30
Disconnect after 30 seconds of no data
4
save
Save all the settings to the config file
5
reboot
Use the new settings
This setup can be tested using TCP server application that opens a socket on port 3000. Port Peeker is a free application that
you can download off the web. It is available at
http://www.linklogger.com/portpeeker.htm
Waiting for the remote host to connect to the serial adapter (listen mode)
In this example we are using a static IP so that the remote host knows where the WiSnap Serial adapter is on the network.
Alternatively you can write your application software to listen for the broadcast UDP packet (automatically sent by
WiSnap by default) to identify the WiSnap Serial adapter and get the IP address and TCP port number that the WiSnap is
listening on.
Step 1:
Set up the wlan properties so the device will connect to the network automatically upon power up. In this example we
want to connect to the wireless network my_network.
Command
Result
1
set wlan join 1
Auto join upon power up
2
set wlan chan 1
Only look on channel 1
3
set wlan ssid
my_network
Network name
4
set wlan phrase
my_secret_code
Pass phrase
Step 2:
Configure the WiSnap static IP address so the remote application can connect, turn off DHCP and set the IP address
and netmask.
Command
Result
1
set ip address 10.20.20.63
Set the IP address
2
set ip localport 5030
Set the local port to listen on
3
set ip netmask 255.255.255.0
Set the IP netmask
4
set ip gateway 10.20.20.1
Set the network gateway
5
set ip dhcp 0
Turn of DHCP