Skip to main content

How to use the wizfi210-- WIFI Arduino Shield.




WizFi210 - WiFi Shield


Introduction 

In this tutorial you will learn how to use the WizFi210 - Arduino WiFi Shield with Arduino uno board. This low-cost wifi shield can be easily connected to your WiFi network and communicate with the Arduino uno board through the serial communication protocol.  In this tutorial we will control an LED wirelessly from an Android phone/tablet app or from a computer tcp/ip terminal.


Picture




Features of WizFi210:
  • Serial(UART) to Wifi.
  • Simple AT commands for configuration and data communication.
  • DHCP/Static IP, TCP/UDP, Server/Client, DNS.
  • Operates with standard 802.11 b/g/n access points at speed up to 11 Mbps (802.11b).
  • 802.11i Security (WEP, WPA, WPA2-PSK, Enterprise).
  • High-throughput hardware AES and RC4 encryption/decryption engines.
  • Limited AP Feature (Direct Connection to iPhone, iPad and Android-Phone without AP).
  • Ultra low power consumption through dynamic power management.

What you will need - Hardware

For this tutorial you will need:
  • Arduino uno
  • Breadboard
  • WizFi 210 Shield
  • An LED
  • 220Ohm resistor 

You can also use your phone as a personal hot-spot and connect to it through the following procedure.

Connect WizFi210 to your WiFi network

Follow the steps below to connect the WizFi 210 with your WiFi network. We will set FizFi210 shield to act as an TCP/IP server.
Picture

Picture

​Hardware configuration:
  • Attach the shield on Arduino uno
  • Set RUN/PROGRAM switch to RUN
  • Set DATA/COMMAND switch to COMMAND
  • Use jumpers to connect shield RX to Arduino RX and shield TX to Arduino TX
  • Connect the Arduino with your computer
  • Press the "Connect" button below to use the serial monitor of  Codebender (set baud rate to 115200bps)

Connect to WiFi network by using AT commands:

Type and send:
  • AT If you take OK proceed  to next step (sometimes need to send AT two times)
  • ATB=9600,8,n,1 This will change baud rate to 9600, change it also to Codebender Serial Monitor and press connect button again.
  • AT+WS Will scan for available fifi networks 
  • AT+WAUTO=0,NAME_OF_YOUR_WIFI_SSID  e.g. AT+WAUTO=0,Xperia M2
  • AT+WWPA=WIFI_PASSWORD e.g. AT+WWPA=14539678921
  • AT+NDHCP=0 This will disable the DCHP function
  • AT+NSET=SHIELD_IP,NETWORK_MASK,NETWORK_IP
    e.g. ΑΤ+NSET=192.168.1.150,255.255.255.0,192.168.1.1 *
  • ΑΤ+NAUTO=1,1,,PORT_NUMBER e.g. AT+NAUTO=1,1,5000
  • ΑΤ&W0 To save changes
  • ATA To connect to the network

My setup is:
SSID: Xperia M4 with WPA pass: 14539678921
Network IP: 192.168.1.1 and mask: 255.255.255.0
Server address (WizFi210 shield): IP: 192.168.1.150 PORT: 5000

*Android smartphones/tablets have network address 192.168.43.1 so address of our server must be 192.168.43.150

Note :: Remove RX and TX jumpers from WizFi210 to program your Arduino uno board. After programming,Now put  jumpers back to shield with the following connection:  RX to TX and TX to RX and set SW to DATA.

To build the circuit, connect one end of the resistor to Arduino pin 12. Connect the long leg of the LED (the positive leg, called the anode) to the other end of the resistor. Connect the short leg of the LED (the negative leg, called the cathode) to the Arduino GND.

The Code ::
******************************************************************************
/* Testing the WizFi210 - Serial WiFi Arduino Shield
   *Send A to turn off the LED 
   *Send B to turn on the LED
 */
  const int ledPin = 12;
char data;
int flag=0;

void setup()

{
pinMode(ledPin, OUTPUT);// Set pin 5 as an output
Serial.begin(9600); // Start serial communication
}

void loop()
{
   // Check serial connection
    if (Serial.available() > 0) {
        // read incoming data:
        data = Serial.read();
        flag=0;
    }
    
    // If data is 'A' turn off the LED
    if (data == 'A'){
    digitalWrite(ledPin, LOW);
    if (flag == 0){
    Serial.println("LED is OFF");
    flag=1; //print this message only one time!
    }
    }
    // else if is 'B' turn on the LED
    else if (data == 'B'){
    digitalWrite(ledPin, HIGH);
    if (flag == 0){
    Serial.println("LED is ON");
    flag=1; //print this message only one time!
    }
    }
}
******************************************************************************
 

Computer TCP/IP terminal

Si4703 Arduino Tutorial
We will use Hercules utility for Windows OS from HW-group to control our led wirelessly,  you can download it from here. ​

Steps - see the image above:
  • Select TCP Client
  • Put server ip: 192.168.1.150, port 5000
  • Press the connect button
  • Send B to turn on the LED
  • Send A to turn off the LED

Android application

Picture
Connect your phone/tablet with the same WiFi network and download the "WiFi TCP/UDP Controller" app from Next Prototypes. You can download it from play store (link here) for free. Click the "PREFERENCE" button and set
  • The ip to 192.168.1.150 and port to 5000.
  • TCP/UDT to TCP
  • Visibility: uncheck all buttons except buttons 1 and 2
  • Command:  button1: A and button2: B
  • Name: button1: OFF and button2: ON
  • Uncheck the option "TextBox"
  • Check the option "Received Data"
  • Press the buttons to turn on/off the LED

Well done!

Picture
You have successfully completed one more "How to" tutorial and you learned how to use the WizFi210 shield with Arduino uno.  What next? You can try to add more leds to your project!

I hope you liked this, let me know in the comments.



wizfi210-user_manual_en_v1.11.pdf
Download File






Comments

Popular posts from this blog

Arduino ​Obstacle Avoiding Robot Ardunio Computer

Build Your Own Arduino Weather Station

Complete Guide for Nokia 5110 LCD with Arduino