Seeed Wifi Shield

The seeed wifi is a arduino sized shield. The shield uses the RN171 chip. The official page is http://www.seeedstudio.com/depot/wifi-shield-p-1220.html

Hello World

Import programSeeed_WiFi_Shield

Example program for the SeeedStudio WiFi Shield V2.0, based on UART serial port connectivity (D0/D1 pins). This program connects to WiFi hotspot, obtains an IP using DHCP and downloads http://mbed.org/media/uploads/mbed_official/hello.txt

Library

Import libraryWiflyInterface

Fork of the original WiflyInterface by mbed, merged with fixes for the Seeedstudio Wifi Shield.

Pinout

Datasheet

http://www.seeedstudio.com/wiki/Wifi_Shield_V1.1

Notes

This Wifi Shield utilizes a RN171 wifi module to provide ethernet connection. It uses serial port SPI or UART to communicate with the mbed. Hence it only uses two pins. The module can be entirely configured using ASCII human readable commands via the SPI or UART link which makes it very user friendly.

Features

  • Arduino compatible hence can fit directly onto a NXP, Freescale and ST Nucleo boards
  • Host Data Rate up to 1 Mbps for UART, 2 Mbps over SPI slave
  • UART serial port of RN171 on the Shield can be connected to mbed by jumpers
  • SPI pin of RN171 is just breakout
  • Secure WiFi authentication WEP-128, WPA-PSK (TKIP), WPA2-PSK (AES)
  • Built-in networking applications: DHCP client, DNS client, ARP, ICMP ping, FTP, TELNET, HTTP, UDP, TCP

Hardware

The most simplistic connection possible is:

seeed pinMbed pinComment
3.3VVOUT
GNDGND
WIFI_RXD1Exact pin on the shield configurable see below for details
WIFI_TXD0Exact pin on the shield configurable see below for details
GPIO 6any DigitalInStatus indicator pin. Optional. It is a hole on the shield. Extra jump lead required
RSTany DigitalInOptional

The shield comes as a kit which you have to solder together. There's 3 columns of 8 pins on the board (red square in the photo above). They are used to configure the RT and TX pins for the chip. The first column is connected to the RX of the chip and the last column the TX. The middle column is connected to digital pin 0-7 respectively. By connecting one of the pins in the middle column to RX and another to TX the pins can be configured.

The green area in the above photo point out where the GPIO_6 pin is located on the board.

Hello World

Import program

00001 #include "mbed.h"
00002 #include "WiflyInterface.h"
00003 
00004 Serial pc(USBTX, USBRX);
00005 
00006 /* wifly object where:
00007 *     - p9 and p10 are for the serial communication
00008 *     - p25 is for the reset pin
00009 *     - p26 is for the connection status
00010 *     - "hotspot_name" is the ssid of the network
00011 *     - "password" is the password
00012 *     - WPA is the security method
00013 */
00014 WiflyInterface eth(p9, p10, p25, p26, "hotspot_name", "password", WPA);
00015 
00016 int main()
00017 {
00018     int s = eth.init(); //Use DHCP
00019 
00020     if( s != NULL ) {
00021         printf( "Could not initialise. Will halt!\n" );
00022         exit( 0 );
00023     }
00024 
00025     s = eth.connect(); // set up the chip and join the network
00026 
00027     if( s == false ) {
00028         printf( "Could not connect. Will halt!\n" );
00029         exit( 0 );
00030     } else {
00031         // print the IP address of the shield
00032         printf( "IP: %s\n", eth.getIPAddress() );
00033     }
00034 }

Because the chip on the board (RN171) is the same in the wifly module the library WiflyInterface will mostly do the trick. The library has been forked to add in some delays necessary to make the module work.

UART and USB debugging

To use this with the ST Micro range of Nucleo boards you will need to remove SB13 and SB14 then bridge SB62 and SB63. This will enable the processor to communicate with the WiFi module using the default serial connection, but will stop the comms going via the ST-Link and USB. This also applies to other boards where soldering is not required though all communication stops when the WiFi module is initialized along with Serial over USB. An alternative UART must then be used for debugging purposes.

Manual Configuration

The chip is configured and controlled by human readable commands. The chip is very powerful and can perform complicated tasks without intervention from the mbed. A full list of commands can be found here.

The following program will allow you to issue commands from your pc through the usb serial of mbed directly to the wifi shield.

Import programWifly_configure

Configure wifly module

Load the program into the mbed then start a serial monitor such as TeraTerm

  • To start the interactive command mode type $$$
    • the response is CMD
  • If you don't see the things you type echoed back to you on your screen try
  • set uart mode 0\r This will enable echo
  • To set up a connection
  • set wlan ssid my_network\r
    • the response is AOK (AOK has replaced set... local echo activated)
  • set wlan phrase my_password\r (I use set wlan phrase because my network use WPA as security. If you have a WEP security, you have to use set wlan key your_password)
    • the response is AOK
  • join\r
    • the response is quite long but Associated! means that you are connected You can then find commands in the manual that saves the setting in the internal memory to be recalled later.

Resources

Official Wiki: http://www.seeedstudio.com/wiki/Wifi_Shield_V1.1 Wifly library page: http://mbed.org/cookbook/WiflyInterface most of the descriptions on that page apply to this shield as well.

Sample Program

Import programWifly_Xively_HelloWorld

Use Seeed Wifi shield and WiflyInterface to send current time to the Xively Service