Capturing heart rate from USB ANT+ dongle and chest strap
27 views (last 30 days)
Show older comments
Marc Lalancette
on 20 Jul 2014
Commented: Star Strider
on 25 Jul 2014
Hello,
I'm trying to figure out the simplest way to acquire data live from my heart rate monitor (chest strap), which communicates wirelessly with the PC through an ANT+ USB dongle. I really don't know much about drivers but I think I have to use the Instrument Control Toolbox and make a Matlab driver for this? Unless the Data Acquisition Toolbox can get the USB data directly? Any tips would be appreciated!
Edit3: As explained in an answer below, some ANT dongles can work with virtual COM port drivers, and thus Matlab can interface with them as a serial port. Unfortunately, the chip in my device is Nordic nRF24AP2-USB which includes USB and does not provide a VCP driver. Thus to interface with it I need to use their API. The way I think I can do this is with MEX files, but I'm still wondering: does the Instrument Control Toolbox provide anything that would make this easier?
Thanks! Marc
0 Comments
Accepted Answer
Star Strider
on 21 Jul 2014
You don’t necessarily have to use the Instrument Control Toolbox or the Data Acquisition Toolbox. You didn’t say what OS you have, but if you plug the USB dongle into your computer — and the Force is with you — Windows should find the driver for you and install it. (You may have to try different USB ports. All of mine function correctly, but for some reason, only the ones on the right side of my relatively new HP laptop will trigger the Windows search behaviour.)
I didn’t do exactly what you are doing, but about five years ago I got a fingertip plethysmograph (measures pulse contour, oxygen saturation, heart rate, and a few other things) that had limited offline data storage and a direct connection with a USB cable, and after finding the details of the hardware and its communications protocol online (PDF documentation from an Internet search on the hardware Windows identified), was able to get all the information from the device and display it in real time. I had to do a lot of experimenting, but I got it to work.
I have a couple routines from that effort that may help get you started. I’m attaching them here for your reference. (Unfortunately, I don’t remember the details of the logic behind them. I believe I got some of the information in them from the hardware and driver documentation, so it’s best you use that information for your hardware and driver in your application.) They were written for a Windows 7 machine in R2009b, so there could be version differences as well.
10 Comments
Star Strider
on 25 Jul 2014
I didn’t sign up (no reason for me to) so I didn’t explore those options. The FTDI drivers seem to be much more straightforward — similar to my pulse-oximeter drivers from what I saw — so that is definitely the way to go if you can possibly get it to work. I get the impression that ANT isn’t eager to have others develop software for their devices, or maybe with all the RF networking stuff in ANT (they thought of everything, including encryption), it’s simply difficult to do it.
More Answers (1)
Marc Lalancette
on 25 Jul 2014
1 Comment
Star Strider
on 25 Jul 2014
That’s what I suspected from what I read. I would definitely encourage you to write a function for the File Exchange for your application.
The reason I didn’t formalise my pulse-oximeter functions and put them up is that there have never been any Questions that I’ve seen that asked for them. (Besides, they were relatively easy to figure out and code from the online documentation, so I suspect others had no problems with it either.)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!