arduino wifi shield - elechouse wifi shield... · arduino wifi shield. ... to be compatible with...

10
Arduino WiFi Shield WiFi becomes very popular nowadays. We almost deal with it every day. And getting Arduino into WiFi networks is necessity for many projects. This Arduino WiFi shield could offer you great help if you really need your Arduino working in the wireless network. Features Plug and play solution Compatible with Arduino UNO, Diecimila, Duemilanove and Mega series IEEE Std. 802.11b/g/n compatible Data Rate: 1 and 2 Mbps Uses SPI for host communication (max speed 25MHz) Easy access reset button on-board External antenna with high sensitive Solder-switchable interrupt pin usage between INT0 (port D, pin 2) and digital pin 8 (port B, pin 0) 16 Mbit on-board DataFlash, can be used to store webpages, sensor logs, etc. Extra port to facilitate usage for non-Arduino platform such as PIC. Supports 802.1x, 802.1i security: WEP, WPA-PSK, and WPA-2-PSK. Hardware Security Engine for AES and RC4-based ciphers Support AdHoc. Hardware To be compatible with Most of Arduino boards, we connect WiFi module SPI directly to the SPI port on Arduino board. No matter you use Arduino UNO or Arduino Mega, the port is the same. WiFi module needs interrupt pin of Arduino. We add a 3-pad solder bridge, by which you can switch the interrupt pin between Arduino pin 2 (INT0) and Arduino pin 8 (DIG 8). By default, we connect to Arduino pin 2. You could change it yourself if necessary (in very few cases this change is needed). It is pretty easy to change the solder bridge if you have tools such as soldering iron. www.elechouse.com

Upload: buinhan

Post on 05-Feb-2018

254 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Arduino WiFi Shield - Elechouse Wifi Shield... · Arduino WiFi Shield. ... To be compatible with Most of Arduino boards, we connect WiFi module SPI directly to the SPI port on Arduino

Arduino WiFi Shield

WiFi becomes very popular nowadays. We almost deal with it every day. And getting Arduino into WiFi networks is necessity for

many projects. This Arduino WiFi shield could offer you great help if you really need your Arduino working in the wireless network.

Features

Plug and play solution

Compatible with Arduino UNO, Diecimila, Duemilanove and Mega series

IEEE Std. 802.11b/g/n compatible

Data Rate: 1 and 2 Mbps

Uses SPI for host communication (max speed 25MHz)

Easy access reset button on-board

External antenna with high sensitive

Solder-switchable interrupt pin usage between INT0 (port D, pin 2) and digital pin 8 (port B, pin 0)

16 Mbit on-board DataFlash, can be used to store webpages, sensor logs, etc.

Extra port to facilitate usage for non-Arduino platform such as PIC.

Supports 802.1x, 802.1i security: WEP, WPA-PSK, and WPA-2-PSK.

Hardware Security Engine for AES and RC4-based ciphers

Support AdHoc.

Hardware

To be compatible with Most of Arduino boards, we connect WiFi module SPI directly to the SPI port on Arduino board. No matter you

use Arduino UNO or Arduino Mega, the port is the same.

WiFi module needs interrupt pin of Arduino. We add a 3-pad solder bridge, by which you can switch the interrupt pin between

Arduino pin 2 (INT0) and Arduino pin 8 (DIG 8). By default, we connect to Arduino pin 2. You could change it yourself if necessary (in

very few cases this change is needed). It is pretty easy to change the solder bridge if you have tools such as soldering iron.

www.elec

house.co

m

Page 2: Arduino WiFi Shield - Elechouse Wifi Shield... · Arduino WiFi Shield. ... To be compatible with Most of Arduino boards, we connect WiFi module SPI directly to the SPI port on Arduino

A LED connecting to Arduino pin 9 serves as WiFi connection status LED, Once WiShield is connected to AP or another WiFi device

over AdHoc network, LED turns on.

On-board 16Mbit flash (DataFlash) will supply pretty much space to store data. The DataFlash uses SPI to communicate. It will share

3 SPI pins (SCK, MISO, MOSI) with WiFi module. The SS pin is connected to Arduino pin 7 by default, which is different with WiFi

module (Arduino pin 10). So Arduino could communicate with both of them correctly. We also supply a 3-pad solder bridge on the

board. You could choose the SS pin to Arduino pin 10 or Arduino pin 7. As already mentioned above, by default, we connect it to

Arduino pin 7.

