The TgForceSensor repository contains Android code to interface with the TgForce Impact Running Sensor. The TgForce sensor is a Bluetooth LE device that measures tibial shock. It follows the
Bluetooth LE standards and is relatively easy to interface with.
This repository contains Android code to interface with the device. The protocol is encoded in the source code and is documented belowbelow.
The protocol consists of four standard Bluetooth GATT services and a custom service.
The protocol below is documented as follows, with every xxxxxx-xxxx-xxxx-xxxx-xxxxx representing a UUID:
xxxxxx-xxxx-xxxx-xxxx-xxxxxService namexxxxxx-xxxx-xxxx-xxxx-xxxxxCharacteristic namexxxxxx-xxxx-xxxx-xxxx-xxxxxDescription name
The BlueTooth 4.0 services the device exposes are:
00001800-0000-1000-8000-00805f9b34fbGeneric Access service00002a00-0000-1000-8000-00805f9b34fbDevice Name00002a01-0000-1000-8000-00805f9b34fbAppearance00002a04-0000-1000-8000-00805f9b34fbPeripheral Preferred Connection Parameters
00001801-0000-1000-8000-00805f9b34fbGeneric attribute service00002a05-0000-1000-8000-00805f9b34fbService Changed00002902-0000-1000-8000-00805f9b34fbClient Characteristic Configuration: notifications / indications
0000180a-0000-1000-8000-00805f9b34fbDevice Information00002a29-0000-1000-8000-00805f9b34fbManufacturer Name String00002a24-0000-1000-8000-00805f9b34fbModel Number String00002a25-0000-1000-8000-00805f9b34fbSerial Number String00002a27-0000-1000-8000-00805f9b34fbHardware Revision String00002a26-0000-1000-8000-00805f9b34fbFirmware Revision String00002a28-0000-1000-8000-00805f9b34fbSoftware Revision String
0000180f-0000-1000-8000-00805f9b34fbBattery Service00002a19-0000-1000-8000-00805f9b34fbBattery Level (0-100)00002902-0000-1000-8000-00805f9b34fbClient Characteristic Configuration: notifications / indications
f6531000-9ce4-450d-b276-3b5a88fa2e73TgForce Servicef6531010-9ce4-450d-b276-3b5a88fa2e73PPA00002900-0000-1000-8000-00805f9b34fbCharacteristic Extended Properties00002901-0000-1000-8000-00805f9b34fbCharacteristic User Description00002902-0000-1000-8000-00805f9b34fbClient Characteristic Configuration: notifications / indications
f6531011-9ce4-450d-b276-3b5a88fa2e73gThreshold00002900-0000-1000-8000-00805f9b34fb00002901-0000-1000-8000-00805f9b34fb
f6531013-9ce4-450d-b276-3b5a88fa2e73Delay00002900-0000-1000-8000-00805f9b34fb00002901-0000-1000-8000-00805f9b34fb
f6531014-9ce4-450d-b276-3b5a88fa2e73Cadence00002900-0000-1000-8000-00805f9b34fb00002901-0000-1000-8000-00805f9b34fb00002902-0000-1000-8000-00805f9b34fb
The last service, the custom TgForce service, is of course the most interesting. It implements the main functionality of the device. To make sense of the data that is returned, some more information is needed about how to convert the returned numbers to values with meaningful units:
- PPA: The PPA is the peak positive acceleration. It represents the size of the peak of downwards acceleration. The signal is sampled at 1600Hz and filtered using a low pass filter of 50Hz. The characteristic uses unsigned integers in the range of [0-255]. The to convert the values to g the following factor is needed:
23.9141g/254, since 23.9g is the maximum acceleration. - gThreshold: The gThreshold is the minimum acceleration that needs to be exceeded before a peak is considered. It is represented using a value [0-85]. The default is 3.6g. To set the threshold multiply the value in g with 5.32, so the default value is 5.32*3.6g = 19.
- delay: The delay instructs the device to discard superflous peaks for a certain period after a peak is detected. It is assumed that strides take a minimum amount of time: this is encoded as the delay. The default value is 550ms. It is represented using an integer from zero to 19999. To set the delay multiply the value in ms with 17.53. The default value is 550*17.53 = 9642.
- Cadence: The cadence is given as a number of steps pre minute. No conversion is necessary.
The source code is organized following the Android Studio project settings.
This code was developed at University Ghent, IPEM by Joren Six. It is licensed under a BSD License.
Thanks to Kelsec Systems for providing documentation and support via email.
01/10/2015 First version