Specs
Genauere Informationen besonders auch wg. dem Data Formats direkt unter: WiiBrew
IR Camera
The Wiimote includes a 128x96 monochrome camera, with an IR-pass filter in front of it. The camera includes a built-in processor capable of tracking up to 4 moving objects (raw pixel data is not available to the host). 8x subpixel analysis is used to provide 1024x768 resolution for the tracked points. The Sensor Bar that comes with the Wii includes two IR LED clusters at each end, which are tracked by the Wiimote to provide pointing information. With the IR-pass filter intact, 940nm sources are detected with approximately twice the intensity of equivalent 850nm sources, but are not resolved as well at close distances. If the filter is removed, it can track any bright object.
The IR Camera is enabled by setting bit 2 on output reports 0x13 and 0x1a:
(52) 13 04 (52) 1a 04
The first enables a 24MHz pixel clock on pin 7 of the camera. The second pulls pin 4 low - probably an active-low enable. Initialization Reminder Remember to set bit 2 (0x04) on the first byte of the Output Reports to write to registers!
The following procedure should be followed to turn on the IR Camera:
1. Enable IR Camera (Send 0x04 to Output Report 0x13) 2. Enable IR Camera 2 (Send 0x04 to Output Report 0x1a) 3. Write 0x08 to register 0xb00030 4. Write Sensitivity Block 1 to registers at 0xb00000 5. Write Sensitivity Block 2 to registers at 0xb0001a 6. Write Mode Number to register 0xb00033 7. Write 0x08 to register 0xb00030 (again)
After these steps, the Wii Remote will be in one of 3 states: IR camera on but not taking data, IR camera on and taking data and half sensitivity, IR camera on and taking data at full sensitivity. Which state you end up in appears to be pretty much random. Repeat the steps until you're in the desired state.
The Wii preforms these steps slightly different, differences in bold:
1. Enable IR Pixel Clock (send 0x06 to Output Report 0x13) 2. Enable IR Logic (send 0x06 to Output Report 0x1A) 3. Write 0x01 to register 0xb00030 4. Write Sensitivity Block 1 to registers at 0xb00000 5. Write Sensitivity Block 2 to registers at 0xb0001a 6. Write Mode Number to register 0xb00033 7. Write 0x08 to register 0xb00030 (again)
Sensitivity Settings
Sensitivity is controlled by two configuration blocks, 9 bytes and 2 bytes long. The following settings are known to work: Block 1 Block 2 Notes 00 00 00 00 00 00 90 00 C0 40 00 Suggested by Marcan 02 00 00 71 01 00 aa 00 64 63 03 Suggested by Cliff 00 00 00 00 00 00 90 00 41 40 00 Suggested by inio (max sensitivity) 02 00 00 71 01 00 64 00 fe fd 05 Wii level 1 02 00 00 71 01 00 96 00 b4 b3 04 Wii level 2 02 00 00 71 01 00 aa 00 64 63 03 Wii level 3 (also Cliff's suggestion) 02 00 00 71 01 00 c8 00 36 35 03 Wii level 4 07 00 00 71 01 00 72 00 20 1f 03 Wii level 5
The last byte of both blocks determines the intensity sensitivity, with increasing values reducing the sensitivity. The Wii Remote will return data for the dimmest objects possible when the last byte of block 1 is 0x41, and second byte of block 2 is 0x00. Setting the sensitivity as high as possible, without unwanted light being tracked, is recommended to achieve the highest subpixel resolution. As the sensitivity is reduced, the subpixel resolution also reduces, approaching the true sensor resolution of 128x96. Data Formats
The IR Camera can return different sets of data describing the objects it is tracking. When the IR camera identifies an object, it assigns it to the first available object slot. If an object moves out of view, its slot is marked as empty (returns 0xFF data), but other objects retain their slots. For example, if the camera is tracking two objects and the first moves out of view, the data returned will be [empty, second object, empty, empty]. With more than four objects visible, the camera is prone to rapidly switching between some of them. This could allow perception of more than four objects, at a reduced response speed and reliability.
The data format MUST match the number of bytes available in the Reporting Mode selected. Even choosing a mode with space for more bytes than necessary will not work, it has to be an exact match.
Basic Mode
In Basic Mode, the IR Camera returns 10 bytes of data corresponding to the X and Y locations of each of the four dots. Each location is encoded in 10 bits and has a range of 0-1023 for the X dimension, and 0-767 for the Y dimension. Each pair of dots is packed into 5 bytes, and two of these are transmitted for a total of 4 dots and 10 bytes.
Extended Mode
In Extended Mode, the IR Camera returns the same data as it does in Basic Mode, plus a rough size value for each object. The data is returned as 12 bytes, three bytes per object. Size has a range of 0-15.
Full Mode
In Full Mode, the IR Camera returns even more data, 9 bytes per object for a total of 36 bytes for all four. The data is split up between two input reports of 18 bytes each (see Data Reporting Mode 0x3e/0x3f). The first three bytes of each object are the same as the extended mode, and are followed by the bounding box of the pixels included in the blob along with a deeper intensity value.