Wii Remote IR Camera Hack With Arduino Interface

274,760

298

81

Published

Introduction: Wii Remote IR Camera Hack With Arduino Interface

We'll physically extract the IR camera from the Wii remote and interface it with an arduino controlling a servo.

The Wii IR camera is a beautiful thing. It has an integrated processor which outputs the X and Y positions and size of the 4 brightest IR points that is sees. This can be very useful for tracking in robotics or human interfaces. Enjoy!

Step 1: Extract the Wii IR Camera

You'll need a Wii remote or "Wiimote" to start with. Normally they are about $40, in the end that is not too bad for a pretty awesome sensor. Otherwise you can check out ebay or elsewhere for used or broken Wii remotes.

You'll need to rip apart the case. It has some crazy three pronged screws. I didn't want to completely trash the case so I made a small tool to take it apart.

Now you need to desolder the 8 pins and the 2 struts holding the camera on the board. I used some desoldering braid. It wicks the solder away and makes it easy to get the camera out. Be careful, don't break the camera!

How to use desoldering braid: http://www.youtube.com/watch?v=AcbezX8TrOU

You might want to keep the rest of the parts. You might be able to scrap other parts. Also, If you decide later to use the Wiimote again, you could always put the camera back in.

Step 2: Interface Circuitry

We'll need a small circuit to interface the IR camera to the arduino. I got all my information from other sources. Here is an exhaustive list:

This fellow (kako) seems to be the first. Here are his pages translated. (Please note that the various translation services online all give slightly different results. It is useful to try several of them.)
http://translate.google.com/translate?u=http%3A%2F%2Fwww.kako.com%2Fneta%2F2008-009%2F2008-009.html&hl=en&ie=UTF-8&sl=ja&tl=en
http://babelfish.yahoo.com/translate_url?doit=done&tt=url&intl=1&fr=bf-home&trurl=http%3A%2F%2Fwww.kako.com%2Fneta%2F2007-001%2F2007-001.html&lp=ja_en&btnTrUrl=Translate

Johnny Lee did his part as well and he has some good information:
http://procrastineering.blogspot.com/2008/09/working-with-pixart-camera-directly.html

But the most useful information came from Stephen Hobley. He is going to supply us with the arduino Wii camera library which we will use while programming.
http://www.stephenhobley.com/blog/2009/02/22/pixart-sensor-and-arduino/
http://www.stephenhobley.com/blog/2009/02/24/all-in-one/
http://www.stephenhobley.com/blog/2009/03/01/pixartwiimote-sensor-library-for-arduino/

Ok, to the circuit. We need the clock circuitry and the i2c interface. Do you want to undertand i2c? Don't ask me: http://en.wikipedia.org/wiki/I%C2%B2C

Here is a direct link to the schematic shown below (so you can actually read it.) http://stephenhobley.com/blog/wp-content/uploads/2009/02/wiicam_schem.gif

The clock is pretty simple. You need two capacitors, a 25 MHz crystal, a 1 Meg Ohm resistor and a 74AC04 inverter logic gate. These are all pretty standard parts, you can get them all from Digikey.com or other online electronics sites.

We'll handle the i2c circuit in the next step.

Step 3: I2c Circuit

This part is a little trickier. The i2c chip is a tiny surface mount chip, so you'll need to solder that. First you need the surface mount to DIP board. This will allow us to work with the tiny chip in a prototyping circuit. This chip is the communication device between the 5 volt arduino and the 3.3 volt Wii camera.

The chip:
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=LTC4301LCMS8%23PBF-ND

The surface mount to DIP adapter:
http://cimarrontechnology.com/msop-8sot-23-8to8-pindipadapterpn030502.aspx

Here is a great video, which explains, far better than I can, how to solder those darn surface mount chips.
http://www.youtube.com/watch?v=3NN7UGWYmBY

Step 4: Attach It All to the Arduino

All of the IR camera to i2c and clock connections are shown in the Stephen Hobley schematic (check out the previous steps.) http://stephenhobley.com/blog/wp-content/uploads/2009/02/wiicam_schem.gif

You'll need to connect the arduino to the i2c chip, (also shown in the schematics) and connect the servo to the arduino (I have mine on pin 9, just like in the arduino servo example.)

The arduino chip requires +5 volts and the camera requires +3.3 volts. I had a multiple output power supply, so I gave each part of the circuit what it needed. If you only have a +5v power supply you could add a 3.3 volt voltage regulator to drive the camera.

Step 5: Program the Arduino

This is pretty easy and the fellas who I've linked to worked out most of the details. Good thing, we can get straight to playing around with it.

If you need information about arduino's, just google it. I found all of my info there easily. Here is the main arduino page: http://www.arduino.cc/

First thing, get the servo working. Run the servo example code in the arduino programmer to get your feet wet.

Second, download Stephen Hobley's Wii camera library and example code. Here: http://www.stephenhobley.com/arduino/PVision.zip

Connect the arduino to the same pins that he used. Make sure your i2c circuit and clock are all connected and the power is on and then run the code. You may need to insure that the Pvision.h file is in your arduino library so that is it properly reference when compiling.

Once running, in the serial I/O stream in the arduino programmer you should see data coming in as long as the camera sees some IR light.

I first used a match to check the camera. It worked fine. Later I used an IR led since I needed something a little more steady (and less burny.) You can use a digital camera to see if your IR LED's are working. The camera image sensor picks up the IR light that your eyes cannot see. This is a reassuring way to truly know if the LED's are working.

Step 6: Using the Camera to Control Something.

