Wednesday, March 17, 2010

Wiimote light follower with servo

Everybody is familiar with the infamous Wiimote. When I look at it, I think about all the useful sensors/gadgets that this little 40$ package (new) comes with. Recently I've been playing with the IR Camera (It's really just a light sensing camera with an IR Filter).This particular camera is a standalone module that outputs coordinates of the 4 brightest "images", all via I2C communication.

I've only seen hacks with the Wiimote cam where the camera is desoldered/removed from the Wiimote. However, at 40$ a pop that seemed like a waste of a perfectly good Wiimote. Instead of removing the cam, I only made 1 small modification, which was drilling a very tiny hole near the camera and soldering a connection to it's "Clock" pin (which needs to be a 24MHz sine wave to replace the internal oscillator). Once you have this done, all you need to do is plug a cord into the Wiimote peripheral port to use anything on its I2C bus.
Moving on, I attached the Wiimote on a homemade stand that was fixed onto a continuous-rotation servo motor (servo without feedback). Add a little duct tape, and that servo isn't moving for at least an hour.


Using an IR Camera library already created (thanks to Hobley – http://www.stephenhobley.com/), I used an Arduino to receive points from the camera and follow the 1st object (light source) that's noticed.

The code can be found here:


http://www.youtube.com/watch?v=Nj7UqjP-z6U

8 comments:

  1. Nice job. I really like that you were able to access the camera without removing it from the wiimote. I am trying to work on a similar project right now. Could you provide some more information on how to connect the wiimote to the arduino? I have the clock signal going into the wiimote already. When I try to power on the wiimote it lights up for a second or two and then powers off. If you would rather, you can email me.
    Thanks,
    Bryon

    ReplyDelete
  2. I don't power the wiimote up. I put 3.3 volts on the i2c bus's power line, wich is for powering the IR cam.

    ReplyDelete
  3. Brian, I have a few more questions if you don't mind. I feel like I am getting close to getting it working but am still not quite there.

    I have connected my cord to the Wiimote and am able to see the data being transmitted (via an oscilloscope) when it is under its own power (not connected to the Arduino). But when I hook it up to the Arduino, I get no response, however, the LED on the Arduino lights up (which if I read your notes correctly means the camera has been initialized).

    Am I correct in assuming the 24 Mhz signal is connected to pin 7 on the camera?

    Can you confirm that my connections are correct?

    Wiimote Arduino
    Pin 1 to 3.3V
    Pin 2 to A5
    Pin 3 to Not Connected
    Pin 4 to Not Connected
    Pin 5 to A4
    Pin 6 to Gnd

    Do you have any suggestion as to what I might be able to check in troubleshooting?

    Thanks in advance,
    Bryon

    ReplyDelete
  4. If you'd like to email me, I can respond quicker.

    dwyer2bp@gmail.com

    ReplyDelete
  5. Bryon -

    The LED doesn't confirm the initialization of the IR Cam if it wasn't hooked up correctly unfortunatly (as it will light up if there is nothing on the I2C Bus at that address).

    From what I understand, you are using the Wiimote Pin numbering that's written on the wiimote board, and sorta like this correct ?:

    | 5 3 1 |
    | 6 4 2 |

    If you are soldering directly to those pins, all looks correct. If you are using a Wii cable, it is color coded when you separate the wires: Green - SDA, Yellow - SCL, etc...

    Let me know your exact setup/code. You can email me, I'm sure that'd be easier.

    ReplyDelete
  6. It's not very clear how and why to connect "to it's "Clock" pin (which needs to be a 24MHz sine wave to replace the internal oscillator)."
    I drill the wiimote, I find a pin (which one?)... then what?
    Any schematic/tutorial available?

    ReplyDelete
  7. How: Pin 7 of the pixart IR camera (located inside the wiimote) is the designated clock pin.

    Why: Making this pin available outside of the wiimote allows you to externally connect a 24MHz clock signal, since you have no control over the oscillator internal to the Wiimote.

    This link contains information/pictures of the wiimote board.

    http://procrastineering.blogspot.com/2008/09/working-with-pixart-camera-directly.html

    Also try googling:
    Pixart Wiimote Arduino
    or
    Stephen Hobley Pixart

    ReplyDelete
  8. Would it be possible to show a better picture of the connections between the Wiimote and Arduino, also how the 25mhtz crystal hooks up.

    ReplyDelete