collapse

* Posts Recentes

O que é isto ? por SerraCabo
[12 de Abril de 2024, 14:20]


Amplificador - Rockboard HA 1 In-Ear por almamater
[11 de Abril de 2024, 20:46]


Emulador NES em ESP32 por dropes
[10 de Abril de 2024, 15:30]


Meu novo robô por josecarlos
[29 de Março de 2024, 18:30]


Bateria - Portátil por almamater
[25 de Março de 2024, 22:14]


Escolher Osciloscópio por jm_araujo
[06 de Fevereiro de 2024, 23:07]


TP4056 - Dúvida por dropes
[31 de Janeiro de 2024, 14:13]


Leitura de dados por Porta Serie por jm_araujo
[22 de Janeiro de 2024, 14:00]


Distancia Cabo por jm_araujo
[08 de Janeiro de 2024, 16:30]


Laser Engraver - Alguém tem? por almamater
[16 de Dezembro de 2023, 14:23]

Autor Tópico: Hacking the Wiimote IR camera  (Lida 5404 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline TigPT

  • Administrator
  • Mini Robot
  • *****
  • Mensagens: 5.372
    • Tiago Rodrigues
Hacking the Wiimote IR camera
« em: 23 de Novembro de 2008, 11:33 »
[centrado:l7df0psv][/centrado:l7df0psv]
You can connect to the Wii remote over bluetooth or use an Arduino to send peripheral data to the Wiimote, but what if you want to interface directly with the Wiimote's IR camera? The sensor is particularly good at tracking coordinates for 1 to 4 points—it could be a simple way to add sophisticated tracking capabilities to your own project.

David Cranor writes,

There is a great site about hacking the wiimote IR camera to interface it with a computer - but it's all in Japanese! Perhaps you could post these links and see if anybody could translate it?

This page details how to desolder the camera itself and build a standalone circuit for it so that it can be connected to an I2C bus, and subsequently a computer (i think, anyway - the schematics are in English, and there's a video).

And this page talks about how to connect the camera to an Arduino via some of I2C shield that he's built.

I'd really like to have access to this information for my projects, so if somebody would be able to translate these pages, that would be awesome!

A quick run through Google's Japanese to English translator yielded a reasonably understandable result:

Wii IR sensor connection details
Connecting the Wii IR sensor to Arduino

The second link contains a wealth of information on talking to the IR sensor over I2C, including some details on adjusting sensitivity parameters. The translation is a little rough, but combined with some of the sample code, I think I have the gist of it:

To initialize the IR camera, you have two options: 1) a simple, default initialization or 2) an initialization that allows you to specify 4 configuration parameters that affect the sensitivity of the device.

Simple Initialization:
Just write the following byte sequences, with a small delay between writes (assumes a successful ACK). The first byte on each line is the register you are writing to.
0x30 0x01
0x30 0x08
0x06 0x90
0x08 0xC0
0x1A 0x40
0x33 0x33

Initialization with sensitivity setting:
The author defined 5 sensitivity levels, and there are four parameters (p0, p1, p2, p3) that are adjusted for each level. Here are the settings:

Level 1: p0 = 0x72, p1 = 0x20, p2 = 0x1F, p3 = 0x03
Level 2: p0 = 0xC8, p1 = 0x36, p2 = 0x35, p3 = 0x03
Level 3: p0 = 0xAA, p1 = 0x64, p2 = 0x63, p3 = 0x03
Level 4: p0 = 0x96, p1 = 0xB4, p2 = 0xB3, p3 = 0x04
Level 5: p0 = 0x96, p1 = 0xFE, p2 = 0xFE, p3 = 0x05

Quoting the Wiimote Wiki IR sensor page, these parameters correspond to:
p0: MAXSIZE: Maximum blob size. Wii uses values from 0x62 to 0xc8
p1: GAIN: Sensor Gain. Smaller values = higher gain
p2: GAINLIMIT: Sensor Gain Limit. Must be less than GAIN for camera to function. No other effect?
p3: MINSIZE: Minimum blob size. Wii uses values from 3 to 5

Either pick your own custom settings for the parameters, or choose them from one of the 5 levels above, then send the following data to the device:

0x30, 0x01
0x00, 0x02, 0x00, 0x00, 0x71, 0x01, 0x00, p0
0x07, 0x00, p1
0x1A, p2, p3
0x33, 0x03
0x30, 0x08

The author also links to the following source, which serves as a helloworld for reading sensor data directly from the IR camera:
Wii Remote IR sensor test for Arduino
Wii Remote IR sensor test for ATMEGA168

Finally, since the IR sensor is a 3.3v device, you'll want to do a little voltage conversion before interfacing it directly with a 5v device like your typical Arduino (Arduino Pro users don't have to do a thing). Sparkfun has a guide for using 3.3v electronics with 5v microcontrollers, which should be all you need. It makes me wonder if anyone sells a pre-built 3.3v shield.

Hopefully this is all you'll need to get things working. Make sure to send us a tip if you make something cool using the Wii IR sensor.

Offline zipp

  • Mini Robot
  • *
  • Mensagens: 15
Re: Hacking the Wiimote IR camera
« Responder #1 em: 23 de Novembro de 2008, 14:09 »
Para quem está à vontade com o max/msp há uma maneira indirecta de ligar ao arduino:
Este patch/object http://ether.tw/blog/?p=74 reconhece o wiimote ligado por bluetooth e o nunchuck se for o caso, separa todas as informações (botões, acelerometros, leds, rumble). Se se fizer serialout para o arduino faz o mesmo mas de uma maneira um bocado rebuscada (e que envolve sempre um pc) mas permite trabalhar os valores no max/msp.

Para já fiquei contente só de ver as infos do wiimote no max e não fiz mais nada de útil. :) Ou sugestões de onde comprar baratos?

Offline TigPT

  • Administrator
  • Mini Robot
  • *****
  • Mensagens: 5.372
    • Tiago Rodrigues
Re: Hacking the Wiimote IR camera
« Responder #2 em: 23 de Novembro de 2008, 14:16 »
Eu por acaso já ando à algum tempo para comprar um comando da wii para esse fim, não com o max, mas para ligar ao java. Quem sabe quando tiver mais tempo para brincar com ele eu o compre. Quanto aos servos também gostava de saber ;)