0

I'm trying to convert the speed sensor value into a readable format.

...

Below is the data bytes obtained from the wahoo speed sensor

Output obtained using ble programmatically: Raw output Bytes : [2,196,0,94,7]

Channelsble channels The above data byte1 seems like a wheel rev and I'm trying to decode the last wheel event time.

.....

The output obtained using nrfconnect app Imaenter image description herege:

Crank rev:3 Last crank event time:37932ms

Set of observed values:readings

I found that byte1 represents the crank rev count value, it's difficult for me to find the Last crank event time from bytes output

tesrt
  • 57
  • 1
  • 7
  • I you have a small byte array then please post the values also in hexadecimal notation. – blackapps Feb 23 '22 at 11:24
  • byte[2] has value 0 by the way. byte[0] has value 1. – blackapps Feb 23 '22 at 11:26
  • cant find anything in here: https://api.wahoofitness.com/android/api/1.4.0.2/com/wahoofitness/connector/capabilities/WheelRevs.Data.html – pippo1980 Feb 23 '22 at 11:27
  • 37932 ? How did you calculate that? – blackapps Feb 23 '22 at 11:27
  • Wheel rev:3 Last wheel event time:37932ms this is the output from the nrfconnect app.I don't know how they extracted the exact value – tesrt Feb 23 '22 at 11:29
  • info updated please check – tesrt Feb 23 '22 at 11:50
  • Does this answer your question? [BLE Cycling Speed and Cadence Service - Crank Timing Data](https://stackoverflow.com/questions/64624472/ble-cycling-speed-and-cadence-service-crank-timing-data) – Risto Feb 23 '22 at 12:55
  • its does not helps me @Risto – tesrt Feb 23 '22 at 13:29
  • I found that byte[1] represents the crank rev count value, it's difficult for me to find the Last crank event time from bytes output – tesrt Feb 23 '22 at 13:55
  • and what do you don't understand? Your sensor delivers "Crank Revolution Data" and the first value is the "Cumulative Crank Revolutions" and the second is the "Last Crank Event Time" with a resolution of 1/1024s. Both values are uint16 – Risto Feb 23 '22 at 13:58

1 Answers1

2

If you look at GATT Specification Supplement 5 it describes how to intepret the bytes:

enter image description here

enter image description here

Looking at the data: [2, 4, 0, 94, 23] the 2 is in the flag position and represents Crank Revolution Data Present.

The 4, 0 are Cumulative Crank Revolutions. As the data is in little endian the value is 4. The 94, 23 are Last Crank Event Time which is this case is a timestamp at 5982 (5.84 seconds)

ukBaz
  • 6,985
  • 2
  • 8
  • 31
  • to calculate timestamp 94+23/1024=. is this correct??? – tesrt Feb 23 '22 at 14:09
  • i can't understand Last Crank Event time pls help. @ukBaz – tesrt Feb 23 '22 at 14:16
  • Apologies, my answer needed to be divided by 1024. So `94, 23` is in little endian format so is `5982` as an integer which needs to be divided by `1024` to get the timestamp in seconds. I've updated my answer. – ukBaz Feb 23 '22 at 14:16
  • Sorry I'm still trying to understand little-endian format 94,23 to 5923, If possible could you please explain @ukBaz – tesrt Feb 23 '22 at 14:34
  • Example of converting list of bytes to integers https://stackoverflow.com/a/63573566/7721752. More informaton on endianess https://www.freecodecamp.org/news/what-is-endianness-big-endian-vs-little-endian/ – ukBaz Feb 23 '22 at 14:40
  • Sorry to bother, what you are telling here is that the bluetooth ble standard already define standards about how to design speed /caddnce sensors ? – pippo1980 Feb 23 '22 at 17:07
  • 1
    @pippo1980, yes, there are some adopted services and characteristics that are documented by the Bluetooth SIG. A manufacturer can follow that for interoperability or they can do their own thing. Full list at: https://www.bluetooth.com/specifications/specs/ – ukBaz Feb 23 '22 at 17:14
  • `I'm still trying to understand little-endian format 94,23 to 5923,` You will only understand if you display both values in hexadecimal notation. – blackapps Feb 24 '22 at 08:34