nRF24AP1 - ANT Code - Garmin Heart-Rate Monitor

Glad to hear it’s working for you. I had used the voltage dividers too as proof-of-concept, but it was too clunky for me.

I still haven’t figured out all the serial comm. It seems that if I mess with the output too much, it stops sending the info. I don’t know if there is a buffer that I have to fill or whatever. But if it’s working for you, then it must be just me.

Good luck, and post anything fun that you do with it. I’ll do the same :wink:

mC

I’m trying to get this to work with an Arduino Uno and a Garmin chest strap. I have Vcc conected to the 3.3V pin on the Uno, ground connected to ground, rx connect to pin 3 on the Uno & tx connected to pin 2 on the Uno.

If I upload the mikecapito’s sketch without the chest strap nearby and then start the serial monitor I get the following:

Config Starting

TX: A4 1 4A 0 EF

TX: A4 2 4D 0 54 BF

TX: A4 2 4D 0 3D D6

TX: A4 3 42 0 0 0 E5

TX: A4 5 51 0 0 0 0 0 F0

TX: A4 9 46 0 B9 A5 21 FB BD 72 C3 45 64

TX: A4 2 44 0 A E8

TX: A4 2 45 0 39 DA

TX: A4 3 43 0 1F 86 7D

TX: A4 1 4B 0 EE

Config Done

RX: [sync]

RX: [sync]

RX: [sync]

RX: [sync]

RX: [sync]

RX: [sync]

RX: [sync]

RX: [sync]

RX: [sync]

If I have the chest strap nearby I get the same info except the RX: [sync] repeats itself indefinitely about once a second. It is the same whether I am wearing it or not.

I have the same problem like benoit22.

Just [sync] and nothing else. I use a Garmin HRM. The new ant+ with a soft belt.

Any suggestions?

Regards

Timbo

Sorry I missed this post before.

As mentioned in my previous post, I’ve had that problem when I tried to remove some of the debugging sent over the serial connection to the computer. It shouldn’t have an effect, but the problem went away when I put the debugging back. I moved on to something else but never figured it out. I had a guess that it needed something else to fill up the serial buffer, but never verified that. I’d be curious what people find. Did you remove any of the debugging serial outs?

I found out, that I have to give some debug comments to the console to see the heart rate. I have also noticed that a transmitter need to near the chip (within 5m or so) to see anything happend. So I used the ANTware II to simulate a sensor.

Right now I’m getting into the code. Does anyone know where to find the ID fot all device types. I want to connect some different types of sensores and to differentiate between the signals I need to know the device types. Maybe also for pairing them.

Regards

Tim

instead of adding the debug commands I added a couple delay statements and got mine working. Has anybody figured out the root cause? I don’t like the idea of slowing the program down.

I’m also interested in adding other devices has anybody made any headway on that front?

Just out of curiosity, where did you add the debug statements? What part needs to wait?

Anybody out there have an idiots guide to using ANTware II with a Garmin HR strap please?

I’m using b9 a5 21 fb bd 72 c3 45 as the Network Key.

Net # 0

Set channel 0 as slave receive

0, 78, 1 and pairing (also tried not pairing) neither worked.

Channel period 8070

Frequency 2457MHz

Can anybody spot what’s wrong with this set of parameters please?

Thanks Robert

Hi Robert,

First make sure you click set network key after entering it.

In the in the channel id boxes try entering zeros as these are treated as wild cards. My settings after using the wild cards show up as 53320,120,1. The first number is the device number which I guess is unique to my belt the other two are the standard numbers. You could also try 0,120,1 with only the device number as a wild card. Forget about the pairing bit it is not required. Good luck!

First of all, thank you for the sample code!

I’m using an Arduino Diecimila with the adafruit Atmega328 upgrade chip. I have the ANT board powered by 3V3 from the board, using the NewSoftSerial library and the TX and RX pins connected directly to pins 2 and 3 respectively. I’m using the Garmin heart rate strap to test this all out.

On my first attempt I saw what several others have seen - what looks like a successful configuration followed by an endless stream of “RX: [sync]” strings. After that, based on comments in this thread relating to timing, I added a Serial.println() right after the mySerial.read() statement in ANT_rxHandler(), and now I’m getting “Heartrate is XX” strings! I changed the println() to a delay(20) and it still seems to work.

