An implementation of a ANT driver for Arduino, Mbed and ESP-IDF

ant-arduino

Arduino library for communicating with ANT radios, with support for nRF51 devices. This library Includes support for the majority of packet types.

Status

Build Status Test Status

News

  • 06/28/2020 ant-arduino v2.0.0 released with mbed support
  • 10/01/2017 Antplus-arduino released
  • 09/30/2017 Callback system complete, v1.0.0 released
  • 09/10/2017 System refactor complete
  • 12/26/2016 More examples and Tx added
  • 06/08/2016 Initial Experimental Rx only release
  • 04/21/2016 Project forked from Andrew Wrapp xbee-arduino

Roadmap

  • Add support for Zephyr and ESPIDF
  • Add support for SPI interface

Developer's Guide

Example

I have created several sketches of sending/receiving packets with NRF51 ANT radios. You can find these in the examples folder. Here's an example of configuring a channel with a NRF51 radio:

// Create an ANT object at the top of your sketch
ANT ant = ANT();

// Start the serial port
Serial.begin(9600);
// Tell ANT to use Hardware Serial. It's also possible to use SoftwareSerial
ant.setSerial(Serial);

AssignChannel ac;
ResetSystem rs;
SetNetworkKey snk;
ChannelId ci;
ChannelPeriod cp;
ChannelRfFrequency crf;
OpenChannel oc;

// Set Network Key, defaults to public, if you want the ANT+ key you need to get it from thisisant.com, DO NOT PUBLISH IT
snk = SetNetworkKey();
snk.setNetwork(0);
snk.setKey((uint8_t*)NETWORK_KEY);
ant.send(snk);

// Assign the channel and its type
ac = AssignChannel();
ac.setChannel(0);
ac.setChannelType(0);
ac.setChannelNetwork(0);
ant.send(ac);

// Assign the Channel IDs (these are all wildcarded values) (if you are using ANT+ see the profile for settings)
ci = ChannelId();
ci.setChannel(0);
ci.setDeviceNumber(0);
ci.setDeviceType(0);
ci.setTransmissionType(0);
ant.send(ci);

// Set the channel period (if you are using ANT+ see the profile for settings)
cp = ChannelPeriod();
cp.setChannel(0);
cp.setPeriod(1111);
ant.send(cp);

crf = ChannelRfFrequency();
crf.setChannel(0);
crf.setRfFrequency(0);
ant.send(crf);

// open the channel
oc = OpenChannel();
oc.setChannel(0);
ant.send(oc);

// Wait for the responses

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 <ANT.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

Internal Radio usage

If you are a more advanced tinkerer you can attempt to buy an ANT ready micro controller (such as the adafruit nrf52 express) you can load the board with the ANT softdevice and still use this library. Note: this does carry an element of risk. If you load a bad bootloader and brick your board and don't have a programmer handy then you will not be able to recover it till you get a programmer. Orrmany carries two repos that are example templates for the adafruit nrf52 express (bootloader and BSP.) You still need to added the headers and softdevice file yourself locally as Dynastream does not allow redistribution of the ANT softdevice.

External Radio usage

For development and general tinkering I highly recommend using an Arduino that has 2 serial ports, such as the Arduino Leonardo. The reason is the ANT Radio requires serial port access and it is useful to have another serial port available for debugging via the Arduino serial console. Also it is easier to use a 3.3V arduino than to use a level shifter

  • Teensy 3.2
  • Pro Mini 3.3V
  • Trinket 3.3V

ANT radios come in multiple models, but this driver is designed to only support the following:

  • nRF51
  • nRF52

You will need 3.3V regulator and logic shifting to convert from 5V (Arduino) to 3.3V (ANT). The Arduino is 3.3V tolerant.

Installation

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 "ant-arduino" in the filter and install.

Prior to Arduino 1.5 installation is a 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 353

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

To use this library your ANT radio must be loaded with the ANT Network Processor firmware. See Wiki for recommended wiring.

Questions/Feedback

Questions about this project should be posted to http://groups.google.com/group/ant-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

