A Much Better Analysis of the Dualshock 3

   I spent most of yesterday working on reading the motion control from the Dualshock 3 controller and at this point I think I have it all figured out. In short, the Dualshock 3 has four motion sensors: three linear accelerometers, one along each axis, and one rotation sensor about the z axis. Holding the controller level in its neutral position, the positive x-axis is to the left, positive y is backward (toward you), and positive z is up. The linear accelerometers can sense the orientation of the controller with respect to the ground and the z-moment sensor senses steering-wheel rotation. That covers the full range of normal use. Rotation sensors around the x and y axes aren't necessary. I only have it working in Ubuntu so far and Linux only recognizes the controller when it's connected over USB. So I don't have bluetooth capability in Linux or any capability in OSX. My MacBook will connect to the controller over bluetooth but I haven't figured out how to read it yet.


Testing Each Axis

   It took me a while to figure out the whole system, but it's fairly simple. When the controller is held with the left side pointing up, x reads ~-5000, meaning -1G along the x-axis, and y and z read zero. Turn the controller with front side down and y reads -4000, and the so on for z. We get different readings for 1G on each channel, so I'll have to calibrate it all, but so far the readings per channel have been fairly consistent. Also, the ranges of the three sensors overlap one another so there are no gaps in our measurements. Note that there is a negative spike on a26 when the controller is rotated from x to y (negative z moment).


Rotating Full-Circle

   When the controller is rotated full-circle about one axis, the other two sensors read sinusoidally, just as we would expect. Again it's obvious that the three linear sensors are not operating on the same scale.


Shaking the Controller

   Finally, I shook the controller along each axis to produce higher readings. Shaking by hand is not what I would call precise, but the data still works. It's pretty easy to tell what's going on. It is important to note that a26 fluctuates similarly to a23 and a24. a26 also appears to precede the linear readings. This means that the a26 sensor is not balanced normal to z and its signal will not be reliable when there is strong linear movement along x or y. All four sensors change in increments of ~85. With an output range of -32768 to 32767, that gives us a precision of approximately 9.6-bits per axis. Not bad.
   To read the controller, I took the source code for the Linux jstest command and stripped it down to just what I needed. If you compile and run this c code in linux, you should get the same data that I have. The next thing I need to do is calibrate the motion system and see just what I can do with it.