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

Overview

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

Comments
  • 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!

    opened by ivankravets 3
  • '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

    opened by silviocross 1
  • 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?

    opened by usrstephan 1
  • 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

    opened by cmaglie 1
  • 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)

    opened by sharoldsen 1
  • 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

    enhancement 
    opened by cujomalainey 0
Releases(2.0.3)
Owner
Curtis Malainey
🇨🇦, @ualberta CompE Alum, Hardware Enthusiast, ⛰️🌲🏕️ Explorer
Curtis Malainey
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

Damiano Mazzella 4 Jul 20, 2022
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

Nyampass Corporation 9 Sep 1, 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 42 Oct 21, 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 10 Oct 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 29 Nov 22, 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 62 Nov 4, 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
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

Pierre Molinaro 9 Apr 15, 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

Tamás Ruszka 0 Sep 27, 2021
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

Sukritee Sharma 2 Jun 17, 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 13 Aug 27, 2022
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
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

Adafruit Industries 166 Nov 9, 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

Adafruit Industries 356 Nov 7, 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

Vasily Klenov 16 Oct 7, 2022
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:

Lixie Labs 61 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 The Approximate library is a WiFi Arduino Library for building proximate interactions between your Internet of Things and the

David Chatting 102 Nov 16, 2022