Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Off-the-shelf interface to log data (to PC or mobile phone)

Rank

Total Posts: 16

Joined 2014-04-09

PM

Hello, all ANT/ANT+ developers,
I am interested in logging heart-rate data on (say) a second-by-second basis.

I can see that many products from companies such as Garmin, Suunto, Polar, Timex, Adidas and Wahoo are available, and they will display the instantaneous heart-rate of the wearer.
However, in terms of the data that they save, or log to a file, for the products I saw generally all that is available after an exercise session is simple summary data like 'peak' heart rate, duration of 'high' heart-rate, and so forth. That is not what I want: I would like to continuously capture the data and timestamp each datum.

Online I can see that someone developed a graphing app, which is a bit related to what I want.

Ideally, if the consumer device itself won't save this data internally, then I would like to be able to either
(1) plug a USB stick or key into my laptop or desktop computer, and log the data stream using some off-the-shelf software tool;
(2) interface to the heart-rate chest belt with a mobile phone, either through its native capabilities, or by plugging in a dedicated key, and log the data stream using some off-the-shelf app.

I do have some programming skill and am reasonably computer literate, but more for e.g. evaluating mathematical equations and tweaking the OS, and am not experienced in programming for remote networking, data packet sniffing, etc.

Can anyone tell me how feasible the above is, and what would be required to do it?

Thanks in advance for your advice,
DIV      
Rank

Total Posts: 16

Joined 2014-04-09

PM

After more searching online, I found that Zephyr is making Bluetooth products that can log heart-rate data that might be in the form I need.
However, I'm still interested in any alternatives as per my original post.      
Avatar
RankRankRankRank

Total Posts: 235

Joined 2012-08-31

PM

The products you mention do enable you to graph heart rate for an activity. I've attached a screenshot from an activity earlier this week. When I zoom in this appears to be plotted with data points from 5 minute intervals - so not once per second, but certainly giving me a pretty good feel of when I stopped to rest, went uphill, walked faster etc.

From your post though, I'm not sure whether you would like more frequent sampling, or literally want to record every heart beat?

Both are possible as you correctly note that this data is transmitted in real-time. One tool that you can use to record the data stream is SimulANT+ (you can get this from the downloads page). This runs on a PC with an ANT USB stick plugged in. Select the heart rate display simulator, and you should be able to pair with your heart rate strap and see the event log of the messages as they come in.

This application does not graph the data for you, but it has a scripting interface, so that you can generate your own graphs.

You can also download the ANT+ Heart Rate Device Profile to understand exactly how the heart rate data is transmitted.

For both of these you will need to be signed up as an ANT+ Adopter (basically agree to terms of use - no cost). You can do this here: http://www.thisisant.com/my-ant/adopter/join-adopter

Hope that helps,

Kat
     
Rank

Total Posts: 16

Joined 2014-04-09

PM

Dear Kat,
thanks for your helpful reply.

We are interested in 'exercises' (in a loose sense of the word) that might only last for 10–15 minutes, so definitely a record with precision smaller than 1 datum per minute would be beneficial.
I figure if I can capture 1 datum per second, then it will assuredly be fine enough to match against any events occurring during the 'exercise'.

I'll sign up for the extra access and try out the SimulANT+ tool you mentioned.

So far we haven't purchased a heart-rate chest belt. It sounds like any one that is ANT+ compatible should be at least 'okay'. [Actually, if the strap only says "ANT", not "ANT+", is that still okay?] I vaguely recall reading that some typical wristwatch-style monitors won't record 'resting' heart-rate, but I guess this is more to do with the interface and processing occurring inside the 'watch' (or iPhone, etc.), and I guess that the chest strap would transmit regardless of the heartrate (provided it detected a beat). Does that sound right to you?
Recording every individual beat could be kind of interesting, although it means an extra data processing step for me. I was guessing the strap itself already converted the individual beats into a rate, but I will check the ANT+ Heart Rate Device Profile you referred to for the actual specifications.

The Zephyr equipment looks quite good, with some interesting features — judging by their website — but would also work out more expensive (> $500).
For the setup you described, if I understand correctly, it would require a chest strap (< $100), plus an ANT USB stick (for which I take ANTUSB-m as an obvious choice, ~$20).

Regards,
David

