Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Calculating values from bytes for speed event

Rank

Total Posts: 2

Joined 0

PM

My goal is to calculate speed from the incoming data of the speed sensor simulator. I've been reading over section 4 of the device profile PDF for the speed sensor and I've setup the simulator to only project a "Bike Speed Sensor". I'm down to reading the last 4 bytes of each 8 byte messsage to grab time and revolutions. I'm not all that knowledgeable about byte level calculations though.

My question is, how does one take those last four bytes and convert them to numerical values that relate to time and revolutions and what would be their unit of measure? Also, is there a location in the Sensor Simulator and I can reference to corroborate these values and ensure my calculations are correct?

For the purpose of this post and making example calculations, assume the following 8 bytes were recieved from a speed sensor on a single message:
00 FF FF FF AC 88 F1 32 


Any help I can get would be greatly appreciated.      
Avatar
RankRankRankRank

Total Posts: 235

Joined 2012-08-31

PM

Hi Aaron,

I moved this post into the ANT+ Forum as it's discussing ANT+ profile and therefore restricted to Adopter level access.

To use your example, note that the most significant byte in each of these fields is byte 5 and byte 7 respectively:
Bytes 4 and 5: 0x88AC --> 34988 in decimal. 34988 / 1024 = 34.17 seconds since the last rollover

Bytes 6 and 7: 0x32F1 --> 13041 in decimal = revolution count.

You can put these values into the calculations in section 4.3 to get your speed and distance values. You need to know the wheel circumference to use for this too. This is usually obtained by user input.

Good luck, and have a good weekend!      
Rank

Total Posts: 2

Joined 0

PM

Exactly what I need. And the values correspond with Event Count and Event Time in the simulator window.

Thank you very much for your help!      

Image Attachments

screenshot.jpg

Click thumbnail to see full-size image

Avatar
RankRankRankRank

Total Posts: 235

Joined 2012-08-31

PM

You're welcome! Relieved I didn't mess those up wink