Gyroscope - mdmosley1/WBAN_2.0 GitHub Wiki

Here is the code for the gyroscope

        /* Converting from raw data to degrees/second.
        float calcGyro(int16 rawX) {
        
        float v;
        
        //-- calculate rotation, unit deg/s, range -250, +250
        v = (rawX * 1.0) / (65536/ 500);
        
        return v;
        }

So rawX = v * 65536 / 500 = 2^16 / 500

According to data sheet

Digital Output

  • Fast Mode (400kHz) I2C serial interface
  • 16-bit ADCs for digitizing sensor outputs
  • Angular rate sensors (gyros) with applications-programmable full-scale-range of ±250°/sec, ±500°/sec, ±1000°/sec, or ±2000°/sec.

TI Application Code

Device_View.java

onCharacteristicChanged takes as argument a uuidStr. If uuidStr = UUID_GYR_DATA, then v (a Point3D object) is assigned to the the gyro data

public void onCharacteristicChanged(String uuidStr, byte[] rawValue) {
 ...

 if (uuidStr.equals(SensorTagGatt.UUID_GYR_DATA.toString())) {
   v = Sensor.GYROSCOPE.convert(rawValue);
   msg = decimal.format(v.x) + "\n" + decimal.format(v.y) + "\n"
    + decimal.format(v.z) + "\n";
   mGyrValue.setText(msg);
}
 ...
 }

onCharacteristicChanged is called from DeviceActivity.java.

I found the uuid for the the gyro link