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.
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.
84 Comments
3 years ago
WOW, I used the original Johnny Lee project and I found it very difficult to connect the wiimote to the bluetooth of the laptop, it finally worked but it could not be something very useful for the other teachers, with your work, I think it is possible to do something more comfortable for everyone. Thank you!
4 years ago
Hi! Thank you a lot for this helpful Instructables!
I have a problem with Interfacing my Wii IR Camera sensor with Atmega1284p, my camera has 8 pins with different labeled pins (GND, RST, L-, L+, SDA, SCL, CLK, VCC )
I used your interfacing circuit with the same pull-up resistors and clock circuit and reset circuit, I connect L- and L+ pins to ground, I got nth from the camera ! it didn't send an ACK for its address even!
Please I need some help from you guys ! I'm strugling in this part , Actully it's tha main part of my graduation project , having no time :( !
Question 5 years ago
By the way, you did not use the IR filter on your demo video ? Is it useless ?
5 years ago
It can be useful to make 3D tracking. Maybe will make something that uses this system. Nice instructable dude !
5 years ago
does the camera from clone wiimote perform the same? anybody tried?
Thanks in advance.
6 years ago
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!
6 years ago
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.
6 years ago
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.
7 years ago
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
Reply 7 years ago
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
Reply 7 years ago
I have found this:
http://www.robotshop.com/en/ir-tracking-camera.htm...
Reading the comments, it seems the Wii IR Camera.
Reply 7 years ago
Could you link me where have you bought the ir camera? Thanks in advance :)
7 years ago
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
8 years ago on Step 6
Would be usefull for a sentry gun project. :D
Reply 8 years ago on Introduction
I was thinking the same thing. With a laser designator!
8 years ago on Introduction
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?
9 years ago on Step 2
Why is the inverter needed?
Reply 8 years ago on Step 2
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
8 years ago on Introduction
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?
8 years ago on Introduction
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?