Has anyone tried using the on-board serial to communicate with the ANT board?

I haven’t looked into it yet, but should it be possible to make the ANT board act as a sensor transmitter to transmit information to a Garmin ANT-capable watch like the FR60?

  • Chris

I’m getting this error…I’ve linked to the NewSoftSerial library. I’m an old fart trying to learn something new…any help is greatly appreciated…

sketch_nov15b.cpp: In function ‘int ANT_rxHandler()’:

sketch_nov15b:528: error: ‘class SoftwareSerial’ has no member named ‘available’

There is a neat Python library being developed for communicating with the nRF24AP1 USB ANT Stick. I have managed to get data from a Garmin Cadence Speed sensor and am busy writing a parser to get this information into metres/second, revolutions per minute etc.

The raw code for getting the information from the USB stick is here: https://github.com/agcooke/python-ant and the demo/ant.core/07-rawmessage3_SparkFun.py reads from the sparkfun stick. We have a little google group (https://groups.google.com/forum/?hl=en# … pen-source) for the library and I will hopefully be able to open source all the parsers and processing of the raw data which will primarily be written in Python and possibly some matlab.

connorly:
I’m getting this error…I’ve linked to the NewSoftSerial library. I’m an old fart trying to learn something new…any help is greatly appreciated…

sketch_nov15b.cpp: In function ‘int ANT_rxHandler()’:

sketch_nov15b:528: error: ‘class SoftwareSerial’ has no member named ‘available’

Hi Connorly,

You will need to use the NewSoftSerial library for this - and you will need to edit the header to use the NewSoftSerial library.

#include <NewSoftSerial.h>
...
// set up a new serial port
NewSoftSerial mySerial =  NewSoftSerial(rxPin, txPin);

Once this is done the code should compile.

Has anyone been able to successfully pair with this device:

GARMIN 010-10997-00 Heart Rate Monitor

http://new.digifit.com/hrm-garmin-heart … /index.asp

I have been having difficulty in getting this working with the nRF24AP1 - I have tested this on another ANT compatible machine (Concept2 Rower) and it does work, but I cannot get this heart rate monitor to connect/pair with the nRF24AP1 using the code that was provided a few pages back.

I am trying to also get this to work via a PC using a USB-Serial converter, sparkfun 5v-3v logic converter, and the nRF24AP1. Does anyone have any suggestions why I cannot get this to pair? I have tried the VB code that was on the product page - and it gives errors when it is trying to set up communications to the port (COM port is set to 4800bps).

This is the wiring diagram that I have quickly put together (I could have drawn this by hand faster but I am at work) which is how I currently have my device connected to my pc.

Hi everyone,

the previous information and all the documenation on the thisisant website have been very helpful. I am however still struggling to connect to my HRM through an arduino mega using the code posted in this forum. It appears i correctly initialize the ant component, but it never detects my sensor (either the hrm or a simulated one using my garmin ant usb key and the ant+ sensor simulator on my laptop). I am however able to detect my hrm directly on my laptop through the ant display simulator, meaning that there is some signal being sent, but my ant & arduino fail to receive it.

I am using an arduino mega, I connected the ant transceiver on +3v, gnd, and two pins for rx tx.

Config is apparently sent correctly (except for the second call A4 2 4D 0 3D D6 which returns an error message, but I do not believe this instruction is required in any case) and the channel is correctly open, but it never syncs with my hrm…

it does time out after the allocated time