This module needs an external antenna, which will come along with this shield. External antenna has better performance than the

integrated antenna. If you think the external antenna is not a right choice for you, you could do some modification to MRF24WB0MB

chip. Please pay attention to the following picture:

By moving the place of capacitors, you could active the on-board antenna. Actually if your wifi signal is strong enough (that’s when

this module is not far around the wireless module), even you don’t add any external antenna or moving the capacitors, this module

can also send and receive data wirelessly.

For non-Arduino users such as PIC users, useful pins are shown in the following picture:

www.elec

house.co

m

Page 3: Arduino WiFi Shield - Elechouse Wifi Shield... · Arduino WiFi Shield. ... To be compatible with Most of Arduino boards, we connect WiFi module SPI directly to the SPI port on Arduino

Pin 1: SDO, connecting to MISO of your MCU SPI port.

Pin 2: CLK, connecting to CLK of your MCU SPI port.

Pin 3: RTS, connecting with RTS of the MICROCHIP on the board

Pin 4: INT, connecting with INT of the MICROCHIP on the board

Pin5: VDD, 5V

Pin6: SDO, connecting to MOSI of your MCU SPI port.

Pin7: GND

Pin8: SSN, select pin for wifi

Pin9: FCS, select pin for data flash

Software

For PIC users, the TCP/IP stack can be downloaded in this official page.

For Arduino Users, You can download elechouse-wifishield library or original library by Asynclabs. elechouse-wifishield library is

modified from the original one, making it better compatibility with our shield. What’s more, our library supports Arduino 1.0 while

the original library doesn’t.

elechouse-wifishield library (Including Dataflash library and Wishield library)

Original library by Asynclabs : Dataflash library and Wishield library

Test with Arduino

This testing is mainly to show you if your wifi shield works well. To make testing easier, we will test the wifi and flash separately.

Test the wifi function

www.elec

house.co

m

Page 4: Arduino WiFi Shield - Elechouse Wifi Shield... · Arduino WiFi Shield. ... To be compatible with Most of Arduino boards, we connect WiFi module SPI directly to the SPI port on Arduino

Download the library

Unzip elechouse-wifishield library (If original library from Asynclabs , name the library WiShield and DataFlash). Place it under the

dictionary of Arduino library: \arduino-22\libraries. So far we test it successfully on Arduino-22.

Connect this module with Arduino

Change the code

We have to do some changes to the code, according to the configuration of your wireless router. Here is the configuration of my TP-

LINK router: TL-WR841N

Useful information is underlined.

Open the example of WebServer in Arduino IDE.

www.elec

house.co

m

Page 5: Arduino WiFi Shield - Elechouse Wifi Shield... · Arduino WiFi Shield. ... To be compatible with Most of Arduino boards, we connect WiFi module SPI directly to the SPI port on Arduino

Then modify the following code:

// Wireless configuration parameters ---------------------------------------- unsigned char local_ip[] = {192,168,1,122}; //configure IP address of this module, usually one bewteen 192.168.1.100~192.168.1.199 unsigned char gateway_ip[] = {192,168,1,1}; // router or gateway IP address, usually do not need to change it. unsigned char subnet_mask[] = {255,255,255,0}; // subnet mask for the local network, usually do not need to change it. const prog_char ssid[] PROGMEM = {"elechouse"}; // SSID of networks, max 32 bytes. As shown in the picture above, SSID is “elechouse” unsigned char security_type = 3;// 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2 As shown in the picture above, mine is WPA2 // WPA/WPA2 passphrase const prog_char security_passphrase[] PROGMEM = {"12344321"};// max 64 characters // WEP 128-bit keys Since my security type is WPA2, no need to change anything in the following code. // sample HEX keys prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 1 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 2 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Key 3 }; // setup the wireless mode // infrastructure - connect to AP. If you connect to a router, this is the choice. // adhoc - connect to another WiFi device unsigned char wireless_mode = WIRELESS_MODE_INFRA;

Result

Click Upload button to upload the code to Arduino.

www.elec

house.co

m

Page 6: Arduino WiFi Shield - Elechouse Wifi Shield... · Arduino WiFi Shield. ... To be compatible with Most of Arduino boards, we connect WiFi module SPI directly to the SPI port on Arduino

Then you have to wait for some time, about 30 seconds, until IND led is one. Even the led is on, you might have to wait for a while.

The module needs time to issue the connection and calculate the encryption. The time it needs depends on the security type of the

