An Implementation of the ANT+ Network on top of ant-arduino

Overview

antplus-arduino

An Implementation of the Ant+ Network on top of ant-arduino

Status

Build and Tests BCH compliance

News

  • 6/28/2020 v2.0.0 of ant-arduino released with support for mbed and softdevices
  • 8/20/2019 v1.0.0 released, master profiles now are available
  • 10/1/2017 v0.1.0 Version released, library added to managers
  • 9/24/2017 Proof of concept complete (for system design)
  • 9/4/2017 Project Started

Roadmap

  • Build support for non-ANT+ channel interfacing
  • Adding more profiles

Developer's Guide

Example

I have created several sketches of configuring the radio with the ant-arduino library. You can find these in the examples folder. Here's an example of configuring a channel with a NRF51 radio:

AntWithCallbacks ant = AntWithCallbacks();
AntPlusRouter router = AntPlusRouter();
ProfileHeartRateMonitor hr = ProfileHeartRateMonitor(WILDCARD_DEVICE);

void previousHeartBeatDataPageHandler(HeartRatePreviousHeartBeat& dp, uintptr_t data) {
    Serial.print("HR: ");
    Serial.println(dp.getComputedHeartRate());
}

void setup() {
    Serial1.begin(BAUD_RATE);
    ant.setSerial(Serial1);
    delay(10000);

    router.setDriver(&ant); // never touch ant again
    router.setAntPlusNetworkKey(NETWORK_KEY);
    router.setProfile(CHANNEL_0, &hr);
    // Delay after initial setup to wait for user to connect on serial

    Serial.begin(BAUD_RATE);
    Serial.println("Running");
    hr.onHeartRatePreviousHeartBeat(previousHeartBeatDataPageHandler, NULL);
    hr.begin();
    // wait for pair to complete
    hr.waitForPair();
}

void loop() {
    router.loop();
}

See the examples folder for the full source. There are more examples in the download.

To add ANT support to a new sketch, add "#include <ANTPLUS.h>" (without quotes) to the top of your sketch. You can also add it by selecting the "sketch" menu, and choosing "Import Library->ANT+".

Hardware

See ant-arduino

Support ANT+ Profiles

This library aims to support all ANT+ devices. This goal will take time but its an attainable one. Check out the wiki for the list of profiles implemented and their versions.

Installation

Note: This library depends on ant-arduino. You must have it installed for it to work. If you are using platformio you don't have to worry about this.

Arduino 1.5 and later

Arduino now includes a library manager for easier library installation. From the Sketch menu select include library->Manage Libraries, then type "antplus-arduino" in the filter and install.

Prior to Arduino 1.5 installation is manual

Download a .zip or .tar.gz release from github. Determine the location of your sketchbook by selecting "preferences" on the Arduino menu. Create a "libraries" folder in your sketchbook and unzip the release file in that location.

If you are using platformio you can install the library by running platformio lib install 1879

Uploading Sketches

Uploading sketches with a Leonardo is as simple as connecting the Arduino to your computer and uploading. When using a single serial port Arduino, such as the Pro Mini (3.3V), the jumpers on the ANT Radio must be disconnected. Then, after upload, reconnect the lines to have access to the serial port. Always remember to power off the Arduino before moving the jumpers.

Configuration

See ant-arduino

Questions/Feedback

Questions about this project should be posted to http://groups.google.com/group/antplus-api?pli=1 Be sure to provide as much detail as possible (e.g. what radios, firmware versions, configuration and code).

Consulting/Commercial Licenses

At the current time there is zero support for commercial usage. Contact me via email if you are looking to use this code commercially.

If you are looking for commercial support for ANT radios go to thisisant.com

NOTE: This library is not ANT+ certified and does not intend to be. It is meant to be tool to get quick and easy access to sensors in the ANT+ network. There are edge cases where it will fail to meet the spec of the ANT+ protocol.

