IR Sensor
From Wiimote Wiki
Contents |
Register Memory Map
| Register Memory Map | |
| 0xB00000 | UNKNOWN |
| 0xB00001 | 0x00 |
| 0xB00002 | 0x00 |
| 0xB00003 | 0x71 |
| 0xB00004 | 0x01 |
| 0xB00005 | 0x00 |
| 0xB00006 | MAXSIZE |
| 0xB00007 | 0x00 |
| 0xB00008 | GAIN |
| 0xB0001A | GAINLIMIT |
| 0xB0001B | MINSIZE |
| 0xB00030 | CONTROL |
| 0xB00033 | MODE |
UNKNOWN: Wii uses values: 2 (standard) and 7 (max sensitivity). No known function.
MAXSIZE: Maximum blob size. Wii uses values from 0x62 to 0xc8.
GAIN: Sensor Gain. Smaller values = higher gain.
GAINLIMIT: Sensor Gain Limit. Must be less than GAIN for camera to function. No other effect?
MINSIZE: Minimum blob size. Wii uses values from 3 to 5
CONTROL: Write 1 before configuring camera, 8 when done.
MODE: output format, 1, 3, or 5. See output formats below.
Other values: As used by Wii. Function not known.
These registers are mirrored every 0x100 bytes up to 0xB1FFFF
Wavelengths
| The following section or page relates to parts of the Wii Remote that are poorly understood. Research and contribution in these areas is encouraged. |
The sensor is at least 5 times more sensitive to 940nm than 850nm. This disparity increases slightly with the removal of the filter window. Relative sensitivity to visible is not known.
Initialization
Eight commands need to be issued to initialize the camera and request data from it. After each command, wait for the 0x22 command status report and re-issue the command if it isn't received in a reasonable time. Note that all writes are to register addresses (set 0x04 bit in first byte of the write report payload).
- Enable IR Pixel Clock (report 0x13)
- Enable Camera (report 0x1A)
- Configure Camera:
- Write 0x01 to register 0xb00030
- Write configuration block 1 to registers 0xb00000-08 (9 bytes)
- Write configuration block 2 to registers 0xb0001A-1B (2 bytes)
- Write mode number to register 0xb00033
- Write 0x08 to register 0xb00030
- Select output report compatable with mode (report 0x12)
Configuration
The camera configuration is somewhat unknown. Shutter time and frame rate appear to be directly determined by the pixel clock, which is an external input not controllable via software. The following settings, however, can be controlled over bluetooth:
Sensor Gain
The byte labeled GAIN controls the camera gain. Lower values result in higher sensitivity. Numerical gain is proportional to 1/2^(n/16) for n<0x40, but decreases more linearly after that. Translation: for small values, dropping this value by 0x10 doubles sensitivity. Usable values are from about 15 to 254. Below that results in noise and streaking becomes significant and the camera doesn't function for a value of 255.
A configuration byte in the second block, GAINLIMIT, must have a value less than GAIN for the camera to function. Otherwise it appears to have no effect. This byte may be related to an automatic gain control feature, but the enable for this feature has not been found.
Blob Size Range
The bytes labeled MAXSIZE and MINSIZE controls the range of of a blob sizes that will be reported. The numbers appear to be approximately the number of sensor pixels in the blob blob can occupy.
For max, the Wii uses values in the range 0x62 to 0xC8, but values as low as 0x20 can be useful in specialized situations. Small values can be useful for controlling background noise and if point merging when tracking multiple points would have negative consequences. Large values allow large, unfocused, or diffuse blobs to be tracked.
For min, very small numbers work best. The Wii uses values from 3 to 5, depending on sensitivity settings.
Output Formats
Short
Output Mode value: 1
Usable with reports 0x36 and 0x37
| BYTE | BIT 7 | 6 | 5 | 4 | 3 | 2 | 1 | BIT 0 |
| 0 | X0[7:0] | |||||||
| 1 | Y0[7:0] | |||||||
| 2 | Y0[9:8] | X0[9:8] | Y1[9:8] | X1[9:8] | ||||
| 3 | X1[7:0] | |||||||
| 4 | Y1[7:0] | |||||||
| 5 | X2[7:0] | |||||||
| 6 | Y2[7:0] | |||||||
| 7 | Y2[9:8] | X2[9:8] | Y3[9:8] | X3[9:8] | ||||
| 8 | X3[7:0] | |||||||
| 9 | Y3[7:0] | |||||||
Medium
Output Mode value: 3
Usable with report 0x33
The following structure is repeated 4 times.
| BYTE | BIT 7 | 6 | 5 | 4 | 3 | 2 | 1 | BIT 0 |
| 0 | X[7:0] | |||||||
| 1 | Y[7:0] | |||||||
| 2 | Y[9:8] | X[9:8] | S | |||||
Long
Output Mode value: 5
Usable with report 0x3E/F
The following structure is repeated twice in each report.
| BYTE | BIT 7 | 6 | 5 | 4 | 3 | 2 | 1 | BIT 0 |
| 0 | X[7:0] | |||||||
| 1 | Y[7:0] | |||||||
| 2 | Y[9:8] | X[9:8] | S | |||||
| 3 | 0 | XMIN | ||||||
| 4 | 0 | YMIN | ||||||
| 5 | 0 | XMAX | ||||||
| 6 | 0 | YMAX | ||||||
| 7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 8 | INTENSITY | |||||||

