Tigge / openant

ANT and ANT-FS Python Library
MIT License
174 stars 80 forks source link

Can connect to HR monitor but not speed or cadence sensors #44

Open nucleon1 opened 4 years ago

nucleon1 commented 4 years ago

Thanks so much for sharing this code. It's exactly what I've been looking for for a project. Apologies in advance: I am a product designer new to python and coding in general (previous experience of Arduino only) so please excuse me if I have missed something fundamental in the question I'm asking here.

I have Garmin heartrate, speed, and cadences sensors, running into a Raspberry Pi 4 Model B via the Garmin ANT USB stick.

Your program cadence_speed_heart.py runs fine, although I quite often see the (110, 'Operation timed out') error mentioned in another thread when running it from Thonny instead of terminal.

It picked up the HR sensor straight away and is returning correct values for that (I checked them concurrently against the Garmin Edge cycle computer). But it does not seem to be connecting with the cadence or speed sensors - it is just returning 'n/a' in those fields. I know both devices are working because the Edge reads their data. Would this be an issue with the channel setting maybe?

Thanks

Barney

nucleon1 commented 4 years ago

Update on this, with the problem solved to a degree:

I was confused before and hadn't understood that your code had been written for the combined speed and cadence sensor. Which I think has now been largely superseded by the separate ones that I've got. Deeper digging though the Ant+ documentation shows that they use different device type settings (122 and 123 instead of 121) and different periods as well (8102 and 8118).

So adapting the code to add independent channels for each rather than combining them, the RPi is now reading data from both sensors.

Of course they put the data into different byte numbers to the combined sensor as well. Both use 6 and 7 for the LSB and MSB rev count (the combined sensor put the cadence into 2 and 3 as per your original code).

So I now have a correct cumulative rev count readout for both.

Next challenge for a newbie like me: getting this data combined with the event time streams into the computation for cadence rpm and speed in m/s. Any pointers gratefully welcomed!

Thanks

coeurcycliste commented 4 years ago

nucleon1 - I'm also having the same issues trying to do the calculations for cadence and speed on the individual sensors. Did you manage to resolve this? Thanks

nucleon1 commented 4 years ago

I had to take a bit of time out from that project so I haven't had a chance to get back onto it yet but I'm certainly intending to and will post here when (and if!) I do figure it out

kkarsten62 commented 3 years ago

I have the same issue. I would like to connect the Garmin cadence sensor to openant. Heart rate is working well. When running the example "python3 cadence_speed_heart.py" output is: ... hearthrate: 59 Pedal revolutions: n/a Wheel revolutions: n/a ...

Garmin cadence sensor is recognize by my Garmin Edge 1000 cycling computer and is working well and Sensor-ID is known. I played a bit with different type setting mentioned by nucleon1 on Apr 25th. But no success.

May thanks for an assist.

Hi nucleon1 and coeurcycliste, did you manage it to see the cadence data? Thanks for a reply.

kkarsten62

Update, 2021-01-05 FYI. Meanwhile I have implemented my heart rate and cadence sensor in my Python3/PyQt app. Following the docs from the ant webpage and playing with the pairing parameters was the trick. :-)