Power to the masses.
With the recent availability of cheap WiFi modules like Microchip's MRF24WB0MA, I find it quite difficult to NOT use them in some way or another, given their essentially limitless potential in remote sensing/control applications.
The word "remote" here retains its full meaning; you can basically turn on that lamp in your room from the other side of the planet, - or anywhere in the world for that matter - provided that you can get access to that thing we call the internet.
In this post, I will show you how to use the MRF24WB0MA on the Arduino platform.
Things you will need:
- MRF24WB0MA WiFi Module. (Available from Farnell here)
- 4x 4.7k Ohm Resistors
- 2x 1.0uF Capacitors.
- Some way of connecting these together. I used a perfboard and some wires.
[Also, check out Farnell's Arduino page for some interesting Arduino-related products. These guys are cool.]
The schematics described below are based on the WiShield 1.0 Arduino shield from AsyncLabs.
First you will have to connect the module as described below to the Arduino shield. The resistors are all 4.7k and the two caps are 1.0uF each.
Remember: Power is at 3.3v.
The resulting circuit should be something similar to this:
Then you'll just hook this up to your Arduino. Your setup may look similar to this:
The task of connecting the WiFi module to the Arduino is way simpler than the above pictures might suggest. It's really only about connecting the SPI interface (5 wires) and Power + Reset (3 wires).
The hardware setup described is basically equivalent to an Arduino board with a WiShield 1.0 stacked on it.
Therefore, as you might have guessed, things get easier from now on - it's all software.
On your computer:
- Download the WiShield library here. [now mirrored on my github]
- Put all the files/directories under
- Restart the Arduino environment, so that the library files get built and the sketches become available.
Done. At this stage you are ready to experiment with the examples included in the WiShield libraries.
I'll suggest you to start with the "WiShield>Webserver" example.
This is a screencap of the page you should get when you type in the IP address of the module in your browser:
You'll have to hardcode the IP settings in the Arduino Sketch. The module does NOT support DHCP for automatic IP assignment in the examples. This implies that if you are using infrastructure mode, you will need to set your router to reserve the IP address you set in the Arduino Sketch.
If you are using adhoc mode, things get simpler. Just make sure you set your computer up for static IP addressing. To use adhoc mode: In the sketch, change the line containing
unsigned char wireless_mode = WIRELESS_MODE_INFRA;
unsigned char wireless_mode = WIRELESS_MODE_ADHOC;
I noticed that if you use WPA2 authentication, the module will take about 30seconds to authenticate. No need to panic if the LED (shown on the schematic) does not light up right away.
Also, make sure that you set up the security type properly:
unsigned char security_type = 0; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2
After you've managed to correctly run the examples included in the libraries, check out AsyncLabs' forums for a variety of more interesting, real-life applications.