I spent to much time on LetsMakeRobots. LMR not only has project pages and a forum about robots but it also has a shoutbox. It’s a place where robot builders of all ages and locations come together to talk about robots and electronics. One of the people I have met on the shoutbox is “Chris the carpenter”. He is the man behind Rocket brand studios, a small online shop that sells robots and parts for robots.
While browsing the Rocket brand studios website I came across the WiiCamera sensor. I found a really cool video that demonstrated the WiiCamera and just had to have one, so I ordered 2 🙂
The WiiCamera is a tiny IR camera that comes out of a WiiMote. The camera has an I2C interface and can see up to 4 IR light sources. For every IR light source the camera outputs an X/Y position, size and brightness. Rocket brand studios sells the sensor on a PCB with the necessary components to make it work. To Hook it up to an Arduino you connect the camera to 3V3, 5V and SDA/SCL for the I2C connections.
Reading data from the sensor is easy because Stephen Hobley has written the PVision library for the WiiCamera. It comes with an example sketch, reading data from the sensor is very straight forward. It took me only a couple of minutes to make it work. I then mounted the sensor on a pan/tilt bracket with 2 small servos. The sensor comes with the original IR shield of the WiiMote. It’s a little plastic thing, I mounted it in front of the sensor else I had some interference with the fluorescent lights in my room. And then I started writing a sketch to track an IR led with the WiiCamera…
After a big struggle I came up with a sketch so that the WiiCamera tracks an IR light source pretty accurately. Next step is to integrate this code in the sketch of one of my robots. You can do all sorts of fun things with it. Let one robot follow another, or hold a candle/IR led in front of the robot and let it follow you while you walk around.
I find it pretty strange that this sensor doesn’t get more attention. It works very well and can be used for lots of cool things. It is not cheap though @ 35$, but I think it’s well worth it’s price. You can get the sensor cheaper if you can find a broken WiiMote with a working sensor. You can harvest the sensor out of the broken WiiMote and make your own PCB to mount it on.
This is the sketch I used in the video:
// http://wwww.bajdi.com // WiiCamera tracking IR light source (IR led, lighter, candle) // WiiCamera mounted on pan/tilt kit, 2 SG90 servos // WiiCamera data: // blob X = 0 IR source on the right // blob X = 1024 IR source on the left // blob Y = 0 IR source top // blob Y = 1024 IR source bottom #include <Servo.h> #include <Wire.h> #include <PVision.h> Servo panServo; Servo tiltServo; PVision ircam; int panServoLeft = 2000; int panServoCenter = 1380; int panServoRight = 600; int panServoPos; int tiltServoUp = 650; int tiltServoCenter = 1250; int tiltServoDown = 1800; int tiltServoPos; byte result; #define runEvery(t) for (static typeof(t) _lasttime;(typeof(t))((typeof(t))millis() - _lasttime) > (t);_lasttime += (t)) void setup() { ircam.init(); delay(50); panServo.attach(46); panServoPos = panServoCenter; panServo.writeMicroseconds(panServoPos); tiltServo.attach(47); tiltServoPos = tiltServoCenter; tiltServo.writeMicroseconds(tiltServoPos); delay(500); } void loop() { runEvery(20) { result = ircam.read(); // get the results from the ircam if (result & BLOB1) // IR detected { if (ircam.Blob1.X < 450 && panServoPos > panServoRight) { panServoPos -= 10; } if (ircam.Blob1.X > 550 && panServoPos < panServoLeft) { panServoPos += 10; } if (ircam.Blob1.X <= 550 && ircam.Blob1.X >= 500) // IR light close to center { panServoPos += 1; } if (ircam.Blob1.X < 500 && ircam.Blob1.X >= 450) // IR light close to center { panServoPos -= 1; } if (ircam.Blob1.Y < 450 && tiltServoPos > tiltServoUp) { tiltServoPos -= 10; } if (ircam.Blob1.Y > 550 && tiltServoPos < tiltServoDown) { tiltServoPos += 10; } if (ircam.Blob1.Y <= 550 && ircam.Blob1.Y >= 500) // IR light close to center { tiltServoPos += 1; } if (ircam.Blob1.Y < 500 && ircam.Blob1.Y >= 450) // IR light close to center { tiltServoPos -= 1; } } else { // no IR detected = center the servos if (panServoPos > panServoCenter) // center pan servo { panServoPos -= 10; } if (panServoPos < panServoCenter) // center pan servo { panServoPos += 10; } if (tiltServoPos > tiltServoCenter) // center tilt servo { tiltServoPos -= 10; } if (tiltServoPos < tiltServoCenter) // center tilt servo { tiltServoPos += 10; } } panServo.writeMicroseconds(panServoPos); tiltServo.writeMicroseconds(tiltServoPos); } }
I was just looking for some info about this exact Wii IR camera kit and came across your blog. Thanks for the info. I guess the kit is pretty easy to use on an Arduino. I’ll probably get a kit soon.
Hi,
I would like to buy 5 module full sensor the wii camera.
Do you have available?
If you have, please give me condition to buy it!
Regards,
Bach.
I bought my WiCamera from Rocketbrandstudios, please contact them.
Is there a possibility to buy such a sensor for an arduino now? I cannot seem to find one on the internet, help would be much appreciated. 🙂
Is there any chance to get this board any more ,I am very keen to purchase ,If possible please contact me ,If there is circuit diagram then my soldering is fine ,
But very happy to pay
Sorry, I don’t think you can buy the board anymore. You could built your own, you can harvest the sensor out of a wii remote. See this tutorial: https://www.instructables.com/id/Wii-Remote-IR-Camera-Hack/