Author Topic: red laser and I2C bus (done)  (Read 29844 times)


Offline Iceman1979

  • *
  • Posts: 40
  • Karma: +1/-0
    • View Profile
Reply #1 on: March 12, 2008, 10:58:26 AM
What logic is in your micro controller? ie... what is it reading frome the camera, what kind of data are you getting from the camera? Is this micro controller communicating to the pc via the serial bus?

thanks
John



Offline sha

  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Reply #2 on: March 12, 2008, 02:42:48 PM
>What logic is in your micro controller? ie... what is it reading frome the >camera, what kind of data are you getting from the camera? Is this micro >controller communicating to the pc via the serial bus?

Hmm, microcontroller reads several bytes directly from camera using standard I2C bus. These bytes contain an inforamtion about coordinates and brightness of spots. What to do with this depends on project, here I just sending them to PC for demonstration via RS232.



Offline ZaPPZion

  • *
  • Posts: 137
  • Karma: +11/-1
    • View Profile
Reply #3 on: March 12, 2008, 05:10:02 PM
wow that's certainly amazing!
What kind of microcontroller did you use btw?
I think this is really some inventive stuff. The 200Hz frequency is quite a lot.
I've just had the I2C subject @ school, so i know what it takes. Didnt expect the camera to be accessed this easily :)
Great project!



Offline Iceman1979

  • *
  • Posts: 40
  • Karma: +1/-0
    • View Profile
Reply #4 on: March 12, 2008, 07:50:12 PM
Quote
Didnt expect the camera to be accessed this easily

Me either... wow that is to cool. Makes me want to break out my micro controller and play with it :)



Offline inio

  • Wiki Admin
  • *
  • Posts: 124
  • Karma: +5/-0
    • View Profile
    • my Wii Remote projects
Reply #5 on: March 13, 2008, 02:52:00 PM
Did you build an I2C sniffer to RE the control signals?

Are you planning on documenting the I2C frames used to work with the camera?



Offline cptkoolbeenz

  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Reply #6 on: March 27, 2008, 11:23:05 PM
Do you have any more info/sample code for this hack?  I would really appreciate any insight, as I was about to use an I2C sniffer and do the same thing myself...



Offline Jojo

  • *
  • Posts: 9
  • Karma: +1/-1
    • View Profile
Reply #7 on: March 30, 2008, 02:16:26 PM
Here’s how I get this to work:
Remove Pixart sensor from wiimote.
The sensor needs a 25 MHz clock signal here’s a circuit and pinout:
http://www.kako.com/neta/2007-001/2007-001.html
Connect the Sensor to your MC (don’t forget the pullups)
The slave address is 0xB0.
Initialise like here
http://www.kako.com/neta/2006-019/wii_ir_test2_src.zip
http://www.kako.com/neta/2006-019/2006-019.html
Now send 0x38
Capture 8 Bytes from slave
Capture 4 Bytes from slave
(I’ve seen this by sniffing the Bus)
I’m not sure about how to interpret the data(Haven’t even tried this yet, maybe it’s like the basic report?)

Some tips:
Kako.com is Japanese I’ve used babelfish to translate to English http://babelfish.altavista.com/
You can connect the sensor to the extension port and use the wiimote as usual. (With 25MHz Clock extern)
If you have problems with desoldering the sensor you can carefully break the case of the sensor. There is a second SMD case around the cam. I’m not responsible on any damages!

Please share your experience with the community.
If somebody knows how to remove the IR filter please post it here!
Does somebody know if the sensor can be used with 5V?
« Last Edit: April 01, 2008, 06:47:19 AM by Jojo »



Offline cptkoolbeenz

  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Reply #8 on: March 31, 2008, 08:15:12 PM
Very cool...  I am getting an I2C sniffer this week.  I will do my best to translate the websites to english - I know someone that can do it.

I will post any findings...

In the meantime, if anyone else has more info, please post!



Offline Jojo

  • *
  • Posts: 9
  • Karma: +1/-1
    • View Profile

Offline Antonio

  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Reply #10 on: April 04, 2008, 10:30:13 PM
Could this work with an Arduino Board?



Offline CaptainN

  • *
  • Posts: 3
  • Karma: +1/-0
    • View Profile
Reply #11 on: April 08, 2008, 04:46:09 AM
I still didn't get it work properly with my I2C / USB interface (Devantec). I'll try to initialize the IR sensor like in the routine Wii_IR_init(). Afterwards I send the suggested 0x38, so I'm not sure to which internal address?! I tried 0x00 and 0x30 but nothing works. If I request afterwards 8 bytes of data I get nothing back. Maybe there is a specific address again to read from? Any comments would be welcome!



Offline Jojo

  • *
  • Posts: 9
  • Karma: +1/-1
    • View Profile
Reply #12 on: April 08, 2008, 10:48:37 AM
Do you a get a ACK from 0xB0?



Offline Jojo

  • *
  • Posts: 9
  • Karma: +1/-1
    • View Profile
Reply #13 on: April 08, 2008, 11:42:05 AM
0xB0 is the slave address of the device. 0x38 the register or internal address to Read the IR Values from.

Sample Code:

#define TARGET_ADDR 0xB0
//[...]
//initialize
//[...]
u08 rxdata[14];
u08 buf[2];
buf[0]=0x38;
i2cMasterSend(TARGET_ADDR, 1, buf);//send 0x38 to slave 0xB0
i2cMasterReceive(TARGET_ADDR, 8, rxdata);//get 8 data Bytes from 0xB0
rxdata[8]=0;// null-terminate received string
rprintfStr(rxdata);
i2cMasterReceive(TARGET_ADDR, 4, rxdata);//get another 4 data Bytes from 0xB0
rxdata[4] = 0;// null-terminate received string
rprintfStr(rxdata);



Offline CaptainN

  • *
  • Posts: 3
  • Karma: +1/-0
    • View Profile
Reply #14 on: April 10, 2008, 04:13:18 AM
Thanks for the sample code. I start to get some values but they seem to be too random to correspond actually to the medium report 0x33 output format. (Tested with different positions of the led bar). Maybe the initialization is still wrong. Is the camera sending a specific ACK signal I could check?
My Devantec I2C board just gives me a SUCCESS (1) on sending data but of course I don't look for a specific response from the IR sensor.
Furthermore I write the data to the camera using I2C write for devices with 1 byte register, so the first init line looks like this:

(Interface I2C CMD, 1 Byte REG), (I2C Device Addr), (Device Internal REG), (Byte count), (Data)

0x55, 0x0B, 0x30, 0x01, 0x01

The original code was like:

buf[0] = 0x30; buf[1]=0x01;
Report_0x16...(0xB0, 2, buf);
usleep(delay);

Is there still a mistake in the initalization? Should I look for a camera response (which) after init? Is the IR sensor a device with a 1 byte register or should I send everything just to 0xB0?

If I connect the custom build board with SCL / SDA external to the Wii the IR sensor is just working fine...

Thanks!

« Last Edit: April 10, 2008, 04:16:44 AM by CaptainN »