Theoretical possibilities...

125 views
Skip to first unread message

jonathan...@gmail.com

unread,
Jun 26, 2017, 12:51:32 PM6/26/17
to ant-api
I have no arduino experience, but I'm interested in learning arduino for a project and I want to know if this is possible before I get started:

Could I use this library to hook up an ultrasound distance sensor to an Arduino, then send the distance data to an ANT receiver (in this case a Garmin virb video camera)? 

The issues I foresee
  • Don't you need to select a "protocol" that the garmin will accept? - I was thinking you could use the ANT heart rate protocol?
  • What is the frequency of transmission for ANT? US distance sensors ping at 25hz. 
  • What is the smallest Arduino I could use? 
If I make this device and show others how to do it, am I likely to get angry legal letters from ANT? 

Sorry to be so vague, my plan is to see how difficult a task I've made for myself. If it is doable I'll buy a beginners arduino kit and start learning. 

Curtis Malainey

unread,
Jun 27, 2017, 12:52:38 AM6/27/17
to ant...@googlegroups.com
Hello Jonathan,

No worries, we were all in your shoes at one point.

  • Don't you need to select a "protocol" that the garmin will accept? - I was thinking you could use the ANT heart rate protocol?
Yes and no, the radios can talk to each other using this library. In order to interface with commercial products, you will need to implement an ANT+ profile over top of my library.  You can get the full list of profiles here but you will need to sign up as an ANT+ adopter (don't worry, its free). Make sure you read the copyright notice and disclosures as they will affect what parts of your code can be public. You will need to use the protocol supported by the device you are using (i.e., you can't use a heart rate protocol with a camera.) I looked at the protocol spec that I believe VIRB uses and I didn't see any mention of distance, what exactly are you trying to achieve?

  • What is the frequency of transmission for ANT? US distance sensors ping at 25hz.

That is one of the cool things about ANT radios is that their transmission rate is completely variable. The ChannelPeriod message is used to configure this. If you are using a device profile from ANT+ it will define what transmission rate you should use though. 

  • What is the smallest Arduino I could use? 
