Microsoft Band Sensors – Accelerometer & Gyroscope

Microsoft just released the Microsoft Band SDK Preview and I’m excited. Just like with any other electronic gadget, I’m interested in the sensors. The Band is stuffed full of sensors, but the first ones I want to look at are the accelerometers and gyroscopes.

From the preview site you can download samples for Windows Phone, Android, and iOS. You also need the documentation. To get started with my sensors investigation, I downloaded the Windows Phone sample code and followed the instructions here to get started with my own project.

Accessing the accelerometers and gyroscopes is easy and follows a familiar pattern. The first step is to get access to the band, which should be done within a using clause. Within the band object, you can access the individual sensors through the properties Accelerometer and Gyroscope. The sensor properties each have a ReadingChanged event and a method called StartReadingsAsync() that starts the monitoring process. When you’re done monitoring the sensors you call the method StartReadingAsync(), which stops the monitoring process.

The ReadingChanged event handlers follow a simple pattern as well. In my example, taken from the Sensors example from the downloadable demo, I’m formatting a string to display the sensor data.

When the band is still, the Accelerometer measures the force of gravity with a 3D normalized vector. When you set the band on a flat surface with the buttons down, the X axis indicates that the acceleration vector is negative down and positive up. If you place the band on the side so that the side with the sensor points up, the Y axis is negative down and positive up. If you place the band on its face, the Z axis is negative down and positive up.

The Gyroscope measures the rate of rotational change around each axis. The properties passed by the ReadingChanged event are AccelerationX, AccelerationY, AccelerationZ for the normalized acceleration vector and AngularVelocityX, AngularVelocityY, AngularVelocityZ for the rotational change around each axis. After looking at the values, it became obvious that the sensor values are swapped. The AccelerationX, AccelerationY, AccelerationZ value have the rotational changes, and AngularVelocityX, AngularVelocityY, AngularVelocityZ have the acceleration values scaled up by a factor of 62 or 63.

I confirmed this a few different ways and it is evident in the downloaded samples from Microsoft. With this being a preview SDK, no doubt this error will be fixed. Not a big deal; always double check your values against the documentation.

The following two tabs change content below.