MATLAB Answers

Capturing heart rate from USB ANT+ dongle and chest strap

65 views (last 30 days)
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

Accepted Answer

Star Strider
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.)
Set the USB interface up as a serial port. See the Serial Port Devices documentation for details.
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
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.

Sign in to comment.

More Answers (1)

Marc Lalancette
Marc Lalancette on 25 Jul 2014
I finally got some details on the ANT forum, which I will paraphrase here to my limited understanding level:
Some ANT USB dongles use a Nordic chip for ANT, but a separate chip for USB; that second chip either from SiLabs or FTDI, thus the possibility of using a VCP driver. Other dongles use a Nordic chip which has USB integrated, and that "requires writing code to interface with". This is the case for my dongle "ANT USB Stick 2", which uses the nRF24AP2-USB chip with USB integrated, that uses the driver libusb.
Thankfully, there are quite a few code examples for me to look at, in particular from the ANT developer site. If I get this to work, I'll probably post the code on the file exchange, but it could take a little while.
  1 Comment
Star Strider
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.)

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!