question regarding connecting to garmin ant stick

332 views
Skip to first unread message

timob...@gmail.com

unread,
Aug 28, 2013, 11:06:24 AM8/28/13
to python-ant-...@googlegroups.com
Hi,
I have looked through a bunch of posts, but am not clear if the info I seek is out there.  What I'd like to do is plug in my garmin ANT+ stick to my USB, put on a HR strap, read the data in real time into python by doing something like looping while serial.inWaiting() or something of the sort.
 
Most of the time I can "see" a device by choosing the com port and baud rate with a statement like:
 
s=serial.Serial('COM3',115200)
 
and if I can get to that point for now, I will be happily coding on.
 
Please advise,
 
Timo

Andy Van Heusen

unread,
Aug 29, 2013, 12:41:10 PM8/29/13
to python-ant-...@googlegroups.com
The info you seek is out there, I managed to get a Movestick (ANT+ usb device) talking to a HRM

I wrote myself a pretty nifty library from scratch after from looking at some sample python code I stumbled across on github and reading all the ANT+ protocol documentation. It was about a year ago now and the code is in one of my VMs somewhere, but I doubt that I'll be able to find it in a hurry :( sorry 

I just did a history search on my chrome browser on python and ANT+ and it came up with this URL
Which I'm pretty sure is the project that I used to learn python and some of the basics of ANT+ 

I also used the ANT+ simulators and a USB sniffer (software) on a Windows VM so that I could see all the commands being sent to and from the stick to really help with the in-depth understanding of what was going on.

By the end of a week I had a pretty good library that I could use to connect to the HRM and read the data from the pages being sent across.

From memory I do recall that I needed to install LibUSB and PyUSB to be able to talk to the usb device,

Then you have to send arrays of bytes of data and parse the bytes that come back. It's all a bit hazy now as it was so long ago, but I do recall that sniffing the USB with the simulations yielded a eurika moment as I must confess I had not fully grasped the meaning of the Endianness http://en.wikipedia.org/wiki/Endianness of one of the messages and had this round the wrong way :(

I remember all the issues and frustrations that I had and must have back at some point subscribed to this group. I thought that I ought to pass on what I can remember to help try and save anyone else the frustration that I had.

Cheers and good luck,
Andy

Andy Van Heusen

unread,
Aug 29, 2013, 12:44:47 PM8/29/13
to python-ant-...@googlegroups.com
Sorry first day back from hols and as I say this was over a year ago, just had a bit more of a look and realise that this group is actually attached to the link that I sent. If you get this code down, it should give you all you need to get going, the only other possible fly in the ointment is if the HRM does not use the default pairing key (or network key or something like that) as you'll not be able to pair with the device and get things going...

Cheers 

Martín Raúl Villalba

unread,
Aug 29, 2013, 5:13:03 PM8/29/13
to python-ant-...@googlegroups.com
There is indeed a code example in the repository doing exactly what you need. Download the stable 0.1 release.

Cheers.


2013/8/30 Andy Van Heusen <an...@pumpco.co.uk>

--
You received this message because you are subscribed to the Google Groups "Python ANT+ Open Source" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-ant-open-s...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Martín Raúl Villalba
Reply all
Reply to author
Forward
0 new messages