WIP - Puck.js reading CSC (cycling speed cadence) BLE sensor to replace bike computer head unit with Puck.js or (later) Pixl.js #3256
Replies: 17 comments
-
|
Posted at 2018-07-25 by @gfwilliams Hi Joost, That looks really promising - and it's great that the Wahoo sensor uses a standard Bluetooth LE format for its data as well! I think you just want to start notifications on the characteristic - check out http://www.espruino.com/Reference#l_BluetoothRemoteGATTCharacteristic_startNotifications - there's some example code there that should do exactly what you want.
|
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2018-07-25 by Joost Cool, thanks a lot! Will try this later tonight, J |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2018-07-26 by Joost As a quick follow up, this works! Thanks a lot, J |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2018-07-27 by @gfwilliams That's great! Thanks for posting the code up. I'd be really interested to see what you make with it! |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2018-08-01 by benjaminbenben Hey Joost! (Thanks Gordon for pointing me here!) This looks like a brilliant bit of kit - and making your own head unit sounds like an awesome project. I'd be really interested in hearing updates too. I'm planning to make a tracker which would only check values every hour (I'm planning to capture bike usage over several months). Do the cumulative revolutions increase whilst you're not connected? If so, I'm definitely going to pick up one of these. |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2018-08-03 by Joost Hi Benjamin, the Wahoo Speed Sensor resets its "cumulative wheel revolutions" counter when switching off, so you will have to monitor the transmitted data continously with enabling the notifications for the service. As it seems, we have similar goals with creating an unobtrusive device. Right now I did not advance, as I am awaiting the delivery of the MDBT42 Breakout board, which I ordered just vey recently. I think it will arrive next week (international shipping). The code above was tested with a Puck.js by the way. |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2018-08-06 by @gfwilliams Hi! Just sitting there monitoring a GPIO with setWatch is pretty low-power - your idea of using a vibration sensor is nice and easy. There are some Power consumption figures for Puck.js here - http://www.espruino.com/Puck.js#power-consumption Only thing to watch out for is you want a vibration sensor that is normally not shorted. If it's shorted then just the current across the pullup resistor will probably make up the majority of your power draw! |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2018-08-11 by Joost Thanks Gordon, I ordered one of those SW-18020P (e.g. https://www.sunrom.com/p/vibration-sensor ), hopeful it'll work! |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2018-08-13 by Joost Hi, anyone knows why this code gives me this runtime error? I looked it up a hundred times, this should be correct switch/case syntax, or is it not? |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2018-08-14 by @allObjects Can you show a little bit more of the code? I wonder about the connect being some async/callback thing that messes with you... Worst case - comes push to shove - it may be that the (async) code executing 'in' Btw, you can simply say What are you using the timer for? ...update the display every second? |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2018-08-14 by Joost Thanks for your answer! Here is the complete code: Though sadly your idea with
did not work out; returning the same error. Thanks again! |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2018-08-14 by @gfwilliams Thanks - I just checked on this and it's a bug in I'll try and get a fix in for it, but in the mean time, add this code up the top of what you upload and it'll fix it: |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2018-08-14 by Joost Hi Gordon, thanks a lot! The switch/break error seems fixed; now something creeped in giving me (also not working if renaming pixlmenu back to "m", as I had in my code before). This being the code right now: |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2018-08-14 by @gfwilliams Ahh, ok - try: |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2018-08-14 by Joost That worked, great! Thanks a lot, J |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2020-01-24 by kierankay Hi, I'm an engineering student trying to get an output from the wahoo cadence sensor but I am using an Arduino Uno and an Adafruit Bluefruit LE SPI Friend. I'd love some help in getting the code you have here working or adapted for use with arduino. Kieran |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2020-01-24 by @allObjects @kierankay, hat's a tough task you take onto you... the way that Arduino works - polling loop - versus Espruino - interrupt driven - puts itself in way of adapting this code. Furthermore, check on the implementation of Promises in Arduino world. Depending what the adafruit libs give you (setting some flags on filtered reception of data and buffer thereof) and availability of a lib or your on implementation of Promises you should be able to lean on the main line and structure of the Espruino code... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-07-24 by Joost
Hi everybody and esp. Gordon (thanks for Espruino!!),
I'm looking into receiving sensor readings from the commercially sold CSC sensor Wahoo Speed (https://www.amazon.com/Wahoo-Cycling-Speed-Sensor-Bluetooth/dp/B01DIE7LUG/ref=sr_1_3?s=sporting-goods&ie=UTF8&qid=1532458958&sr=1-3&keywords=wahoo+speed) which came with my bike computer Wahoo ELEMNT Mini, of which I want to replace the cumbersome headunit.
The sensors sends data via BLE with the CSC service:
https://blog.bluetooth.com/part-2-the-wheels-on-the-bike-are-bluetooth-smart-bluetooth-smart-bluetooth-smart
https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.csc_measurement.xml
Using NRF connect on Android, the sensor readings are shown easily after enabling the notification.
Now to the crucial part (for me):
This code:
gives me this output:
Can anyone point me in the right direction how I can enable and receive the CSC measurement? Sorry I'm a dummy with programming/JavaScript...
The path to go I imagine would probably consist of writing to 0x2902 characteristic to enable notifications and have some kind of callback receive and interpret the data.
Later on I plan on using the new MDBT42Q Breakout, connecting a Waveshare epaper display and 3d print a small case and have it running on a 18650 battery. Another option would be to use Pixl.js with a custom case and some kind of battery managment.
Thanks for any help!!
Best regards,
Joost
Beta Was this translation helpful? Give feedback.
All reactions