We have identified the wheel and crank sensor Gatt characteristic measurement data which we have got in our application as per the split ups in the link below. " https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.csc_measurement.xml "
For instance we have tried the following,
Hex Data : 0x03 6D010000 FC7E 2C01 F87E
Flag-03 ->0000 0011 -> 8bits so both are true hence we can get the wheel and crank's respective values.
Cumulative Wheel Revolutions- 6D 01 00 00 -> 32bits so reversing the bluetooth values in little endian i.e 00 00 01 6D and converting it in decimal we get-365
Last Wheel Event Time- FC 7E -> 16bits so reversing the bluetooth values in little endian i.e 7E FC and converting it in decimal we get-32508
Cumulative Crank Revolutions- 2C 01 -> 16bits so reversing the bluetooth values in little endian i.e 01 2C and converting it in decimal we get-300
Last Crank Event Time- F8 7E -> 16bits so reversing the bluetooth values in little endian i.e 7E F8 and converting it in decimal we get-32504
Here we used only the wheel and crank revolution value for our application so we are facing a problem that the last value of the crank or wheel is repeating even after stopping the cycle and the value continues from the previous event value Some times the values are very high and aberrant. Here I suspect Last Wheel and Crank event times will play a major role. But I am not sure about the functionality and purpose behind those time bytes. The main wheel and crank value are unit less hence we don't know what type of conversion we have to do. How can we get the right real time value for calculating the RPM and speed of the cycle when it is in motion. How should we use the last event time in our C# coding ? How can we incorporate the time event in our logic ? Kindly guide us through this process of parsing. The device I am using is the SunDing515 cycling speed and cadence sensor with Bluetooth low energy. strong text
I'm developing an app for a BLE
unit which transmits GATT
CSC
measurements. What I describe below are not C# or Java specific concepts but they are generic.
csc_measurement.xml
file you can see that the unit is 1/1024 seconds. So you have to divide the values you mentioned (32508 and 32504) to get the pure second reading. However since this reading is transmitted as an UInt16, that also means that this variable overflows every 64 seconds. I don't know why this GATT characteristic was designed this way, they could have used an UInt32 (or UInt24) here just like with the wheel rotation, but this is what we have.So it's your task to calculate the instantaneous cadence values from this data. When you also factor-in that sometimes riders may pedal with a 20-30 crank rotations per minute it's also clear that I'd need more than just a few seconds of sample data to calculate a cadence with an acceptable precision.
With all that being said, if your device still supplies erratic data for event time: double check the 1024 division and overflow logic and also the sliding window. You still have a last resort to fall back to your own measured time stamps, but that backfired in my case: when the phone got into locked mode during a workout and then got unlocked again, all of the measurements flooded into the app at once rendering my timestamps invalid and my calculations became outrageous. So try to stick to the device's readings if possible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With