# Wiimote/Motion analysis

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

## Calibration

If we can assume the sensor response to acceleration is roughly linear and the chip is precisely oriented on the circuit board, then calibrating the Wiimote sensor is a three step procedure. We only need the raw integer force sensor readings for these three positions on a flat, level table:

   * Horizontal with the A button facing up: ($x_1$, $y_1$, $z_1$)
* IR sensor down on the table so the expansion port is facing up: ($x_2$, $y_2$, $z_2$)
* Laying on its side, so the left side is facing up: (x_3,\, y_3,\, z_3)


In each of these cases, we are measuring g on one axis, and the zero point on the other two axes. We can estimate the zero points of each axis to be:

$x_0 = (x_1 + x_2)/2$ $y_0 = (y_1 + y_3)/2$ $z_0 = (z_2 + z_3)/2$

Starting with any integer reading from the sensor (x_{raw},\,y_{raw},\,z_{raw}), the calibrated force readings are:

$x = \frac{x_{raw} - x_0}{x_1 - x_0}$ $y = \frac{y_{raw} - y_0}{y_2 - y_0}$ $z = \frac{z_{raw} - z_0}{z_3 - z_0}$

The calibrated force is now in units where $g = 1.0$.

Following a 3-step calibration procedure that requires a table might be a hassle for the user, so a less rigorous procedure may be preferable. Based upon the above example, we might conjecture (possibly incorrectly) that the gain of the sensor (size of g, basically) is more uniform between remotes than the zero offset. In that case, we would only need the remote to be at rest briefly in order to determine the zero offsets for all 3 axes at once. Such a procedure might in fact be the only way to calibrate the Nunchuk sensor, as that controller does not have the flat surfaces needed to perform the 3-step calibration.