WiFi networks.

The open a CMD window, and ping the module:

Please try several times if the ping failed. Once you can ping the module, it means it is in the wifi network now.

In the browser, visit http://192.168.1.122, you will get:

Test the flash

Download the library

If you download elechouse-wifishield library, you don’t need to change the code. Please skip next step.

If you download the original dataflash library by AsyncLabs, extract it and rename the library Dataflash.

Place the library under the dictionary of Arduino library: \arduino-22\libraries.

Change the code

If you download original library, you need to do some changes to the file DataFlash.cpp: Insert a new line before line 100, and add

code: pinMode(10, OUTPUT);

www.elec

house.co

m

Page 7: Arduino WiFi Shield - Elechouse Wifi Shield... · Arduino WiFi Shield. ... To be compatible with Most of Arduino boards, we connect WiFi module SPI directly to the SPI port on Arduino

See the picture below:

Then open the example in Arduino IDE:

Change the code:

Result

Upload the example code to Arduino. Open the Serial Monitor. Please choose the baud rate 115200:

To learn about the library or to troubleshoot the problem, please visit AsyncLabs Wiki.

www.elec

house.co

m

Page 8: Arduino WiFi Shield - Elechouse Wifi Shield... · Arduino WiFi Shield. ... To be compatible with Most of Arduino boards, we connect WiFi module SPI directly to the SPI port on Arduino

Known Problem

The PCB of this module doesn’t match with Arduino perfectly, due to manufacturer’s problem. Fortunately the discrepancy is tiny and

will not cause any working problem. It only makes connection not so easy.

The defect will surely be overcome in next producing.

Users deserve to know this problem before they buy it.

Disclaimer and Revisions

The information in this document may change without notice. If you got any problem, please email to [email protected].

You can visit www.elechouse.com for more information.

Revision History

Rev. Date Author Description

A Mar. 16th

, 2012 Wilson Shen Initial version

www.elec

house.co

m

Page 9: Arduino WiFi Shield - Elechouse Wifi Shield... · Arduino WiFi Shield. ... To be compatible with Most of Arduino boards, we connect WiFi module SPI directly to the SPI port on Arduino

SISCKRESETCS WP

VCCGND

SO

AT45DB161D

GNDNCJTAG_TDOJTAG_TCKJTAG_TMSJTAG_TDIRESETNCJTAG_RSTGNDNCNCNCNCNCWPVDDGND GND

HIBERNATEJTAG_EN

NCCSNC

GNDDEBUG_RXDEBUG_TX

GNDVDDGND

NCSDOINT

SCKSDI

GND

MRF24WB0MA

4.7k

R1

Res2

GN

D1

Vou

t2

Vin

3

XC6206-3.3

OUT

GND

47uF

C3Cap

LED1

GND

1.5K

R2Res3

GND

5V

104

C4Cap

OUT

GND

104

C2Cap

OUT

4.7k

R6

Res2

RST

MOSI

INT4.7k

R4

Res24.7k

R5

Res2

OUT

INT

1 23 4

Button1RST

GND GND

RST

GND

OUT

RST123 1

23

PD7

PD8

PD2INT

4.7k

R7Res2

5V

4.7k

R3

Res2

SS_N

SS_N

OUT

1234

5678

LED2

GND

1.5K

R8Res3

PD9

RSTINT SS_N

GND

5V

MOSI

MISO

MISO

CLK

CLK

MISOCLKMOSI

MISO

47uF

C1Cap2

PIAT45DB161D01

PIAT45DB161D02

PIAT45DB161D03

PIAT45DB161D04 PIAT45DB161D05

PIAT45DB161D06

PIAT45DB161D07

PIAT45DB161D08

COAT45DB161D

PIButton101 PIButton102

PIButton103 PIButton104

COButton1

PIC101

PIC102COC1

PIC201

PIC202COC2

PIC301

PIC302COC3

PIC401

PIC402COC4

PILED101PILED102

COLED1PILED201PILED202

COLED2

PIMRF24WB0MA01

PIMRF24WB0MA02

PIMRF24WB0MA03

PIMRF24WB0MA04

PIMRF24WB0MA05

PIMRF24WB0MA06

PIMRF24WB0MA07

PIMRF24WB0MA08

PIMRF24WB0MA09

PIMRF24WB0MA010

PIMRF24WB0MA011

PIMRF24WB0MA012

PIMRF24WB0MA013

PIMRF24WB0MA014