Finally we can run the combined code, actuating the servo with the Wii IR camera output. This is the proof of concept type of project. After proving that this is possible we can go on to building more complicated projects with confidence that we can utilize the Wii IR camera.

I have attached the arduino code files.



The system responds very quickly, even to fast, small movements. Now, we can use the Wii camera directly in all our projects. Look for cheap busted Wii remotes on ebay to salvage.

If you are getting too much noise in the system (i.e. the camera is seeing too many extraneous light sources) you can use the IR filter from the Wii remote. This will filter the lights which are disrupting the camera.

Share

    Recommendations

    • Make it Move Contest

      Make it Move Contest
    • Microcontroller Contest

      Microcontroller Contest
    • Casting Contest

      Casting Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    By the way, you did not use the IR filter on your demo video ? Is it useless ?

    81 Comments

    It can be useful to make 3D tracking. Maybe will make something that uses this system. Nice instructable dude !

    does the camera from clone wiimote perform the same? anybody tried?

    Thanks in advance.

    Has anyone had success with the purchased camera from http://www.robotshop.com/en/ir-tracking-camera.htm...? If so, I have a question about what it is capable of.

    What hardware is built into the camera? The picture on this product's Wiki makes it seem like it plugs straight into the VCC, GND, SLA, and SDA of the Arduino with absolutely no hardware or circuits required, but I feel like this might be too good to be true.

    Is it true that you don't use a 25 MHz crystal, an LTC4301L 3.3-to-5 V converter, a surface mount to DIP adapter, a hex inverter IC, or any resistors/capacitors?

    Thank you!

    I know this is an old post but I'm sure this is an easy question many could answer for me. The entire circuit described is for the clocking and i2c functionality and interfacing of the cam. Instead of making this circuit I found an adafruit board I believe will do the trick. Could someone help me out and verify this board does the same as the circuit and could be wired up with the camera.

    https://www.adafruit.com/products/2045

    -Never hunt around for another crystal again, with the Si5351A clock generator breakout from Adafruit! This chip has a precision 25MHz crystal reference and internal PLL and dividers so it can generate just about any frequency, from <8KHz up to 150+ MHz.

    The Si5351A clock generator is an I2C controller clock generator. It uses the onboard precision clock to drive multiple PLL's and clock dividers using I2C instructions. By setting up the PLL and dividers you can create precise and arbitrary frequencies. There are three independent outputs, and each one can have a different frequency. Outputs are 3Vpp, either through a breadboard-friendly header or, for RF work, an optional SMA connector.

    We put this handy little chip onto it's own breakout board PCB, with a 3.3V LDO regulator so it can be powered from 3-5VDC. We also put level shifting circuitry on the I2C lines so you can use this chip safely with 3V or 5V logic.

    Hi,

    great project. I try to attach one more servo for the vertical axis adding new lines in the sketch but the second servo spins continually. I try different pwm pins but still the same result. Can you tell me where and what should add to modify it for the second vertical axis?

    Thanks.

    Hi, I have to use a similar technology for a work. There is the possibility to buy the camera on line (without it is necessary to disassemble the Wiimote).

    Thank you

    3 replies

    I'm sorry, I formulated in a wrong way my post. I want to know if there is the possibility to buy the camera on line?

    Sorry again

    Could you link me where have you bought the ir camera? Thanks in advance :)

    Hiya, great project!

    It's my first time working with arduino, and I was wondering if I could just use the 3.3v output from the arduino to the camera as I only have a 9v supply

    Would be usefull for a sentry gun project. :D

    1 reply

    I was thinking the same thing. With a laser designator!

    hello

    i have a problem. I have build the circuit but the camera gives only an x and y coordinate of 1023.

    can anyone help me?

    I realize this is way after you posted this, but just in case anyone is wondering:

    The camera has some onboard processing that requires a clock signal. The inverter, crystal, two capacitors, and resistor are a simple oscillator circuit (called a Pierce Oscillator) that generate that clock signal. There's some decent material online about these circuits, but this application note from TI might be a good start! http://www.ti.com/lit/an/szza043/szza043.pdf

    Hi, how can I get this 8 pin pixart camera? I bought one wii remote and the camera in that was 12 pin. So can you please help me to get the exact one?

    Hi, I actually followed your post and I was able to make it. There are things I changed though such as the I2C bus voltage converter shield. LTC4301L is not available in our region so I managed to make a voltage converter using mosfets. I tried using a 25Mhz oscillator, run the program but strangely enough it can control the servo motor but does not output the x, y coordinates. I always get zero values. So, I tried using a 16Mhz oscillator with 4800 baud rate, surprisingly though, everything went smoothly. I can control the servo motor and acquire the right coordinates. But the problem I am experiencing right now is that it only works for a limited time, after only 30 seconds, i can no longer control the servo as well as output the right coordinate. I have to reset it again to make it work. Does it involve running out of memory?

    I just removed the camera from one of mine WiiMotes to try this.

    Unfortunately I mangled some of the copper leads on the camera. they appear to be kinda 'spring locking' pins that were designed to come out [of the camera package] easily. Are these a standard pin that I might be able to buy replacements for? or would pushing solid core wire into their slots work? any other ideas on how i might salvage this?

    1 reply

    Sorry, I don't know. I was just really careful with mine and was lucky none of them broke.

    Great work!! you've done a great job explaining details...thanks for that :)
    i have one question though,,how is the IR camera calibrated?or what is the x,y reference?the origin (0,0) point
    Thanks again,
    Aws