Comments
  • Help with NativeAnt on nRF52840

    Help with NativeAnt on nRF52840

    Hi all, following the known blog entries I was finally able to flash the arduino core on a nRF52840 MDK USB Dongle (https://wiki.makerdiary.com/nrf52840-mdk-usb-dongle/) using the S340 SoftDevice. After setting the required Network keys and so on I am trying to let the first examples work. Unfortunately something is not working and I am having issues debugging the system.

    I tried the DeviceSearch example and substituted the "ArduinoSerialAntWithCallbacks" with "ArduinoNativeAntWithCallbacks", but I am unfortunately not able to find my HR Monitor. Also trying the Sensor examples, the device remains not visible. How can I ensure that the Bootloader and Softdevice are correctly working?

    thank you for the great project Silvio

    opened by silviocross 13
  • Seeeduino nRF52840 problems

    Seeeduino nRF52840 problems

    Hi,

    I've downloaded the project and tried to compile the example "Bicycle Power Sensor", but first it throws an error on line 19 `C:\Users\User\AppData\Local\Temp.arduinoIDE-unsaved20221029-18884-13azw4e.zxko\BicyclePowerSensor\BicyclePowerSensor.ino: In function 'void setup()': C:\Users\User\AppData\Local\Temp.arduinoIDE-unsaved20221029-18884-13azw4e.zxko\BicyclePowerSensor\BicyclePowerSensor.ino:19:19: error: 'Serial2' was not declared in this scope; did you mean 'Serial'? 19 | #define antSerial Serial2 | ^~~~~~~ C:\Users\User\AppData\Local\Temp.arduinoIDE-unsaved20221029-18884-13azw4e.zxko\BicyclePowerSensor\BicyclePowerSensor.ino:61:5: note: in expansion of macro 'antSerial' 61 | antSerial.begin(BAUD_RATE); | ^~~~~~~~~

    exit status 1

    Compilation error: 'Serial2' was not declared in this scope; did you mean 'Serial'?`

    then I've changed to Serial1 and put the network key from thisisant.com, the sketch is compiled and uploaded, but my Edge 1040 didn't find the sensor.

    Is it possible because the device is new?

    Regards, Hristo

    opened by HristoMarkow 12
  • ANT+ Examples do not build on Arduino for Adafriut nRF52840 Express

    ANT+ Examples do not build on Arduino for Adafriut nRF52840 Express

    I've installed the board libraries for the Adafruit Feather nRF52840 Express and ANT-Arduino and ANTPLU-Arduino. I get errors trying to build the HeartRateMonitor example. The code uses ArduinoSerialAntWithCallbacks, but I believe I should use ArduinoNativeAntWithCallbacks with this board. Is that correct? Are there instructions on how to build native ANT code for this board?

    These are the errors: /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/HeartRateMonitor.ino.cpp.o: in function defaultDataPageHandler(HeartRateDefaultMsg&, unsigned int)': /home/jludwig/Arduino/libraries/ANTPLUS-Arduino/examples/HeartRateMonitor/HeartRateMonitor.ino:100: undefined reference toSerial' /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/HeartRateMonitor.ino.cpp.o: in function manufacturerInformationDataPageHandler(HeartRateManufacturerInformationMsg&, unsigned int)': /home/jludwig/Arduino/libraries/ANTPLUS-Arduino/examples/HeartRateMonitor/HeartRateMonitor.ino:107: undefined reference toSerial' /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/HeartRateMonitor.ino.cpp.o: in function productInformationDataPageHandler(HeartRateProductInformationMsg&, unsigned int)': /home/jludwig/Arduino/libraries/ANTPLUS-Arduino/examples/HeartRateMonitor/HeartRateMonitor.ino:121: undefined reference toSerial' /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/HeartRateMonitor.ino.cpp.o: in function setup': /home/jludwig/Arduino/libraries/ANTPLUS-Arduino/examples/HeartRateMonitor/HeartRateMonitor.ino:47: undefined reference toAdafruit_USBD_CDC::begin(unsigned long)' /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /home/jludwig/Arduino/libraries/ANTPLUS-Arduino/examples/HeartRateMonitor/HeartRateMonitor.ino:64: undefined reference to Serial' /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/ANT-Arduino/MainClasses/ANT_ArduinoSerialAnt.cpp.o: in functionArduinoSerialAnt::ArduinoSerialAnt()': /home/jludwig/Arduino/libraries/ANT-Arduino/src/MainClasses/ANT_ArduinoSerialAnt.cpp:13: undefined reference to Serial' /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: ../arduino_cache_635859/core/core_adafruit_nrf52_feather52840_softdevice_s140v6,debug_l0_e7698368969bfe2927a612dac99d781a.a(Uart.cpp.o): in functionserialEventRun()': /home/jludwig/.arduino15/packages/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Uart.cpp:27: undefined reference to Adafruit_USBD_CDC::available()' /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /home/jludwig/.arduino15/packages/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Uart.cpp:27: undefined reference toSerial' collect2: error: ld returned 1 exit status exit status 1 Error compiling for board Adafruit Feather nRF52840 Express.

    opened by jludwig75 10
  • Use library on Seeeduino Xiao ble sense

    Use library on Seeeduino Xiao ble sense

    Hi

    I am trying to make an antplus sensor to send data to my garmin edge. For this I was going to use the Seeed Xiao BLE sense board (nRF52840) together with the antplus-arduino library.

    I installed the Seeed Xiao, the antplus library and ant library on the arduino IDE as described in following link: Getting Started with XIAO BLE (Sense) - Seeed Wiki 1 Now I can upload example projects from seeeduino to the board and I can compile examples from the antplus library on other boards.

    Whenever I try to compile an example from the antplus library on the seeeduino board, I get following errors:

    image

    When I look in the header files of the seeeduino board, I noticed indeed that the Serial was defined as UART1: image It seems that the antplus library can not handle this, and does not recognize UART1 as a type?

    Thanks in advance for any help!

    opened by ScrapTech 8
  • New profile Shifting/Shifter.  Initial checkin.

    New profile Shifting/Shifter. Initial checkin.

    Dont't know, if you really want to merge this code in such an early state. For my purpose, it is sufficient, I do not plan to make it more sophisticated (except bug fixing).

    opened by Sepp62 6
  • antplus arduino power profile

    antplus arduino power profile

    Addition of power profile for Power Only, Crank Torque, and Wheel Torque for display. Display example included. Rx only, not Tx messages. Parameters, manual zero, etc. not included. CTF not included (not able to verify profile, does not fit bye ordering of ANT+ standard profiles). Wheel torque will require verification with a wheel/hub based power meter. Power only and crank torque verified with Favero Assioma Duo pedals.

    opened by sporkfly 5
  • Yun Usb

    Yun Usb

    Hi, Do you know if it's possible to get this library to build on a Arduino Yun? With it's spare standard usb port I'd like to try and implement direct reading of a Ant+ usb receiver for multiple heart rate monitors, but initial tests seems the library is incompatible with Yun. Can you provide any help or insight?

    R:Won't Fix 
    opened by fooldome 5
  • Will this work with the ESP32?

    Will this work with the ESP32?

    Hi, I've read that the ant arduino only with this the NRF51/52, but this library is said to work with all architectures, so does it work with the ESP32?

    opened by bsperryn 4
  • Fec (JunOllyLi)

    Fec (JunOllyLi)

    Hello @JunOllyLi

    I noticed you created the FEC and Power meter profiles, would you like to add this to the core library so everyone else can use it? Thanks for the excellent code.

    opened by cujomalainey 2
  • Move to transimssion type bitfield defines

    Move to transimssion type bitfield defines

    Transmission type bitfield has been added to ant-arduino, switch to using those defines once the package has been updated globally so CI doesn't get mad

    AP:Environment AP:HeartRate AP:Base S:Trivial R:Fixed AP:LEV AP:Shifting AP:Moxy AP:BicycleSpeed AP:BicycleCadence AP:BicycleSpeedAndCadence 
    opened by cujomalainey 1
  • Add support for manufacturer specific pages

    Add support for manufacturer specific pages

    currently only pre-defined pages can be added to profiles. There is no mechanism to install additional datapages into the datapage rotation or cleanly handle manufacturer specific pages on the slave side (currently it can only be done through default handlers)

    AP:Base S:Major T:Feature 
    opened by cujomalainey 1
  • Add shared channel handling

    Add shared channel handling

    with the addition of transmission type bit field data. Channels can automatically identify if the channel is a shared channel. Certain profiles (bike lights) use shared channels. This re-arranges the order of the first 2 to 3 bytes depending on the mode. This change should be transparent to the user.

    One of two solutions exist. One is to add this into the BaseDataPage(Msg) but then all profiles have to carry the burden of using this additional check when accessing data.

    An alternative is to extend the BaseDataPage into a "shareable" datapage which implements the additional logic so the marginal overhead of one additional check is not seen by other profiles.

    AP:Base S:Major T:Feature 
    opened by cujomalainey 0
  • BaseMasterProfile support all common datapages

    BaseMasterProfile support all common datapages

    profiles which support common datapages can enable support for other common datapages at their discretion. A mixin can be made to mixin support for all common pages and then adjust the broadcast pattern accordingly.

    AP:Base S:Minor T:Feature AP:Common DataPages 
    opened by cujomalainey 0
  • LEV add missing fields once documented

    LEV add missing fields once documented

    It appears Simulant+ has some additional fields that are not documented in the datasheet. Once upstream is fixed they will need to be added to the profile.

    Discussion: https://www.thisisant.com/forum/viewthread/7199/

    S:Trivial T:Feature AP:LEV 
    opened by cujomalainey 0
Releases(1.2.0)
  • 1.2.0(Feb 7, 2022)

    Apologies to those that contributed to this release given how long it took to push out

    This add multiple features from community contributions including the following profiles

    • FEC
    • Shifting
    • MuscleOxygen
    • BicyclePower

    This also included a large internal refactor to reduce boilerplate code bloat.

    Enjoy

    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Jun 29, 2020)

  • 1.1.0(Jun 29, 2020)

    General refactor to fix issues found via static analysis as well as the handle the breaking changes in v2.0.0 of ant-arduino. No new features.

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Aug 21, 2019)

  • 0.3.0(Jun 28, 2019)

    • Added support for proper runtime channel handling
    • Various important bug fixes
    • Added some core infra to be used in upcoming profiles and searching methods
    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Feb 5, 2018)

  • 0.1.0(Oct 2, 2017)

Owner
Curtis Malainey
🇨🇦, @ualberta CompE Alum, Hardware Enthusiast, ⛰️🌲🏕️ Explorer
Curtis Malainey
Arduino Library for network connections management

Arduino Library for network connections management Library for handling and managing network connections by providing keep-alive functionality and aut

Arduino Libraries 51 Dec 21, 2022
Arduino Arduino library for the CloudStorage server project. The library provides easy access to server-stored values and operations.

Arduino-CloudStorage Arduino/ESP8266 library that allows you to easly store and retreive data from a remote (cloud) storage in a key/value fashion. Cl

Gil Maimon 7 Jan 30, 2022
Arduino library for making an IHC in or output module using an Arduino

Introduction This is an Arduino library for making an IHC in or output module using an Arduino. (IHC controller is a home automation controller made b

Jens Østergaard Nielsen 2 Mar 26, 2020
ArduinoIoTCloud library is the central element of the firmware enabling certain Arduino boards to connect to the Arduino IoT Cloud

ArduinoIoTCloud What? The ArduinoIoTCloud library is the central element of the firmware enabling certain Arduino boards to connect to the Arduino IoT

Arduino Libraries 64 Dec 16, 2022
Server side minimalistic HTTP protocol implementation for the Arduino platform.

ArduinoHttpServer Server side minimalistic Object Oriented HTTP protocol implementation for the Arduino platform. ArduinoHttpServer is a simple HTTP r

Sander 18 Oct 17, 2022
Library for ATMEGA328P-based RFM95 Board for Loraid's LoRaWAN Network

Arduino LoRa.id SDK This repository contains the simple LoRaWAN library originally created by Ideetron B.V. This library is slightly modified and enca

null 5 Oct 21, 2021
Arduino library for controlling the MCP2515 in order to receive/transmit CAN frames.

107-Arduino-MCP2515 Arduino library for controlling the MCP2515 in order to receive/transmit CAN frames. This library is prepared to interface easily

107-Systems 51 Nov 16, 2022
Arduino library for interfacing with any GPS, GLONASS, Galileo or GNSS module and interpreting its NMEA messages.

107-Arduino-NMEA-Parser Arduino library for interfacing with any GPS, GLONASS, Galileo or GNSS module and interpreting its NMEA messages. This library

107-Systems 15 Jan 1, 2023
Arduino library for providing a convenient C++ interface for accessing UAVCAN.

107-Arduino-UAVCAN Arduino library for providing a convenient C++ interface for accessing UAVCAN (v1.0-beta) utilizing libcanard. This library works f

107-Systems 54 Jan 2, 2023
A RESTful environment for Arduino

aREST Overview A simple library that implements a REST API for Arduino & the ESP8266 WiFi chip. It is designed to be universal and currently supports

null 1.2k Dec 29, 2022
Arduino web server library.

aWOT Arduino web server library. Documentation 1. Getting started Hello World Basic routing Application generator Serving static files 2. Guide Routin

Lasse Lukkari 246 Jan 4, 2023
Arduino, esp32 and esp8266 library for ABB (ex PowerOne) Aurora Inverter, implement a full methods to retrieve data from the Inverter via RS-485

ABB Aurora protocol You can refer the complete documentation on my site ABB Aurora PV inverter library for Arduino, esp8266 and esp32 I create this li

Renzo Mischianti 22 Nov 22, 2022
MCP2515 CAN Controller Driver for Arduino

MCP2515 CAN Controller Library for Arduino Compatibility with the ACAN library This library is fully compatible with the Teensy 3.x ACAN library https

Pierre Molinaro 47 Dec 13, 2022
Arduino library for the MCP2515 CAN Controller

MCP2515 CAN Controller Library for Arduino Compatibility with the ACAN library This library is fully compatible with the Teensy 3.x ACAN library https

Pierre Molinaro 4 Dec 18, 2022
Arduino CAN driver for MCP2517FD CAN Controller (in CAN 2.0B mode)

MCP2517FD CAN Controller Library for Arduino (in CAN 2.0B mode) Compatibility with the other ACAN libraries This library is fully compatible with the

Pierre Molinaro 13 Dec 22, 2022
Distribution of Arduino driver for MCP2517FD CAN controller (CANFD mode)

MCP2517FD and MCP2518FD CAN Controller Library for Arduino (in CAN FD mode) Compatibility with the other ACAN libraries This library is fully compatib

Pierre Molinaro 31 Dec 21, 2022
CAN / CANFD Arduino Library for Teensy 4.0

CAN Library for Teensy 4.0 / 4.1 It handles Controller Area Network (CAN) for CAN1, CAN2 and CAN3, and Controller Area Network with Flexible Data (CAN

Pierre Molinaro 12 Dec 9, 2022
Unified interface for selecting hardware or software SPI implementations on Arduino platforms

AceSPI Unified interface for selecting hardware or software SPI implementations on Arduino platforms. The code was initially part of the AceSegment li

Brian Park 1 Oct 22, 2021
Unified interface for selecting different implementations for communicating with a TM1637 LED controller chip on Arduino platforms

AceTMI Unified interface for communicating with a TM1637 LED controller chip on Arduino platforms. The code was initially part of the AceSegment libra

Brian Park 0 Feb 2, 2022