P.S. In your graph I assume that your "walk home" took about an hour, so that 50:00 represents 50 minutes. In that case by looking at the spacing between neighbouring spikes upward or downward in the chart I estimate it is displaying at a resolution of approximately 1/8th of a minute in time, i.e. one datum every ~7.5 seconds. This is by using the free tool MB-Ruler.

P.P.S. I also got some feedback from Wahoo:
"If you're using a Bluetooth HR Monitor you can pair to the iPhone 4s or newer and record HR in the Wahoo Fitness app. [...] You can also email the workout files to yourself and open in excel [but this requires more effort.]"      
Avatar
RankRankRankRank

Total Posts: 235

Joined 2012-08-31

PM

Dear David,

Yes, it took about an hour.

You would want to look for an ANT+ heart rate strap - if it's just ANT then it will use the ANT radio to transmit heart rate data, but using a proprietary format that can only be interpreted by the company's system. "ANT+" stands for interoperability. There are many ANT+ heart rate straps to choose from: http://www.thisisant.com/directory/filter/~/62/~/ These will all transmit data in the format described by the ANT+ Heart Rate Device Profile. I would expect several of these to be available on amazon (or similar) so you can check reviews there for product quality info.

You can then receive this data using SimulANT+ (as already mentioned). This gives you the actual data stream and includes every heart beat. You are correct that this just needs a heart rate strap and usb stick. The ANTUSB-m is great.