PIMRF24WB0MA015

PIMRF24WB0MA016

PIMRF24WB0MA017

PIMRF24WB0MA018 PIMRF24WB0MA019

PIMRF24WB0MA020

PIMRF24WB0MA021

PIMRF24WB0MA022

PIMRF24WB0MA023

PIMRF24WB0MA024

PIMRF24WB0MA025

PIMRF24WB0MA026

PIMRF24WB0MA027

PIMRF24WB0MA028

PIMRF24WB0MA029

PIMRF24WB0MA030

PIMRF24WB0MA031

PIMRF24WB0MA032

PIMRF24WB0MA033

PIMRF24WB0MA034

PIMRF24WB0MA035

PIMRF24WB0MA036

COMRF24WB0MA

PIP501

PIP502

PIP503 PIP601

PIP602

PIP603

COP6PIP1101

PIP1102

PIP1103

PIP1104

PIP1105

PIP1106

PIP1107

PIP1108

PIR101 PIR102COR1

PIR201

PIR202

COR2PIR301 PIR302

COR3

PIR401 PIR402COR4

PIR501 PIR502COR5

PIR601 PIR602

COR6

PIR701

PIR702COR7

PIR801

PIR802

COR8

PIU101 PIU102 PIU103

Switch Pad

Dimention and Schematic

Dimention and Schematic

Dimention and Schematic

www.elechouse.co

m

www.elec

house.co

m

Page 10: Arduino WiFi Shield - Elechouse Wifi Shield... · Arduino WiFi Shield. ... To be compatible with Most of Arduino boards, we connect WiFi module SPI directly to the SPI port on Arduino

PAAT45DB161D05

PAAT45DB161D06

PAAT45DB161D07

PAAT45DB161D08

PAAT45DB161D04

PAAT45DB161D03

PAAT45DB161D02

PAAT45DB161D01

COAT45DB161D

PAButton101

PAButton102 PAButton103

PAButton104

COButton1PAC101

PAC102

COC1

PAC201

PAC202

COC2

PAC302

PAC301

COC3

PAC401

PAC402COC4

PALED101

PALED102

COLED1

PALED202

PALED201COLED2

PAMRF24WB0MA036PAMRF24WB0MA035PAMRF24WB0MA034

PAMRF24WB0MA033PAMRF24WB0MA032PAMRF24WB0MA031

PAMRF24WB0MA030PAMRF24WB0MA029PAMRF24WB0MA028PAMRF24WB0MA027PAMRF24WB0MA026PAMRF24WB0MA025PAMRF24WB0MA024PAMRF24WB0MA023PAMRF24WB0MA022PAMRF24WB0MA021PAMRF24WB0MA020PAMRF24WB0MA019PAMRF24WB0MA018

PAMRF24WB0MA017PAMRF24WB0MA016PAMRF24WB0MA015PAMRF24WB0MA014PAMRF24WB0MA013PAMRF24WB0MA012PAMRF24WB0MA011PAMRF24WB0MA010PAMRF24WB0MA09PAMRF24WB0MA08PAMRF24WB0MA07PAMRF24WB0MA06

PAMRF24WB0MA05PAMRF24WB0MA04PAMRF24WB0MA03

PAMRF24WB0MA02PAMRF24WB0MA01

COMRF24WB0MA

PAP503

PAP501

PAP502COP5

PAP603

PAP601

PAP602COP6

PAP7010PAP709

PAP708PAP707PAP706

PAP705PAP704

PAP703PAP702 PAP701

PAP7011 COP7

PAP8010PAP809

PAP808PAP807PAP806

PAP805PAP804

PAP803PAP802 PAP801

PAP8011 COP8

PAP9010PAP909

PAP908PAP907PAP906

PAP905PAP904

PAP903PAP902 PAP901

PAP9011COP9

PAP10010PAP1009

PAP1008PAP1007PAP1006

PAP1005PAP1004

PAP1003PAP1002 PAP1001

PAP10011COP10

PAP1101

PAP1102

PAP1103

PAP1104

PAP1105

PAP1106

PAP1107

PAP1108COP11

PAR101

PAR102COR1

PAR201

PAR202COR2

PAR301

PAR302COR3

PAR401

PAR402

COR4

PAR501

PAR502COR5PAR602

PAR601COR6

PAR701

PAR702COR7

PAR802

PAR801COR8

PAU103PAU102PAU101

COU1

www.elechouse.co

m

www.elec

house.co

m