Sunday, October 16, 2011

Connecting the MRF24WB0MA to the Arduino

UPDATE 01-Mar-2016: Use Atmel's ATWINC1500 instead - Low power, WPA-Entreprise, better Stability!

UPDATE 01/05/2013: They are calling all this "Internet of Things" now lol :D

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:

  1. Download the WiShield library here. [now mirrored on my github]
  2. Put all the files/directories under /libraries/WiShield/ directory.
  3. 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. 

Thursday, August 25, 2011

YaNis Android Wireless EOS Controller

Feel free to contact me if you need a customized variation of this system for UAV/MAV applications.
Since 2011, I've supplied several companies who needed reliable control over their cameras mid-flight.

UPDATE 18/09/11: 
Project Instructable published!


This article is about a wireless Canon EOS controller that I was planning to build a few weeks ago when I saw Oleg Mazurov's PTP libraries for Arduino.

Basically, the controller accepts commands over Bluetooth from an Android device to offer full manual control over most of the camera's settings.

Manual control over:
  • Aperture
  • Shutter Speed
  • ISO
  • White Balance
  • Focus Position
  • Live View STATUS
  • Capture
  • Intervalometer/Timer
Upcoming Features
  • Video mode
  • Rack Focusing
  • HDR Bracketing
  • Bracketed intervalometer
  • Arduino Side Battery life optimizations (about 80% improvement expected)
  • Multiple camera control
  • 'Script' mode
The set of command the device accepts in order to issue relevant PTP commands will be reffered to as the "Manis Command Set", MCS.

The app is available for free on the android market as:

This is an Open Source project - I plan to release the app's source code as soon as it exits beta status.
While I will write something more in-depth in the coming days, here is a quick build instructions of the hardware:

Things you will need:

-An Arduino Board. (I used the Pro Mini 3.3v from Sparkfun)
-A USB Host Shield from here.
-An SPP compatible bluetooth module. (eg Sparkfun RN42, BlueSMIRF)
-(optional) A portable power source.

A LiPo battery can be useful. 1000mAh or more is recommended.

The Arduino sketch and required libraries is available at:

The Arduino software part is heavily based on Oleg Maruzov's excellent PTP/USB Libraries.

Current hardware revision has been tested to work successfully with a Canon 1000D. Should work equally well with 450D, 400D, 500D, etc. The whole Canon EOS range is expected to be supported at some point.

Version 2.0 (Version 2.1 uses an ebay BT module rather than the RN42)

Version 2.1
The pictures should have given you a pretty good idea how the listed components fit together.
If not, check out the instructable


2. Set the Bluetooth module to operate at 9600Baud. (else it won't work unless you alter the code). 9600 Baud is perfectly appropriate for this circuit. I don't recommend to move to higher baud rates.

3. Youtube Demo is being upload as I am typing this.

Feel free to report issues on the google code project page.





In the document below, you will find what values are sent via Bluetooth: 

Sunday, May 1, 2011

Arduino - A/D conversion and LCD Interfacing

Basically, this project is meant to simultaneously test the A/D conversion and LCD driving capabilities of the Arduino platform. Turning the potentiometer will vary the number displayed on the LCD between 0 and 1023.

What you will need:

1 x Arduino Board
1 x HD44780-compliant LCD module
1 x Potentiometer (I used a 10K linear here)

The Setup

(Center pin to pin A5 on the board, side pins to ground and +5v.)

We will be driving the LCD module by 6 data pins here.

In this case, I connected them as follows:

LCD ">"> Arduino Pin
D7 2
D6 3
D5 4
D5 5
RS 12
Enable 10

Also, connect the R/W pin of the LCD module to ground.

Some serious 6 pin LCD drivin', yo!

(Vss to ground, Vcc to +5v, Vlc to ground via a 4.7K resistor[contrast])

The code below should work pretty well:
(See the LiquidCrystal() library on the Arduino website for more detailed info)


#include <LiquidCrystal.h>

int sensorPin = A5;
int sensorValue = 0;

LiquidCrystal lcd(12, 10, 5, 4, 3, 2);

void setup()

void loop() {
sensorValue = analogRead(sensorPin);


(Here we can see the 4.7k resistor I used to set the contrast of the LCD module)