Professional Documents
Culture Documents
My translation of http://kako.com/neta/2008-009/2008-009.html:
Suneth Attygalle
1.
Make a shield for the Arduino and house the sensor
DIAGRAM
The components are the wii remote ir sensor and I2C voltage converting shield and an Arduiono
Diecemilia. You have convert 5V of the microcontroller to 3.3 for the sensor. He used the same
circuitry as the prior post and the schematic is posted.
The LTC4301L was used for voltage conversion, the LTC4301 works as well. This chip powers
the I2C bus.
2. software
The Arduino source code was prepared.
Setting up the wii remote ir sensor with Bluetooth is much easier because you didn’t have to deal
with “chip enables” and clock oscillators.
For now, with certain commands, we can get some actions from the sensor.
The above settings are the easy way to do it but if you want to specify the settings, you must
specify four parameters in the following procedure:
For the multiple byte writes, the register address automatically increments so you can write the
bytes in succession.
After initializing the sensor, it is possible to return the coordinates of a luminous point detected
by the sensor.
The 3 byte packets are decoded (if considered as XX,YY,SS) using the following calculation:
X coordinate = (SS & 0x30) <<4 + XX
Y coordinate = (SS & 0xC0) <<2 + YY
*****
The infrared remote control from the CMOS sensor board to remove the 8-(4-pin column × 2)
connectors to attach to it.
First, the eight-pin functions on inquiry. Results are as follows.
Photo on the right side of a pin board, which in turn zigzag-shaped pins are lined up.
Then, above the IR sensor is whether the move sure to check the circuit to his own writing.
(2007.1.31 fourth pin is expanded later date, # CE signal so, GND should be dropped.)
The photo actually assembled circuit
Wii remote control IR sensor removed from the board of the contents of Vcc, SCL, SDA, GND
of only four out of line, the circuit is connected to him.
In a state of connection with the remote control to operate it, restored to confirm moving in the
IR sensor.
By the way, the Wii remote control also extended I2C port signals that have been found. Classic
or nunchaku controller and I2C communications and using the bus.
I2C is a hot-swap so the application can be used once. UIU.
3-pin expansion port has been found in the state of the cable cut by the middle of
NUNCHAKUKONTORORA will not lead the state to freeze the Wii remote control. Do not
freeze the above relay in a manner that can be connected. (2007.1.30 expansion ports, expanding
later date No. 1 and No. 3 pin-up and continuity of the freeze, and then tried to reproduce it
failed. Probably miss working with other signals short of the freeze I think.)
Not just IR sensor, I2C bus, if you can connect devices, Wii remote control port expansion can
be. Wii remote control means you do-it-yourself peripherals to extend it is possible.
In other words,
1 ... I2C port extended the application of some kind of signal wire I2C devices connected to the
peripherals to operate in a do-it-yourself can be.
Application of two expansion ports ... Connecting to a PC remote control, command and every
other state, I2C signal lines to connect to another master of the remote control from outside the
remote control device of the internal I2C EEPROM and access You can.
Inside the remote control attached to the bus I2C EEPROM is present. Mii's Bluetooth ID
seems to record the data. So far, but unconfirmed reports, EEPROM Wii remote control CPU is
loaded and executed like a binary OBOSHIKI have been recorded, it seems, this is true
EEPROM renewal of arbitrary code with Wii Remote Control On the run might be possible to
hack. EEPROM is the application of the above two ways expansion ports, you can retrieve it is
possible, but is difficult to rewrite. Also via Bluetooth, EEPROM in the back of the address is
unable to read and write in the lock. EEPROM to disassemble the remote control to remove non-
renew a direct way is not so good.
Then, Homemade IR sensor board, Wii remote controls and other devices connected to the I2C
master it.
And write at a conclusion, IR sensors to send and receive commands as well as the Wii remote
control and infrared sensor bar that can detect the source. (2007.1.25)
PC in order to use the I2C bus, DeVaSys's USB-I2CIO the use of peripherals. USB connection
to PC, I2C devices function as a master. In addition to general-purpose I / O functions with.
|~~_____~~|
| |
| 6 4 2 |
| ----- |
| 5 3 1 |
\_________/
1 Red 3.3V
4 - Not connected.
6 White Ground
Notes
Small stories 2008-009
Wii's remote controller connected to microcontroller infrared sensors to try to use the (+ mouse),
Last year (2007), Wii remote control infrared sensors for analysis pointing to a way to connect
to other devices tried.
Following that, this time, AVR microcontroller using a Arduino experimental kit to connect to
the circuit did. (2008-04-13)
1. Hardware
Wii remote control infrared sensor circuit voltage I2C Arduino Diecimila Shield
In more than three parts are organized.
Infrared sensor operates on 3.3V and, 5V microcontrollers in the works to connect to the need
for voltage conversion.
Wii remote control infrared sensor circuit, a circuit before the same thing and then re-compact.
I2C voltage conversion sealed the Prototype Shield for a prototype using a universal substrate.
2. SOFTWARE
The last time the original source code, Arduino software was created for.
[Wii_remote_ir_sensor_sample.zip - source code (download)]
I2C bus protocol standards, to communicate with the device, the first device to address the need
to send.
Wii remote control is used to address the infrared sensor, 0x58.
0xB0 to the source code can be written and will address it in the top seven bits, one bit lower R /
W bit to be specified, is to shift.
Initialization of the sensor, Wii remote control to the internal sensor via Bluetooth to access
more easily.
Because the chip enable and control the clock oscillation circuit ON / OFF control is not.
Command initialization procedure (1) control register address 0x30 to 0x01 to write data (2) for
control register address 0x30, 0x08 to write data (3) for control register address 0x06, 0x90 data
to write ( 4) for control register address 0x08, 0xC0 written to a data (5) control 0x1A register
addresses to write data to 0x40 (6) for control register address 0x33, 0x33 to write the data,
described below Sensitivity to a set of simplified procedures such as MONORASHII.
Infrared sensors on the sensitivity of the above, how to set up a simple as setting, but if you want
to set the four parameters p0, p1, p2, p3, specifying the steps to write the following: (1) Register
address control 0x30, 0x01 to write data (2) for control register address 0x00, 0x02, 0x00, 0x00,
0x71, 0x01, 0x00, p0 to write (7-byte write)
(3) for control register address 0x07, 0x00, p1 write a (2-byte write)
(4) for control register address 0x1A, p2, p3 write a (2-byte write)
(5) for control register address 0x33, 0x03 to write data (6) for control register address 0x30,
0x08 to write data at multiple-byte write increment the register address will be automatically be
able write in a row .
After the initialization (after the sensitivity setting), a sensor to detect the coordinates of the spot
of light that can be read.
How to read sensor output [START conditions] [0xB0] [0x36] [STOP KONTISHON]
After sending the command, read as follows.
[START conditions] [0xB1] [data readout] x 16bytes
3 bytes of data each read the following format that is stored in the order.
[Back 1byte] [coordinates 1 ... 3bytes] [coordinate 2 ... 3bytes] [coordinate 3 ... 3bytes]
[coordinate 4 ... 3bytes]
Address the role of the control register 0x00 ~ 0x08 --- set parameters for detection address
0x1A ~ 0x1B --- set parameters for detection (2)
0x30 --- address the behavior of the sensor mode (?) In the first post 0x01, 0x33 --- address and
then write a 0x08 mode of operation of the sensor (?) 0x03 (or 0x33?) To write
Setting the parameters for the detection of unknown camera and image processing to detect a
spot of light sensor inside the software to set the parameters of the threshold value of two values,
or the size of the spot of light or the parameters of the threshold value I guess there is not.
Wii remote control using infrared sensors use a mouse to give it a try
Previously, Wii remote controls placed on the desk with the built-in remote control using
infrared sensors determine the amount of moving around and can detect whether or not tried.
The sensor bar like the genuine side to side and stood around in two-point light sources (depth)
to detect the direction of the movement of the amount available, but the precision of mouse that
did not used to it.
The optical system to external components, the amount of moving around in the direction of an
accurate and thought about how to detect. (2008-08-05)
Wii remote control will slide easily on a desk to lay a mouse pad.
In the upper left of the mouse pad and a fixed-infrared light-emitting diodes.
On the left than the light-emitting diodes, light emitting diodes in the upper keep a high level.
The Wii remote control infrared sensors to the end of the half-mirror mounted on a slope of 45
degrees. Wii remote control to work together to install.
Half the effect of mirrors, infrared sensors and the left upper light-emitting diodes can be
detected at the same time.
Remote control to move from side to side and top spot of light-emitting diodes on both sides of
the screen as the movement is detected.
Move back and forth with the remote control, left the spot of light-emitting diodes on the screen,
"influence" as the movement is detected.
In other words, two points on the screen can detect the spot of light, each move from side to
side.
Both the top spot of light on the left or to determine the upper high-emitting diode to the height
of the screen is on the top spot of light on the direction of the light-emitting diodes.
The amount of movement of light spot on the screen of the X-axis movement of the mouse / Y
axis movement to convert the software to process it, Wii's remote control sensor can be used as a
mouse.
However, the necessary software to process, so now the Wii remote-control software on the PC
was created only if you can not use.
Using the half-way mirror last year (2007) was the beginning of 思 ITSUI around, but to get the
half-mirrors to create real time hanging out.
A mouse games with the Wii
In the analysis of the infrared sensor, the coordinates for the remote control to respond to any
signals coming out of the sensors know.
Give the same signal to their own circuits, infrared sensors and other pointing devices output
from the Wii remote to connect to the board, for example, can manipulate with a mouse might be
Wii. (2008-08-05)
http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=65
(52) 12 TT MM
Bit 2 of TT specifies whether continuous reporting is desired. If bit 2 (0x04) is set, the Wiimote
will send reports whether there has been any change to the data or not. Otherwise, the Wiimote
will only send an output report when the data has changed.
MM specifies the Reporting Mode. Each Mode is specified by the Output Report ID that the data
will be sent to. For example, this will set mode to 0x33:
(52) 12 00 33
0xB0001A GAINLIMIT
0xB0001B MINSIZE
0xB00030 CONTROL
0xB00033 MODE
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).
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.
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
Medium
Output Mode value: 3
16 - IR11
Values:
XLRLSB: least significant bits of the accelerometer data. Which bits are what has
not been determined.
XLR: Acceleration detected along each axis. See Accelerometer
IR: Data from IR sensor in medium form.
20 of EXT18
Values:
EXT n: Byte of data from extension controller.
16 - EXT16
Values:
XLRLSB: least significant bits of the accelerometer data. Which bits are what has
not been determined.
XLR: Acceleration detected along each axis. See Accelerometer.
EXT: Data from extension.
IR9
November
EXT0
December
20 of EXT9
Values:
IR: Data from IR sensor in short form.
EXT: Data from extension.
14th IR9
Fifteen EXT0
20 of EXT5
Values:
XLRLSB: least significant bits of the accelerometer data. Which bits are what has
not been determined.
XLR: Acceleration detected along each axis. See Accelerometer
IR: Data from IR sensor in short form.
EXT: Data from extension.
During R&D, Nintendo discovered the motion sensors were not accurate enough to use the
remote to control an on-screen cursor. To correct this, they augmented the remote with an
infrared image sensor on the front designed to locate two IR beacons within the controller's field
of view. The beacons are housed within a device misleadingly called the sensor bar. The sensor
bar is powered by the Wii base unit, and contains 2 groups of IR LEDs, spaced 7.5 inches apart.
Each group is composed of 5 LEDs, but homemade sensor bars have been effective with fewer
LEDs, so long as the intensity is sufficient. The cable from the Wii to the sensor bar only carries
power. No information is passed either to or from the sensor bar, and the intensity is not
modulated in any way.
These two sources of IR light are tracked by a PixArt sensor in the front of the Wiimote housing.
By tracking the locations of these two points in the sensors 2D field of view, the system can
derive more accurate pointing information. Not much is known about this feature yet, but
circumstantial evidence from the Nintendo/PixArt press release suggests that Nintendo is using a
PixArt System-on-a-Chip to process the images on-board the Wiimote and sends the minimum
information needed for tracking back to the base unit. Transmitting full 2D images constantly
would require a prohibitive amount of bandwidth, especially when multiple remotes are in use.
Wiimote detects and transfers up to four IR hotspots back to the host. Various amounts of data
can be requested, from position values only, position and size, to position, size and pixel value.
The amount of different configurations are quite numerous, and also ties in with the connected
peripheral device.
[edit]
marcan's info
(52) 12 00 33
(52) 13 04
(52) 1A 04
(52) 16 04 B0 00 30 01 08 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00
(52) 16 04 B0 00 06 01 90 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00
(52) 16 04 B0 00 08 01 C0 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00
(52) 16 04 B0 00 1A 01 40 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00
(52) 16 04 B0 00 33 01 33 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00
Output format EXP is three bytes per dot recognized. Bytes 0 and 1 are X and Y, byte 2 is the
LSBs of X and Y and a size value. In binary:
No dot is indicated by 0xff data. This means you will not see any change in the output data even
if you did do all the initialization correctly, unless you actually point the Wiimote at a (powered)
sensor bar!
Output format for FULL is unknown, but we know the data is interleaved. Data sent to report
0x3e contains the data for the first two dots recognized, data sent to 0x3f contains the data for the
next two dots recognized, if any.
Note that the original hidd patch has trouble with 0x00 bytes in commands. Make sure you're
sending the right data.
[edit]
Cliff's info
You need to start by setting reports 0x13 and 0x1a to 0x04 to enable transmission.
Then to activate the IR Sensor you need to write to the wiimote's memory. Set 0x04b00030 to 1,
then set the sensitivity, then set 0x04b00033 to 5, then set 0x04b00030 to 8.
The sensitivity data is 9 bytes at 0x04b00000 and 2 bytes at 0x04b0001a. For midrange
sensitivity, it's {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0xaa, 0x00, 0x64}, and {0x63, 0x03}.
Both built-in memory and peripheral registers are accessed using the same reports,
where a flag is used to select between the two.
(52) 17 MM FF FF FF SS SS
(a1) 21 BB BB SE FF FF DD DD DD DD DD DD DD DD DD DD DD DD DD DD
DD DD
BB BB is the state of the buttons on the Wii Remote. During data reads, regular
input reporting is temporarily suspended. Button data is available through the data
input reports, but no other input data can be collected while the transfer lasts. FF FF
is the offset expressed in absolute memory address of the Wii remote memory for
the first byte of data returned (the high byte of the offset is not returned, and neither
is which data memory is being used. Thus, this must be known from the read
request). E (low nybble of SE) is the error flag. Known error values are 0 for no
error, 7 when attempting to read from a write-only register, and 8 when attempting to
read from nonexistant memory. S (high nybble of SE) is the size in bytes, minus
one, for the current data packet. This is 0xf (16 bytes) for all but the last packet,
where it might be less if the requested number of bytes is not a multiple of 16. The
DD bytes are the data, padded with zeroes to 16 bytes. If more than 16 bytes are
requested, multiple packets will be received, with FF FF offsets increasing by 16
each time.
(52) 16 MM FF FF FF SS DD DD DD DD DD DD DD DD DD DD DD DD DD DD
DD DD
The meaning of the bytes is the same as during reads, except that size can be a
maximum of 16 bytes (as there is only space for that much data), and the actual
data to write follows (the DD bytes), padded out to 16 bytes.
Some kind of acknowledgement is received on Input Report 0x22. This has not been
investigated yet.
EEPROM Memory
There is a 128kbit (= 16kB) EEPROM chip (Data Sheet / Full EEPROM dump from a
sample Wii Remote) in the Wii Remote. Part of its contents include code for the
built-in microcontroller, and a generic section which can be freely read and written
by the host. This section is 0x1700 bytes long, and part of this memory is used to
store the Mii Data. It can be accessed by reading from/writing to addresses 0x0000-
0x16FF in the Wii Remote's virtual memory space; in the actual EEPROM chip, the
data is located at 0x0070-0x176F.
The BCM2042 microcontroller built into the Wii Remote includes a large 108kb on-
chip ROM section for storing firmware. If the EEPROM chip really contains code for
the BCM2042 then this was probably done to make firmware updates possible, so
there might be a way of accessing the other parts of the EEPROM via Bluetooth as
well. From the BCM2042 Product Brief: "ROM-based design eliminates external
flash memories; Flash option offered to support feature development".
On a virgin Wii Remote, acquired separately (not bundled with a Wii), that has never
communicated with any device (except the PC used to dump the memory contents),
most of the memory is blank (0x00). However, the first few bytes contain some
information:
0000: A1 AA 8B 99 AE 9E 78 30 A7 74 D3 A1 AA 8B 99 AE
0010: 9E 78 30 A7 74 D3 82 82 82 15 9C 9C 9E 38 40 3E
0020: 82 82 82 15 9C 9C 9E 38 40 3E 00 00 00 00 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
This can be better visualized as two sequences, each one repeated twice:
0000: A1 AA 8B 99 AE 9E 78 30 A7 74 D3
000B: A1 AA 8B 99 AE 9E 78 30 A7 74 D3
0016: 82 82 82 15 9C 9C 9E 38 40 3E
0020: 82 82 82 15 9C 9C 9E 38 40 3E
It is not yet clear why these sentences are repeated; but since at least the second
one is known to be calibration data, maybe one version contains the calibration data
that is actually being used, while the other version is meant for backup purposes (for
example a "Return to factory settings" option) in case there will be a way of
recalibrating the Wii Remote with future Wii firmware updates.
The three bytes starting at 0x0016 and 0x0020 store the calibrated zero offsets for
the accelerometer. Apparently, the three bytes at 0x001A and 0x24 store the force
of gravity on those axes. The function of other data bytes is not known, and most of
them differ between Wii Remotes. Some or all of these bytes might not be used by
the Wii. However, there has been a case of a Wii Remote where Extension
functionality was lost following a battery change, and restoring these bytes (which
had been previously overwritten) fixed the problem. The Extension controllers did
not work with a PC either (which did not explicitly use these bytes), suggesting some
of these might be used by the Wii Remote itself. This is unconfirmed, but it is
advised that these never be overwritten, and recommended that they be backed up,
just in case.
16D0: 00 00 00 FF 11 EE 00 00 33 CC 44 BB 00 00 66 99
16E0: 77 88 00 00 2B 01 E8 13 00 00 00 00 00 00 00 00
16F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
In contrast to the data at 0x0000, this data seems to differ in only a few bytes
between different Wii Remotes.
Known memory ranges are listed below. Note that the "user data" area is 0x0FA0 =
4000 bytes long, which seems to confirm the 4kB figure that has been mentioned
(meaning 4000 bytes, that is, using the SI prefix meaning instead of the binary
meaning).
The top byte of the address is unused, which means memory is mirrored every
0x10000 bytes. Reading from unused addresses where the low 16 bits are >=
0x1700 will result in error returns.
Control Registers
The Wii Remote has several memory mapped register spaces corresponding to
different peripherals in it. These include the Speaker, Extension Controllers, and the
IR Camera.
Reminder
Remember to set bit 2 (0x04) on the first byte of the Output Report, otherwise you'll
overwrite EEPROM memory!
The peripheral to access is selected by the first byte of the address, and the lower
16 bits specify the register to access within that peripheral. The lowest bit of the high
byte is ignored, which means every peripheral is mirrored at its address + 0x10000.
Known peripherals are listed below:
Most of these are also mirrored across the high bits of the individual peripheral. For
example, the second byte of the address is ignored in the Extension controller
address, which means any address of the form 0xA4xx00 will work (as will
0xA5xx00).
Input Features
The Wii Remote has two input features that are controlled directly by the Broadcom
chip: a Three-Axis Accelerometer and 11 Buttons. Additionally, it has an IR Camera
with an object tracking processor, and an expansion port that allows for external
input features such as those contained in the Nunchuk and the Classic Controller
(see Extension Controllers.
Buttons
The Wii Remote has 11 buttons on its front face, and one trigger-style button on the
back. Of these, the Power button is special and is treated differently by the Wii
Remote. All the other buttons are independantly accessible through a two-byte
bitmask which is transmitted first in most Input Reports. A button will report a 1-bit if
pressed, or a 0-bit otherwise. By default, these are sent only when the state of any
button changes, in Data Reporting Mode 0x30. However, the Wii Remote may be
configured to report the state of the buttons continuously; see Data Reporting.
Core Buttons
The Wii Remote has 11 buttons that are used as regular input devices: A, B
(trigger), a 4-directional D-Pad, +, -, Home, 1, and 2. These are reported as bits in a
two-byte bitmask. These are the assignments, in big-endian order:
Power Button
When the Wii Remote is turned off, pressing the Power button will attempt to wake
up the Wii that is synchronized to it. The mechanism for this is unknown, and it is
handled entirely within the Wii's bluetooth module. When the Wii Remote is turned
on and connected to a host, pressing and holding the Power button for a few
seconds will turn the Wii Remote off and request disconnection from the host. The
disconnection reason included with the Baseband (ACL) disconnection request
indicates that the power button was pressed: REMOTE DEVICE TERMINATED
CONNECTION DUE TO POWER OFF (0x15). Another possible value is REMOTE
DEVICE TERMINATED CONNECTION DUE TO LOW RESOURCES (0x14), which
indicates that the Wii Remote performed a controlled shut down due to a low battery
condition.
Accelerometer
Since the accelerometer actually measures the force exerted by a set of small proof
masses inside of it with respect to its enclosure, the accelerometer measures linear
acceleration in a free fall frame of reference. If the Wii Remote is in free fall, it will
report zero acceleration. At rest, it will report an upward acceleration (+Z, when
horizontal) equal to the acceleration due to gravity, g (approximately 9.8 m/s²). This
fact can be used to derive tilt from the acceleration outputs when the Wii Remote is
reasonably still.
(a1) RR BB BB XX YY ZZ [...]
XX, YY, and ZZ are unsigned bytes representing the acceleration in each of the
three axis, where zero acceleration is approximately 0x80. The coordinate system is
shown in the diagram above. Additionally, the BB BB Buttons bytes also include the
LSBs of the acceleration values in the unused bits, according to the following table:
Bit
Byte 7 6 5 4 3 2 1 0
0 X<1:0>
1 Z<1> Y<1>
Note that X has 10 bits of precision, while Y and Z only have 9. For consistency,
they are assumed all to have a 10-bit range and the LSB is always set to zero for Y
and Z.
(a1) 3e BB BB XX [...]
(a1) 3f BB BB YY [...]
In this mode, the LSBs are not available. Instead, X and Y acceleration is reported
as a single byte, and the Z value is encoded in the unused bits of the BB BB Buttons
data as follows:
Bit
Report ID Byte 7 6 5 4 3 2 1 0
0x3e 0 Z<5:4>
0x3e 1 Z<7:6>
0x3f 0 Z<1:0>
0x3f 1 Z<3:2>
IR Camera
The Wii Remote 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 Wii Remote 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!
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. To avoid the random
state put a delay of at least 50ms between every single byte transmission.
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.
Bit
Byte 7 6 5 4 3 2 1 0
0 X1<7:0>
1 Y1<7:0>
2 Y1<9:8> X1<9:8> Y2<9:8> X2<9:8>
3 X2<7:0>
4 Y2<7:0>
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.
Bit
Byte 7 6 5 4 3 2 1 0
0 X<7:0>
1 Y<7:0>
2 Y<9:8> X<9:8> S<3:0>
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. The data format of each
object is:
Bit
Byte 7 6 5 4 3 2 1 0
0 X<7:0>
1 Y<7:0>
2 Y<9:8> X<9:8> S<3:0>
3 0 X min<6:0>
4 0 Y min<6:0>
5 0 X max<6:0>
6 0 Y max<6:0>
7 0
8 Intensity<7:0>