Wifi Shield

From GOF_Wiki
Jump to: navigation, search

Contents

Introduction

The Wifi Shield is based on Serial to Wi-Fi module Wizfi210 from Wiznet and compatible with Arduino and its clones. The Wifi Shield offers you a quick, easy, and effective way to add Wi-Fi capabilities to Arduino. The Wifi Shield allows you to achieve Wifi communication via UART by sending AT commands, which is an ideal solution for whom with limited or no Wi-Fi or RF expertise. The Shield supports data rates up to 11 Mbps, and is compliant with 802.11b.

Module:M2012011301

Wifishield001.jpg

Features

Specifications

Communication Protocol UART
Baud rate(default) 38400bps
Radio Protocol IEEE 802.11b/g/n Compatible
Supported Data Rates 11, 5.5, 2, 1 Mbps (802.11 b)
Modulation DSSS and CCK
RF Operating Frequency 2.4 - 2.497 GHz
Networking Protocols UDP, TCP/IP (IPv4), DHCP, ARP, DNS, HTTP/HTTPS Client and Server(*)
RF Output Power (Typical) 8 ± 1 dBm
Security Protocols WEP, WPA/WPA2–PSK, Enterprise, EAP-FAST, EAP-TLS, EAP-TTLS, PEAP
LED Indicators PWR(Green), D2(Blue), D1(Red), D4(Yellow)
Power supply 5V from Arduino board
VBAT 3.3V (for Wizfi210)
Current Consumption 150mA(max)
Mechanic Dimension 68.7mm X53.5mm X 19.6mm
RoHS Yes

(*) is supported by software customizing.

Application Ideas

Appideas.jpg

Hardware Diagram

WIFI shield HWD.jpg

Getting Started

Selectable UART connection

Users can use the jumpers to connect the WIFI_TX and WIFI_RX pins(5V) of Wifi Module to any D0, D1, D4~D7 pin of Arduino.

Wificom1.jpg

Users must be aware that which Digital pin of Arduino connects to WIFI_TX needs to act as Arduino RX pin(Hardware/Software), and which connects to WIFI_RX needs to act as Arduino TX pin(Hardware/Software).

The following figure shows users how to use jumpers to configure UART communication between Wifi Shield and Arduino.

WificomHS.jpg

Indicator LEDs

There are four indicator LEDs(PWR(Green), D2(Blue), D1(Red), D4(Yellow)) on the Wifi Shield, users can know about the working phase of the shield based on the four indicator LEDs. Detailed information please refer to the following table:

LEDs(color) Status Description
PWR(Green) ON Power of the Wifi Shield is on
OFF Power of the Wifi Shield is off
D1(Red)
(GPIO30)
(Serial_RXD)
Blink(-1-) Serial Data Rx
(Data Mode)
Blink(-1-1-) Serial Data Rx
(AT Command Mode)
D2(Blue)
(GPIO31)
(Serial_CONN)
ON Serial-To-WiFi is OK
OFF Serial-To-WiFi is error
D4(Yellow)
(GPIO28)
(Wifi_CONN)
ON Associated
OFF Not Associated


Status PWR D1(GPIO30) D2(GPIO31) D4(GPIO28)
ON (on board 5v)Power On - Serial-To-WiFi OK Associated
Blink(-1-) - Serial Data Rx
(Data Mode)
-
Blink(-1-1-) - Serial Data Rx
(AT Command Mode)
- -
OFF (on board 5v)Power Off - Serial-To-WiFi Error Not Associated

Antenna Interface

The shield comes with a 2.4G antenna; Make sure the antenna is assembled and antenna pad is buckled properly.

Buttons

There are three Buttons on the Shield. Reset, Function and Alarm1.

AT Commands

All the Serial2WiFi commands is achieved by sending AT commands through UART. Parameters are generally ASCII characters, e.g. ATEn with n=1 is the series of ASCII characters ‘A’, ‘T’, ‘E’, and ‘1’. Where some parameters are optional, mandatory parameters are denoted by < > and optional parameters by [ ]. If a parameter is mandatory, any associated sub-parameters are also mandatory; sub-parameters of an optional parameter are optional. Parameters must always be provided in the order given in the command description. When an optional parameter is not supplied, the comma delimiters must still be included in the command. Every command starts with the characters “AT”; any other initial characters will cause an error to be returned.

Command Response: In most cases, valid commands return the characters OK. Invalid inputs return ERROR: INVALID INPUT.

For more details of AT commands, please refer to WizFi210_User_Manual_EN_V1.10.pdf.

Switch

There is a Data/Command Mode Swtich(connected to GPIO29) on the shield. This switch only operate when user already set up the connection(TCP server/TCP client/UDP), which means module is data mode(can data communication). In this case, when you switch it to command mode, you can setting the module by using AT commands. When you switch it to data mode, you can data communication.