Config Starting
TX: A4 1 4A 0 EF 
TX: A4 2 4D 0 54 BF 
TX: A4 2 4D 0 3D D6 
TX: A4 3 42 0 0 0 E5 
TX: A4 5 51 0 0 0 0 0 F0 
TX: A4 9 46 0 B9 A5 21 FB BD 72 C3 45 64 
TX: A4 2 44 0 A E8 
TX: A4 2 45 0 39 DA 
TX: A4 3 43 0 1F 86 7D 
TX: A4 1 4B 0 EE 
Config Done
RX: [sync]
..0x4..0x54..0x4..0x3..0x0..0x3..0xF0
RX: msg received-
RX: [sync]
..0x3..0x40..0x0..0x4D..0x28..0x82
RX: msg received-
RX: [sync]
..0x3..0x40..0x0..0x42..0x0..0xA5
RX: msg received-
RX: [sync]
..0x3..0x40..0x0..0x51..0x0..0xB6
RX: msg received-
RX: [sync]
..0x3..0x40..0x0..0x46..0x0..0xA1
RX: msg received-
RX: [sync]
..0x3..0x40..0x0..0x44..0x0..0xA3
RX: msg received-
RX: [sync]
..0x3..0x40..0x0..0x45..0x0..0xA2
RX: msg received-
RX: [sync]
..0x3..0x40..0x0..0x43..0x0..0xA4
RX: msg received-
RX: [sync]
..0x3..0x40..0x0..0x4B..0x0..0xAC
RX: msg received-

I have tried setting the network key before assigning the channel to no avail. i have managed to transmit data from my arduino to the ant+ display simulator however, meaning i can at least send data, but I still cannot receive any…

anyone has an idea ? could my ant transceiver be faulty ?

thanks a lot

UPDATE

I discovered (by mistake) that if I unplugged the Vin on the transceiver after the initialization, I received the data correctly! apparently it is only because I have a 5V arduino and I need to add a voltage divider, I’ll check on that and make sure to provide detailed instruction on how to get everything working once it does

Hi,

I’m trying also to get this code working with Suunto HRM, but my code doesn’t go past

"

int ANT_rxHandler()

{

Serial.println(“ANT_rxHandler”); //Debugging

int n, fd, rc, inmsg = FALSE;

UCHAR chr, msgN;

while (mySerial.available()>0)

{

"

Meaning it doesn’t do anything inside the While loop. So it must be that the mySerial.available()>0) doesn’t pass but what could be the problem?

Previously I have only worked with gyroscopes and accelerometers so this ANT world is a bit new to me.

Is there anyway I can be sure that I’m really even communicating to the nrf24AP1 module? Because those commands that do go through don’t require any feedback from the module. I am using a Arduino Mega but I build a logic level converter before connecting…

Any help would be nice and you guys have already been so much help!

Fisu, I’m in exactly the same boat as you except i’m using a garmin strap (the same strap that the OP of the arduino code was using) and i’m getting identical results - placing a debugging message inside the ANT_rxHandler shows that i’m never managing to get inside the while loop (ie myserial.available() is always returning a zero value).

I’m using a 3.3v mini, programming with arduino release 1.0 (which has the NewSoftSerial library already included). I’ve tried programming and watching the serial via windows and ubuntu (as i read somewhere that ubuntu serial can do some “interesting” things) with no change

I’ve tried increasing and decreasing the delay periods with no change.

I’ve tried turning off the hardware serial and hooking up the TX and RX pins (alternately) of the ant+ antenna to the serial to USB interface - looking at the arduino TX i see the data stream going to the ant+, looking at the ant+ TX i see nothing, it’s not talking back.

I’ve tried 2 different ant+ antennas

I’m wearing the strap when i’m trying and it definitely works (it talks to my edge 500 no worries).

running out of ideas - any suggestions for what else to try?

fisu:
Hi,

I’m trying also to get this code working with Suunto HRM, but my code doesn’t go past

"

int ANT_rxHandler()

{

Serial.println(“ANT_rxHandler”); //Debugging

int n, fd, rc, inmsg = FALSE;

UCHAR chr, msgN;

while (mySerial.available()>0)

{

"

Meaning it doesn’t do anything inside the While loop. So it must be that the mySerial.available()>0) doesn’t pass but what could be the problem?

I am assuming that you have made the changes as necessary to change the code from the Garmin to Suunto before attempting this?

Have you got the NewSoftSerial library or have you modified the code to work with the default library?

Could it be a fault with a batch of them perhaps?

I have not had any luck in the last two months of owning one of these boards, is there any other troubleshooting that anyone else can suggest before putting the board down as faulty?

I saw in another post that a user had the same issues, and a new board fixed the issues up…

Regards,

Des.