Owner
Curtis Malainey
🇨🇦, @ualberta CompE Alum, Hardware Enthusiast, ⛰️🌲🏕️ Explorer
Curtis Malainey
Comments
  • Quick start hardware recommendations

    Quick start hardware recommendations

    For someone who didn't deal with nRF radios before, it's overwhelming at the start to figure out what is the best development setup to start from.

    Could you please share some specific recommendations (a shopping list) in the README what boards and tools to have?

    There're have been several SoCs and development boards from Nordic, some of them are already deprecated, the thisisant forum is not active as well.

    • Is Arduino Due a good candidate for development/prototyping (3.3V, powerful CPU, 4 UARTs, a lot of PINs)
    • Raspberry Pi Pico 2040 (3.3V, dual-core CPU, 2 UARTs, also should support PlatformIO)?
    • What nRF radio is the best to interface with the microcontroller via UART?

    Thanks!

  • Declare header files for PlatformIO

    Declare header files for PlatformIO

    Hi,

    Please accept this PR that adds header files according to https://docs.platformio.org/en/latest/librarymanager/config.html#headers

    Developers will see them soon in the new version of PlatformIO Package Registry.

    Thanks in advance!

  • 'ArduinoNativeAnt' does not name a type

    'ArduinoNativeAnt' does not name a type

    I am trying to use the library on an nRF52840 (S340) using the internal radio, unfortunately I am stuck at the early beginning since I am not able to run even the exaple NativeAnt code. The compiler returns the following code:

    NativeAnt:32:1: error: 'ArduinoNativeAnt' does not name a type; did you mean 'ArduinoSerialAnt'? 32 | ArduinoNativeAnt ant; | ^~~~~~~~~~~~~~~~ | ArduinoSerialAnt /tmp/arduino_modified_sketch_347487/NativeAnt.ino: In function 'void setup()': NativeAnt:54:5: error: 'ant' was not declared in this scope; did you mean 'int'? 54 | ant.begin(TOTAL_CHANNELS, ENCRYPTED_CHANNELS); | ^~~ | int /tmp/arduino_modified_sketch_347487/NativeAnt.ino: In function 'void loop()': NativeAnt:92:5: error: 'ant' was not declared in this scope; did you mean 'int'? 92 | ant.readPacket(); | ^~~ | int exit status 1 'ArduinoNativeAnt' does not name a type; did you mean 'ArduinoSerialAnt'?

    Any suggestion on how to overcome this issue? Silvio

  • ESP32 support

    ESP32 support

    The NRF51 is a specialized BLE chip - but it is possible to use this library with the ESP32 or are any functions missing? Does anyone have success/experience with that combination?

  • Additional Framework support

    Additional Framework support

    The following frameworks appear to be the best targets for porting the library going forward

    Update as of march 2020, platformio supports zephyr

    • [X] Arduino
      • [X] UART - done
      • [x] ~SPI~ - no slave support
      • [x] Softdevice
    • [X] Mbed
      • [ ] SPI - blocked by SPI issues with my Teensy
      • [x] UART
      • [ ] SoftDevice (Native)
    • [ ] ESP-IDF - branched and looks feasible
      • [ ] SPI
      • [ ] UART
    • [ ] Simba
      • [ ] SPI
      • [ ] UART
    • [ ] Zephyr - Zephyr is now on platformio (I am testing with a Argon board)
      • [ ] SPI
      • [ ] UART - Blocked by https://github.com/zephyrproject-rtos/zephyr/issues/24496
      • [ ] SoftDevice (Native)

    Please leave comments here if there is another platform you think would be a good additional target. This work is planned for after the next release of antplus-arduino which releases the shifting and MOxy master profiles

  • Issue with library name

    Issue with library name

    Hi @cujomalainey

    we have detected that you changed the name of the library in library.properties from ANT-Arduino library to ANT-Arduino is that right? We are introducing a change in the library manager that forbids this kind of changes and ignore the releases with the name that differs from the name registered in the library index.

    Is it ok for you to keep the new name ANT-Arduino? The older releases with a different name will be ignored by the library manager. In absence of an answer from you we will proceed with this proposal next week.

    See also: https://github.com/arduino/Arduino/issues/7127

    JOB 595 - 2018/01/15 15:43:15 Scraping https://github.com/cujomalainey/ant-arduino.git
    JOB 595 - 2018/01/15 15:43:16 Checking out tag: 0.1.0
    JOB 595 - 2018/01/15 15:43:16 Release ANT-Arduino library:0.1.0 already loaded, skipping
    JOB 595 - 2018/01/15 15:43:16 Checking out tag: 0.1.1
    JOB 595 - 2018/01/15 15:43:16 Release ANT-Arduino library:0.1.1 already loaded, skipping
    JOB 595 - 2018/01/15 15:43:16 Checking out tag: 0.2.0
    JOB 595 - 2018/01/15 15:43:16 Release ANT-Arduino library:0.2.0 already loaded, skipping
    JOB 595 - 2018/01/15 15:43:16 Checking out tag: 0.3.0
    JOB 595 - 2018/01/15 15:43:16 Release ANT-Arduino:0.3.0 has wrong library name, should be ANT-Arduino library
    JOB 595 - 2018/01/15 15:43:16 Checking out tag: 1.0.0
    JOB 595 - 2018/01/15 15:43:16 Release ANT-Arduino:1.0.0 has wrong library name, should be ANT-Arduino library
    JOB 595 - 2018/01/15 15:43:16 Checking out tag: 1.0.1
    JOB 595 - 2018/01/15 15:43:16 Release ANT-Arduino:1.0.1 has wrong library name, should be ANT-Arduino library
    

    See also: https://github.com/arduino/Arduino/issues/7127

  • Transmit only and receive only definitions appear to be swapped from the ANT spec

    Transmit only and receive only definitions appear to be swapped from the ANT spec

    Transmit only and receive only definitions appear to be swapped from the ANT spec.

    #define CHANNEL_TYPE_UNIDIRECTIONAL_RECEIVE 0x50 #define CHANNEL_TYPE_UNIDIRECTIONAL_TRANSMIT 0x40

    From Table 5-1. ANT channel types 0x40 Slave Receive Only Channel (diagnostic)

    0x50 Master Transmit Only Channel (legacy)

