MRF24WB0MA SPI WiFi Shield Module

Description
Getting you Arduino into WiFi network is not a fresh news any more. We introduced our UART wifi module which easily gets your Arduino into wifi.
But now Users who use UART wifi module will find that the operation is very easy, and programming is pretty easy, too. Basically once you configured it well, you don't need to do further configuring work in the future until the wifi network changes. Each time while it is powered up, it accesses to the wifi network automatically. However, the data speed may not satisfy your needs. Because the data go through UART, and UART speed is limited.
Well, this new Arduino WiFi Module sends and receives data through SPI interface. The max data speed is 2Mbps. Basically you can transmit picture or vedio wirelessly. Also, this new shield supports AES encryption, more safer while transmitting your data. This shield requires much programming code.
Feature
1、Compatible with Arduino UNO, Mega, Duemilanove and so on
2、Compatible with most none-Arduino platform with SPI such as PIC
3、Power: 5V DC
4、Interface: SPI
5、Plug and play solution
6、Compatible with Arduino UNO, Diecimila, Duemilanove and Mega series
7、IEEE Std. 802.11b/g/n compatible
8、Data Rate: 1 and 2 Mbps
9、Uses SPI for host communication (max speed 25MHz)
10、Easy access reset button on-board
11、Solder-switchable interrupt pin usage between INT0 and digital pin 8
12、16 Mbit on-board DataFlash, can be used to store webpages, sensor logs, etc.
13、Extra port to facilitate usage for non-Arduino platform such as PIC.
14、Supports 802.1x, 802.1i security: WEP, WPA-PSK, and WPA-2-PSK.
15、Hardware Security Engine for AES and RC4-based ciphers
16、Support AdHoc.
Introduction
WiFi access to the LAN is already a common way. We have introduced a wired way to access LAN. Is it possible for Arduino to access LAN via WiFi? The answer is yes. We are here to introduce a WiFi wireless communication module based on SPI.
To use this module, first we need to start with https://github.com/asynclabs/WiShield to download the appropriate library, or you can download our testing version. The library files should be extracted to the Arduino (we tested using the Arduino-0021) libraries directory, and rename it to WiFi and restart Arduino IDE. In order to communicate with access point (AP) or wireless router (Router), this WiFi module needs to be configured, including the wireless network ID (SSID) and encryption methods. At present, the WiFi module can support WEP, WPA / TKIP-PSK and WPA2/AES-PSK encryption. Before configuring WiFi module, you need to understand clearly your AP or router's configuration. Here we used a NETGEAR wireless router, with WPA encryption. Configuration as shown below:

Take Notice
When you want to use this module with in latest Arduino IDE -Arduino 1.0, and you need to do some steps as follow :
1. Download the WiShield library that has been optimized and fixed by users:
https://github.com/asynclabs/WiShield_user_contrib
2. Rename the folder to WiShield and put it into Arduino_sketch_folder/libraries
You might notice that just running a sketch with the WiShield library will generate errors like :
return type specified for ‘virtual void Server::write(uint8_t)’
clock-arch.c:44:20: error: wiring.h: No such file or directory
3. In order to get rid of these error you need to change the corresponding names in the following files:
clock-arch.c
Replace #include “wiring.h” with #include “Arduino.h”
WiShield.cpp
Replace #include “WProgram.h” to #include “Arduino.h”
WiServer.cpp
Replace #include “WProgram.h” to #include “Arduino.h”
Replace void Server::write(uint8_t.. to be size_t Server::write(uint8_t..
WiServer.h
Replace virtual void write(uint8_t); to virtual size_t write(uint8_t);
In the download WiFi package there are some examples. Here we test the WebServer example, consisting of two parts: webserver.c and WebServer.pde. We need to modify WebServer.pde, mainly based on the wireless router's configuration. We modified the code as follow:
# Include <WiShield.h>
# Define WIRELESS_MODE_INFRA 1
# Define WIRELESS_MODE_ADHOC 2
/ / Wireless configuration parameters ----------------------------------------
unsigned char local_ip [] = {192,168,0,14}; / / IP Address
unsigned char gateway_ip [] = {192,168,0,1}; / / Gateway address
unsigned char subnet_mask [] = {255,255,255,0}; / / subnet mask
const prog_char ssid [] PROGMEM = {"LOTUS"}; / / SSID
unsigned char security_type = 2; / / 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2
/ / WPA/WPA2 passphrase
const prog_char security_passphrase [] PROGMEM = {"12345678"}; / / max 64 characters
/ / WEP 128-bit keys
/ / 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
/ / Adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;
unsigned char ssid_len;
unsigned char security_passphrase_len;
//------------------------------------------------ ---------------------------
void setup ()
{
WiFi.init ();
}
/ / This is the webpage that is served up by the webserver
const prog_char webpage[] PROGMEM = { "HTTP/1.1 200 OK Content-Type: text/html <center><h1>Hello World!! WiFi</h1> </center>"};
void loop ()
{
WiFi.run ();
}
Then you need to do some major changes about the code as the following several parts :
1、Corresponding IP address、Gateway address、subnet mask and SSID
unsigned char local_ip [] = {192,168,0,14}; / / IP address
unsigned char gateway_ip [] = {192,168,0,1}; / / Gateway address
unsigned char subnet_mask [] = {255,255,255,0}; / / subnet mask
const prog_char ssid [] PROGMEM = {"LOTUS"}; / / SSID
2、Type of wireless network encryption
unsigned char security_type = 2;
When the parameter value is 0 which stand for No encrypti
When the parameter value is 1 which stand for WEP encryption
When the parameter value is 2 which stand for WPA / TKIP-PSK
When the parameter value is 3 which stand for WPA2/AES-PSK
3、Wireless network password
/ / WPA/WPA2 passphrase
const prog_char security_passphrase [] PROGMEM = {"12345678"}; / / max 64 characters
/ / WEP 128-bit keys
/ / 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
};
In the code, security_passphrase is for WPA/WPA2 encryption, and wep_keys is for WEP (128 bit key) encryption, You need to fill in the appropriate parameters according to the setting of your WiFi network, Here we deal with WPA encryption, So we only need to set security_passphrase.
Download the program to the Arduino, Hardware connection is simple. This module uses the SPI interface, So we can use the IDC expansion Shield, 6-pin IDC is used here:

WiFi module's initialisation will takes some time. We can use the ping command to check that whether this wifi module is normal to connect the wireless AP/the router or not :
ping -t 192.168.0.14

Once the connection is right, you can use the browser to test the WiFi WebServer:

In addition to this example WebServer, in the library there are other examples,You can test them one by one. You can also develop your own code baed on these examples.
The WiFi module have certain requirements for wireless AP or router, Tests of WAP or no encryption with NETGEAR WGR614 v5 wireless router got no problem. However, test on WEP approach also failed. You may got different tests result with other wireless AP or router.
By the wy, we also supply two reference library for this module and you can use it according to your requirement.

