Wii IR camera as standalone sensor

Here is my progress so far

Here is my progress so far for with the Wii IR Camera and Processing. Sorry, this is my my first program in Processing.

Hmm… I may be missing

Hmm… I may be missing something but the directory looks empty? :)  This is the second or third time I’ve run across Processing in use… I guess I better add it to the very long list of things to explore :slight_smile:

You must open the subfolders

You must open the subfolders to see the sketches ;-). Here for example the Processing sketch folder

 

Question to ROBOTFREAK concerning Wii-camera

Dear Robotfreak, I’m a Picaxe user and when I saw what you achieved with the Wii-camera, I immediately decided to build the same project with the following purpose: if I attach the Wii-camera on the ceiling and if I attach a (or better: 3) IR-leds to the robot vehicle I use (small robot car) that would forever solve the problem of knowing where the robot is located. The camera would simply detect the leds and tell the computer the exact x- and y- coordinates of the robot.

That would be a really usefull achievement !!

BUT: I don’t get the camera to work. I’m used to soldering and the print with 24 MHz oscillator, a few resistors and a condensator was build and checked (and rechecked) in an hour (taking out the camera took more time !!) If I use the Picaxe’s I2C read commands, I see a coherent row of numbers passing by, but the waving of a candle or an IR-led does not change the output (Both Picaxe and camera runn well on 3.3 V).

My (somewhat stupid) question to you now is: is it necessary to initiate the camera first? I regrettably don’t understand that much of the program that you provided (I’m used to the extremely simple Picaxe language), although there is something about initiating the camera. What I did is the following: I used the I2Cwrite command of the Picaxe to send the bytes to the addresses that I understood from your program, but that does not change anything in the readout!

So I’m "stuck in sight of the harbor"as we call it.

Could you please explain in a few simple words if initialisation is necessary at all, and how it is exactly done?

Thanks very much in advance for your efforts.

Kind regards,

Ronald

I can’t be of much help

I can’t be of much help regarding the Wiimote camera comms issue, but when I read your post I immediately was reminded of this project by Gareth.
If you haven’t seen it already go check it out, you might be able to find some useful info to help with your project there.

Hi Ronald,I’ve no PICAXE

Hi Ronald,

I’ve no PICAXE programming expirience, but I can give some pseudocode about the program. Yes, the sensor needs to be initialized, otherwise it will not work. One important thing about the I2C slave adress. For the Wii this is 0x58 these are the upper 7 bits. The lowest bit is the R/W bit. Don’t know about how PICAXE handles the I2C adress. Very often a 8-Bit slave address is used (including R/W Bit). In this case the I2C Write Adress is 0xB0 and the Read Address 0xB1.

Here is the pseudocode:

Setup:

Initialize I2C, Slave Address 0x58

Write I2C 0x30, 0x01

Delay 10ms

Write I2C 0x30, 0x08

Delay 10ms

Write I2C 0x06, 0x90

Delay 10ms

Write I2C 0x08, 0xC0

Delay 10ms

Write I2C 0x1A, 0x40

Delay 10ms

Write I2C 0x33, 0x33

Delay 10ms

 

Loop:

  Write I2C 0x36

  Read I2C <16 Bytes>

End Loop

Dear Robotfreak, I’m not

Dear Robotfreak, I’m not sure if my E-mail/post of earlier today reached you, but anyway, this is to tell you that thanks to your help the camera is now (finally) running with a Picaxe microprocessor! We’re now able to track a robot carrying an ir-led on the screen of the PC.

Finally, the tracking problem is solved !!

Thanks again for sharing your information and schemes with the forum and for your additional help.

Best regards,

Ronald.

For those interested in connecting the Wii to a picaxe, here´s my program±

pause 1000
i2cslave 0xB0, i2cslow, i2cbyte
pause 500
 
 
writei2c 0x30, (0x01) ; camera on
pause 100
writei2c 0x30, (0x08)
pause 100
writei2c 0x06, (0x90) ;sensitivity part 1
pause 100
writei2c 0x08, (0xC0) ;set sensitivity part 2
pause 100
writei2c 0x1A, (0x40) ;set sensitivity part 3
pause 100
writei2c 0x33, (0x03) ;set the mode
pause 100
writei2c 0x30, (0x08)
pause 100
 
 

 

writ:

writei2c (54)

readi2c (b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12)

b0=b4
w10 = bit72
w10 = w10+bit6
w10=w10
255
w10=w10+b3

w11 = bit52
w11 = w11+bit4
w11=w11
255
w11=w11+b2

sertxd (" “,#w10,” “,#w11,” ",13,10)

pause 1500
goto writ

That’s great. Now we have

That’s great. Now we have Arduino and Picaxe working with the Wiimote camera. Looks like Gareth is working on a Propellor port at the moment.

Source for the camera?

Has anyone found a source for the camera?  I mean, other than hacking appart a Wii remote?

source for the camera

not really, BUT I’ve just bought 2 of these

http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=160568614704&ssPageName=STRK:MEWNX:IT#ht_2443wt_1002

and at least the 1st one that I’ve opened, seems to be working…

 

You can find more details, including plenty of pictures :slight_smile: and C# code for a .NET micro framework board, on my blog here:

http://trandi.wordpress.com/2011/04/03/the-wiimote-and-fez-domino/

 

Hope this helps…

dan

 

 

HI

How do I know if the camera is fried?

Hard to say. I would double

Hard to say. I would double check the cabling. If you don’t get a response from the sensor, it should be dead. Do you use a quartz oscillator? A normal crystal will not work.

Sorry for the late reply.I

Sorry for the late reply.

I think my sensor is dead already. My pin configuration is wrong XD

I used this oscillator http://philippines.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=5475588. Is this good enough? If not what can you suggest for me to use.

and can i just buy your

and can i just buy your detach sensor. i dont want to buy a new one and detach it on my own again. i urgently need it for my project T___T

one more question. is it

one more question. is it possible to just use the 5v and 3.3V simultaneously of Arduino directly so i will not make anymore circuit for the conversation of voltages from 5v to 3.3V

Hi,sorry, but I will not

Hi,

sorry, but I will not sell my sensor. Maybe you will find a defect Wiimote at eBay.

This oscillator will be ok for this purpose.

Yes, you can use the 3.3V from Arduino to power the sensor. But you will need 5V for the oscillator, or you maybe find a 3.3V oscillator.

 

what i mean for the voltage

what i mean for the voltage is to directly use the 5V of arduino to the oscillator as well as the 3.3V for the sensor 

Yes, that will work. The

Yes, that will work. The diodes are not needed, than. Not sure about the capacitors.

Question

is it necessary to use Atmel ATmega328?

I’m just using ATmega168.

No it is the same chip for

No it is the same chip for the most part.