What exactly do you mean by smallest in this case? If you mean physical size, probably an adafruit trinket (I recommend the 3.3V variant as the radio can't tolerate 5V devices.) The downside about the trinket is it only has about 2k of flash I believe and 0.5k of ram and they fill up fast. Personally, I would recommend teensy 3.2 (also a 3.3V device), it's what I developed the library on, it's a bit past novice in terms of skill, but it's significantly faster has more code space and will have a bunch of features that you may not use right now but might in the future. Just make sure you get one with the pins already soldered on unless you have access to soldering iron.

Dynastream (the makers of ANT/ANT+) have no issues if you use my library, the issue lies with the ANT+ profiles. I cannot comment on copyright issues there, but they do have a forum moderated by employees which will be able to help you with copyright/licensing.

jonathan...@gmail.com

unread,
Jun 27, 2017, 1:21:21 AM6/27/17
to ant-api
Thanks for the help!

The use case is for a device that measures the distance of passing cars on a bicycle. 

I had a friend make a similar device and we just stored the Ultrasound data on an SD card, with a GPS in the arduino for time synching to the video. But the cost is high once you add storage and GPS and it is not very user friendly fishing through the bowels of the device to get the SD card out at the end of a ride, then merging the FIT file with the csv from the arduino and overlaying the passing distance over the video. 

If you could get it into the FIT file on the garmin device then it could be made an overlay on the video automatically using the garmin virbedit software. 


the Garmin does support the heart rate protocol, but what you're saying is that I'll get into trouble from ANT if I use it publicly without a licence. 

Very interesting thanks! 

Curtis Malainey

unread,
Jun 27, 2017, 1:59:41 AM6/27/17
to ant-api
That is a really cool project. I actually almost got sideswiped by a bus today on my bike.

I didn't realize the virbs have that protocol, then that could absolutely work. 

Just talk to the guys on the forum, they can clear up the licensing details. It's ANT+ that is licensing issue, ANT is fine.

Just a note, I have not implemented all the messages yet for the protocol, if you need any messages, please make an issue and I'll do my best to get it implemented. This fall I am looking to complete the messages and also add native support for the NRF52 (ie running arduino on it and using the radio locally.)

peter.van...@gmail.com

unread,
Jul 2, 2017, 6:38:34 PM7/2/17
to ant-api
Hi Curtis, I purchased an AdaFruit Feather52 board with the nRF52 on it. Would like to get it up and running with the Arduino and ANT+. AdaFruit has a nice BSP and it runs and connects with the Arduino IDE. Next step is to get the ANT+ up and running, I ran into your library which to me looks much simpler than the Nordic Softdevice. Would there be a possibility to get your library running on the nRF52 with a 2nd serial interface? BR Peter

Curtis Malainey

unread,
Jul 2, 2017, 8:03:25 PM7/2/17
to ant-api
Hi Peter,

The feather should absolutely be able to run the ANT stack, the only issue is loading the softdevice. I am still trying to figure out how to do that with custom bootloaders from Adafruit, Sparkfun, etc. If you figure this out, please share this information. The library currently only interfaces with the ANT network processor firmware which would run in place of whatever Arduino code would be uploaded. If you check out the roadmap, I do have a target (v2.0) to add support for running directly with the softdevice on the same board. Unfortunately, currently, it is not possible to use the library to control the local soft device.

Curtis

peter.van...@gmail.com

unread,
Jul 3, 2017, 3:28:58 AM7/3/17
to ant-api
Curtis,
I am going to try and load up the Softdevice as soon as I have the board received. As far as I have been able to find, is that it should be possible to flash the softdevice HEX file just through the serial bootloader delivered with the Feather52 board (https://www.adafruit.com/product/3406). Adafruit has only just slightly modified the standard Nordic bootloader that can do Serial and Over the Air updates. Then the next step should be to write the Arduino application by using the ANT+ interfaces for the Softdevice, which can be found and downloaded for the thisisant.com site (we have both the ANT+ only and combined ANT+ and BLE softdevice stack downloaded). 
If you have other ideas or tips just keep me posted! I am curious whether this can get to run in an easy way or not. So far I haven't found anything that really works with these SoC ANT+ implementations under Arduino IDE.

Curtis Malainey

unread,
Jul 3, 2017, 12:42:14 PM7/3/17
to ant-api
Hey Peter,

I was fiddling around with my NRF52 DK board last night and I think I was able to flash the S332 soft device onto it (BLE & ANT.) I ran out of time in order to be able to test it out, but it wasn't too hard. I modified the boards.txt config file for the NRF5 boards package to recognize a new softdevice and then added it to the directory of softdevices in the package. I had to modify the headers and ld config slightly but it loaded onto the board no problem using the arduino IDE. I will get back to you once I verify the softdevice is functional and I hope to publish a tutorial on how to do it, maybe even my own boards package. Just a note, you are downloading the ANT stack, the ANT+ protocol must be implemented over top of the ANT radio (yea, the names are so close that it makes it confusing.) https://www.thisisant.com/developer/ant-plus/ant-antplus-defined

peter.van...@gmail.com

unread,
Jul 3, 2017, 6:33:21 PM7/3/17
to ant-api
Ok thanks for the update! I know about the ANT+ profiles, but that is of later worries. I tried myself a bit around tonight on the AdaFruit Feather52 but ran into linker issues with merging their BSP and the nRF52 SDK for ANT. Somehow this doesn't work. Seems the AdaFruit's BSP for Arduino uses the FReeRTOS kernel which conflicts with the ANT library from the Nordic SDK..... I need to find another way I guess. So if you succeed just let me know, I will be happy to try it out for you. But I may need to run a minimalistic version of a BSP on the Feather52 board and ignore all of their BLE Libraries.
Keep me posted!

Curtis Malainey

unread,
Jul 3, 2017, 11:41:32 PM7/3/17
to ant-api
I didn't realize the feather was a bluefruit device. You might have some serious problems getting ANT on that device unless you abandon the board package and force the board to use another one. From what I have read, the bluefruit devices manage the BLE radio for you, which in my opinion is a blessing and a curse. But this also likely means the library is locked to one softdevice and changing it to anything (especially the ANT only devices) will be difficult. I have a couple spark fun nrf52 boards (https://www.sparkfun.com/products/13990) but I have yet to get them to be easily programmable. I think my FTDI cables are cheap knock offs that are causing problems. I am going to try to purchase SparkFuns FTDI beefy chip and see if that can program the boards but that won't be testable until September.

peter.van...@gmail.com

unread,
Jul 23, 2017, 5:37:40 PM7/23/17
to ant-api
Hi Curtis, for the time being I decided to abandon the Softdevice update to S212. I tried but experienced some extreme difficulties. It's simply not possible to easily update the Bluefruit to an S212 ANT softdevice stack. I have all tools available from Serial bootloading to ST-Link V2 and Segger J-link. Not any hardware combination is able to flash just the softdevice, without also erasing the Adafruit bootloader. I managed to extract just the bootloader and merg it with the S212 softwavice, but that doesn't work either. So then I probably would end up in re-writing the bootloader. For my goals in the project way too far. And then the Nordic SDK is a nightmare...... It's a terrible setup in endless different deeply nested repositories and files and directories which makes it extremely difficult to find the right files and code snippets you need. I managed to create an Eclipse setup with their SDK and ran some sample code with success. But changing to the ANT stack is difficult. For now, I decided to just quit on it because of time reasons. I will hook up an AP2 module that I have here to the board and try to use your ANT+ software. Do you have any recommendations on how to setup a 2nd UART channel to it? Can I use the SoftwareSerial or another Serial1 library and modify it to use the ant.cpp files and run that in an easy way on the nRF52? Any thoughts would be appreciated. Thanks for your help so far. BR/Peter

Curtis Malainey

unread,
Jul 23, 2017, 7:59:54 PM7/23/17
to ant-api
Yeah, the upgrade to is not easy, I haven't had many spare cycles to work on the project this summer. I think I just have a few memory bound issues on the nRF52 DK. I am impressed that you went that far, I would have avoided the Nordic SDK at all costs. I haven't tested it with the AP2 module, but the interface should be the same (or similar, +/- a few messages) assuming you have the network processing firmware loaded. The library is designed to handle any type of UART, there is a soft serial example in the library. Just pass in any serial object you wish to use to the "setSerial" command. If you had an nRF52 also running the networking firmware it would also work.

As for running natively on the nRF52, I still have to figure out why the code doesn't run after its loaded (with the s332 soft device.) Once I figure that out I hope to modify the library to handle native commands to make it more portable and I hope to release it by the end of the year, but that depends on how my Fall goes.
Reply all
Reply to author
Forward
0 new messages