JerryScript port to ArduinoCore-Mbed

JerryScript port to ArduinoCore-Mbed Overview Integrate ArduinoCore-mbed and modern JavaScript standards (ECMAScript 5/6/6+) powered by JerryScript. W

Jul 20, 2022
A library to control esp-8266 from Arduino by AT commands easier.
A library to control esp-8266 from Arduino by AT commands easier.

ArduinoESPAT A library to control esp-8266 from Arduino by AT commands easier. Wiring Diagram Arduino Uno ESPr 5V Vin GND GND D2 TX D3 RX Usage Defini

Dec 18, 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

Dec 13, 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

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

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

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

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

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

Oct 17, 2022
CAN Driver for Teensy 3.1 / 3.2, 3.5 and 3.6

CAN Library for Teensy 3.1 / 3.2, 3.5, 3.6 Compatibility with the ACANxxxx libraries This library is fully compatible with the MCP2515 CAN Controller

Dec 9, 2022
Driver for Texas Instrument's ADS1115 analog to digital converter IC.

Driver for Texas Instrument's ADS1115 analog to digital converter IC. It's somewhat compatible with the ADS1113 and ADS1114 variants. More details in the official datasheet

Sep 27, 2021
A simple two-axis gimbal built using two servo motors, an mpu6050 gyro and accelerometer sensor, and an Arduino (Uno)
A simple two-axis gimbal built using two servo motors, an mpu6050 gyro and accelerometer sensor, and an Arduino (Uno)

Makeshift Gimbal Project A simple two-axis gimbal built using two servo motors, an mpu6050 gyro and accelerometer sensor, and an Arduino (Uno). A shor

Jun 17, 2022
Arduino library for interfacing with any GPS, GLONASS, Galileo or GNSS module and interpreting its NMEA messages.
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

Jan 1, 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
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

Nov 22, 2022
Arduino library to access Adafruit IO from WiFi, cellular, and ethernet modules.
Arduino library to access Adafruit IO from WiFi, cellular, and ethernet modules.

Adafruit IO Arduino Library This library provides a simple device independent interface for interacting with Adafruit IO using Arduino. It allows you

Dec 23, 2022
Arduino library for SPI and I2C access to the PN532 RFID/Near Field Communication chip

Adafruit-PN532 This is a library for the Adafruit PN532 NFC/RFID breakout boards This library works with the Adafruit NFC breakout https://www.adafrui

Dec 23, 2022
An Arduino library with additions to vanilla Serial.print(). Chainable methods and verbosity levels. Suitable for debug messages.

advancedSerial This library provides some additions to vanilla Serial.print(): 1. Chainable print() and println() methods: // you can chain print() a

Dec 13, 2022
Arduino library for sending email and SMS from nothing but the ESP8266!
Arduino library for sending email and SMS from nothing but the ESP8266!

Did you know your ESP8266 could send Email and SMS without any special hardware or paid services like Twilio? With AlertMe, your ESP8266 project can:

Feb 24, 2022
The Approximate Library is a WiFi Arduino library for building proximate interactions between your Internet of Things and the ESP8266 or ESP32
The Approximate Library is a WiFi Arduino library for building proximate interactions between your Internet of Things and the ESP8266 or ESP32

The Approximate Library The Approximate library is a WiFi Arduino Library for building proximate interactions between your Internet of Things and the

Dec 7, 2022