The ready-made alternative is to receive the heart rate data using an ANT+ heart rate display that records data in a FIT file - I use a Garmin FR60 watch, which does this (I checked and it records heart rate every 5s). Bike computers tend to record every second. You could also try out some phone apps if you have an ANT enabled phone (http://www.thisisant.com/developer/resources/tech-bulletin/need-to-talk-to-phones-use-ant/).

FIT is an interoperable standard for sports files that is pretty compact and can be used directly by sites like Garmin Connect, Strava, Training Peaks etc. You can also convert these to CSV and view them in Excel if you prefer.

http://www.dcrainmaker.com/?s=heart+rate <-- This site has a lot of very detailed information about all of this and is probably a better place to find product and consumer related info than here.

I think that measuring heart rate is a little different at intense exercise levels vs at resting levels, and some of the newer technologies like optical HRMs may be better at one or the other. If you go for a more standard chest strap it's probably fine across the board. I am not a heart rate expert though, so do check if you need good accuracy. I've never had an issue getting a heart rate strap to transmit data, so I think it's just a question of accuracy.

Kind regards,

Kat      
Rank

Total Posts: 16

Joined 2014-04-09

PM

Dear Kat,
thanks for the extra information. I haven't yet had a chance to do much more yet.

However, one thing that's interesting is that I managed to get hold of some (ostensibly) "raw" data* (possibly from a Garmin device**, but not 100% sure).
The file has data logged every second. To my surprise, what is logged in the file seems to have been derived as follows:
Detect the number of heartbeats in each one-second interval, and extrapolate from that what the heartrate is in beats per minute, just multiplying by 60(ish).
Hence:
1 beat during the one second interval ==> assumed ~60 bpm
2 beats during the one second interval ==> assumed ~120 bpm
3 beats during the one second interval ==> assumed ~180 bpm

You can see most of the raw data has a value at or near 60, 120, and 180 bpm, and several also halfway between at ~90 and ~150. Note sure if this is a feature of the chest strap, the display device, or the logging software. (And sorry if the ANT+ HR specifications explain all this: I will look at them ...soon!)
However, I'm pretty certain the display device would not actually display anything like the "raw" data — it would be so off-putting.

The numbers only begin to look more sensible if I smooth them myself (not included in the original log file).

After this experience, I am starting to think it may be more trustworthy for our application to have the actual log of heartbeats.

—David

P.S. On the horizontal axis the time format wasn't recognised, so the number is just the number of the datum in the record. The log actually runs from 2014-04-10T11:54:21Z until 2014-04-10T12:46:25Z, and there are 3125 entries, which is consistent with one entry per second.

* The data was obtained opening a GPX file in Excel. I also got a TCX file with the same numerical data. By the way, this seems to have had some involvement of a bicycle 'computer', as the activity is Biking, and cadence is also recorded in the file (and cadence has smoother variation in values).
** There is a reference to Garmin xmlschemas in the file.
     

File Attachments

Rank

Total Posts: 16

Joined 2014-04-09

PM

Hi, Kat (& all),
I followed your advice regarding using the heart rate display simulator in SimulANT+ on a PC with an ANT USB stick plugged in. We also purchased the new-release Mio LINK, and this 'automatically' is paired, and we can log correctly.

Next question, suppose if we either
(a) duplicate the system — i.e. a second Mio LINK, and a second copy of SimulANT+ on a second PC with a second ANT USB stick plugged in — and run both systems inside the same small room;
(b) purchase another ANT+ heart-rate device such as the Garmin FR70 — complete with both 'sensor' and display;
is it possible there is going to be any confusion or crosstalk or problem??

I assume the Garmin display might preferentially pair to the Garmin strap. But presumably both broadcast signals could get picked up by the ANT USB stick.
At the moment I am not actively setting up a connection, it 'just happens'. So would SimulANT+ attempt to log both of these signals? Or could SimulANT+ log one signal for a while, and then if that signal briefly dropped out, pick up the other signal and start logging it instead, until it in turn briefly drops out, and so on??

Thanks,
DIV

P.S. In terms of coding, what version of Python is supported? Any recommendations of an online manual/tutorial? Some commands I tried in editing the script worked, and others did not, perhaps because they are in too recent a version?
EDIT: I just remembered that actually the script language might be IronPython, rather than Python. So this might explain why some commands weren't recognised (specifically, datetime methods and string methods). Nevertheless, the same issue applies, and I'd be happy to get any recommendations for IronPython manuals/tutorials.
The demo scripts are very helpful to get started. Do you know of any basic demo with some graphing? When you mentioned the possibility of graphing, would that appear as a (new) 'control' in the existing SimulANT+ window, or did you intend that a new window must be launched for the graph?
     
Avatar
RankRankRankRank

Total Posts: 235

Joined 2012-08-31

PM

Hi David,

Great that you've got this working. One note - the FR70 is a watch (display), that comes packaged with a separate heart rate strap.

Yes, the scripting engine is IronPython. There is a scripting interface help file included in the zip package, which will hopefully answer your questions (I haven't read it to check though!).

With respect to pairing, the Garmin watch will not preferentially pair to a Garmin strap - it should be able to find and pair with any ANT+ HRM. You need to switch on 'pairing' in the menu and then activate the heart rate monitor that you want it to pair with. Once it has connected it will store the pairing info and only connect to that HRM in future unless you turn on pairing again through the menu.

You can control which device SimulANT+ pairs to by specifying the device number (under ANT Channel Configuration, Channel Parameters, Device Number). This is typically the least significant 2 bytes of the ESN. Zero acts as a wildcard in this field, so if you haven't set it, then SimulANT+ will connect to the first HRM it finds. Once connected, it will try to find the same device if it loses the signal. However if it can't reconnect and the channel times out and closes then you may need to specify the device number again.

One final note - It is possible to pair to the same ANT+ HRM with several displays at the same time. This is part of normal ANT functionality.

If you'd like to understand ANT pairing I'd recommend the application note AN02 Device Pairing.

Hope that helps,

Kat

p.s. forgot to mention. You shouldn't have any crosstalk issues with that number of devices. Just make sure you pair each display to the device you want to listen to.      
Rank

Total Posts: 16

Joined 2014-04-09

PM

Dear Kat,
your advice is invaluable. Thanks for the quick reply. We'll give it a go!
—David      
Rank

Total Posts: 16

Joined 2014-04-09

PM

By the way, for anyone else wondering how to discover the "least significant 2 bytes of the ESN", I found the method that worked for me was:
1. Only have one physical ANT+ transmitting device (heart rate monitor, in this case) turned on.
2. Pick up its signal using SimulANT+ with the channel set to 0, and selecting "Turn On".
3. The/An identifier is shown in the messages in the pane at far right of the interface.
In my case, for my two devices, these identifiers were 17455 and 20918 (excuse my ignorance, but not what I was anticipating as a two-byte code).
P.S. I thought it should be also possible to get this identifier through the IronPython script, but apparently this is more difficult than I expected. I will post this to a separate question.