Arduino Forum

Community => Gigs and Collaborations => Topic started by: kierankay on Jan 24, 2020, 01:22 pm

Title: Help getting cadence BLE sensor output values to arduino?
Post by: kierankay on Jan 24, 2020, 01:22 pm
Hi, I'm an engineering student and I must admit I am quite a beginner when it comes to Arduino, particularly when using bluetooth.

I have a piece of code which requires an input value for RPM from the bluetooth Wahoo cadence sensor to run. (https://uk.wahoofitness.com/devices/bike-sensors/wahoo-rpm-cadence-sensor)

I have the Adafruit Bluefruit LE SPI Friend and an Arduino Uno which I am trying to set up code for to get a value out from the sensor. I have managed to connect the sensor to my phone to see the service and characteristic UUIDs.

There are some forums that mention getting data from the sensor but I don't know if they are relevant or how to apply them to arduino:
https://stackoverflow.com/questions/45677032/how-do-you-get-data-from-a-bluetooth-le-device/45743447

Particularly this one which is in javascript. Is there a way to convert javascript to run on Arduino? (I'm using a mac too by the way).
http://forum.espruino.com/conversations/323575/


Any help would be greatly appreciated as I'm currently in limbo.
Title: Re: Help getting cadence BLE sensor output values to arduino?
Post by: blimpyway on Jan 25, 2020, 02:46 am
If you already found epruino code working, how about using a generic esp32 board which  you flash espruino and change the example javascript to send decoded info to arduino via serial?  (and use that bluefruit somewhere else)
Title: Re: Help getting cadence BLE sensor output values to arduino?
Post by: alangstein on Apr 16, 2020, 03:13 am
Can you set up the bluefruit to be a client (i.e. query the BLUE SC device which acts as a server)?  There should be tutorials around on how to do this.  If you can do this then you just need to capture the cscmeasurement characteristic data which is in the form of 11 bytes - you want the last two (sorry if you already know this). 

byte[0] - single byte value tells you whether wheel (1), crank (2), or both (3) data are present in the message.  You are interested in cadence so you would hope this value is either 2 or 3

byte[1] through byte[4] - this is a 4 byte value that tells you the total number of wheel revolutions (not crank)

byte [5] and byte[6] - this is a 2 byte value that tells you the number of 1/1024 of a second since the last wheel revolution event.  This period can then be used to calculate the RPM of the wheel.

byte [7] and byte[8] - this is a 2 byte value that tells you the total number of crank revolutions

byte[9] and byte[10] - this is a 2 byte value that tells you the number of 1/1024 of a second since the last crank revolution event.  This period can then be used to calculate the RPM of the crank.  This is the value you want but need to convert this value to an RPM measurement.