The serial host may gain control of the interface by issuing the escape sequence “+++”, followed by a one-second gap where no characters are received on the serial port. When this sequence is encountered, the Adapter exits data mode and resumes command processing. The host then makes changes in the network configuration or other parameters as needed. However, the Adapter does not accept any new TCP/UDP client/server or data connection requests. The ATO command (terminated by the ASCII character “O”, not the number 0) is used to return to data mode.

Applying the <AT+XEHT> command (Enable Hardware Trigger), you can change between data mode and command mode using Data/Command Mode Swtich, without escape sequence (“+++”). BTW, the function of hardware trigger is similar to input "+++" in serial terminal. But when you use Data/Command Mode Swtich for data/command mode transition, there should be no UART input in 300mS before and after sending signal to Data/Command Mode Swtich for mode transition time and buffer processing time.

Upload Sketch to Arduino

Wifiaurduinouart.jpg
Data Stream among Computer, Arduino and Wifi Shield

The following sketch configures Arduino/Arduino clone as serial link between PC and the Wifi Shield(Jumpers on D6 to WIFI_TX and D7 to WIFI_RX). PC would need a serial terminal software to communicate with it - Window's built-in HyperTerminal, Arduino IDE's Serial Monitor, Serial Terminals(sscom32) or Bray++ Terminal.

After uploading the sketch to the Arduino board, press the Reset button on the Wifi Shield; Now you can see what you get on the serial terminal, and communicate with your Shield to see the status of the four indicator LEDs.

//Serial Relay - Arduino will patch a 
//serial link between the computer and the GPRS Shield
//at 38400 bps 8-N-1
//Computer is connected to Hardware UART
//Wifi Shield is connected to the Software UART 
 
#include <NewSoftSerial.h>
 
NewSoftSerial mySerial(6, 7); //RX-D6;TX-D7
 
void setup()
{
  mySerial.begin(38400);               // the Wizfi210 baud rate   
  Serial.begin(38400);                 // the Wizfi210 baud rate   
}
 
void loop()
{
    if(Serial.available())
    {
       mySerial.print((unsigned char)Serial.read());
       delay(1); //need to slow dowm the data stream, so that no data lose.
     }  
    else  if(mySerial.available())
    {
       Serial.print((unsigned char)mySerial.read());
       delay(1);  //need to slow dowm the data stream, so that no data lose.    
     } 
}

Note:

  • Make sure you install NewSoftLibrary library properly.
  • The "AT" or "at" prefix must be set at the beginning of each Command line. To terminate a Command line enter <CR>.

Examples

Communication between Wifi Shield and PC(Win7)

Wifiexample1.jpg

To do this Demo required:

Actually this demo can be demonstrated on one PC, but use two PC make it less confused. For one PC Demonstration it is almost the same, the difference will be Serial Terminals(sscom32) and Castalia Socket Tester in the same PC rather than in two seperate PCs.

//Serial Relay - Arduino will patch a 
//serial link between the computer and the GPRS Shield
//at 38400 bps 8-N-1
//Computer is connected to Hardware UART
//Wifi Shield is connected to the Software UART 
 
#include <NewSoftSerial.h>
 
NewSoftSerial mySerial(6, 7); //RX-D6;TX-D7
 
void setup()
{
  mySerial.begin(38400);               // the Wizfi210 baud rate   
  Serial.begin(38400);                 // the Wizfi210 baud rate   
}
 
void loop()
{
    if(Serial.available())
    {
       mySerial.print((unsigned char)Serial.read());
       delay(1); //need to slow dowm the data stream, so that no data lose.
     }  
    else  if(mySerial.available())
    {
       Serial.print((unsigned char)mySerial.read());
       delay(1);  //need to slow dowm the data stream, so that no data lose.    
     } 
}

Note:

  • Make sure you install NewSoftLibrary library properly.
  • The "AT" or "at" prefix must be set at the beginning of each Command line. To terminate a Command line enter <CR>.

For more details of AT commands, please refer to WizFi210_User_Manual_EN_V1.10.pdf.


Wifisetup1.jpg


PCCON0.jpg

PCCON1.jpg

Wifi2pc.jpg

Resources

Castalia Socket Tester

Serial Terminals(sscom32)

Si5902BDC - Dual N-Channel 30 V (D-S) MOSFETs (used for 2.8V <> 5.0V translation for Serial Interface)

NewSoftLibrary

WizFi210_User_Manual_EN_V1.10.pdf

How to buy

Bluetooth Shield can be ordered through the GOF store. Its product page is located here

Licensing

This documentation is licensed under the Creative Commons Attribution-ShareAlike License 3.0 Source code and libraries are licensed under GPL/LGPL, see source code files for details.

Personal tools
Variants
Actions
Navigation
Support
Toolbox