Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Getting Started with Development of ANT+ Enabled Applications

Avatar
RankRankRankRank

Total Posts: 140

Joined 2008-12-09

PM

Getting Started with Development of ANT+ Enabled PC Applications

Getting started on a new technology can sometimes be a daunting task. The Developer Zone and ANT+ Adopter Zone contain a vast amount of resources to enable developers to create applications and embedded devices compatible with existing ANT+ products in the market. If this is your first time experimenting with ANT, it might be difficult to know where to start.

The purpose of this post is to describe the available resources for development of PC applications that can connect to an ANT chip or module, receive ANT messages from a specific ANT+ device, and decode this data according to its ANT+ device profile.

Requirements

* 2 ANT enabled USB sticks or ANT development kit
* To compile the sample code: Microsoft Visual C++ or C# 2008 or later (Express or Professional versions)

USB Driver Installation

Drivers for the ANT USB1 and USB2 sticks can be found on the Developer Zone on the website.
http://www.thisisant.com/pages/developer-zone/software-tools

Make sure to install drivers for the correct type of USB stick you are using. The specific type of the USB (USB1/USB2) stick is printed on the dongle itself. If using the USB Interface Board (UIF) and an ANT module, you will need the drivers for USB1. Full instructions for installing the drivers for the USB stick are available in the "ANT Development Kit User Manual" here:
http://www.thisisant.com/pages/developer-zone/development-kit-manual

Once the ANT USB stick has been successfully installed, it should be listed on the Device Manager as a Universal Serial Bus controller. The name of the device will vary depending on whether the device is a commercial ANT USB1 or USB2 stick, or an interface board connected to an ANT module from an ANT development kit.
ANT USB1 / UIF: USB ANT USBXpress Device
ANT USB2: ANT USB Stick 2

Important!
If drivers for an ANT USB stick bundled with an ANT+ enabled consumer product have already been installed, it is not necessary to install additional drivers. Only one application can access the ANT USB stick at a time. As such, all 3rd party applications (e.g Garmin ANT Agent) must be closed to allow the ANT+ development tools and your own applications access to the USB device.


Getting Started with the ANT+ Simulator

One of the key tools in ANT+ application development is the ANT+ Simulator. This software tool allows developers to create applications compatible with ANT+ sensors without the need of a physical sensor to generate ANT+ data during development. Before starting to work on custom applications, we highly recommend becoming familiar with the functionality of the ANT+ Simulator.

The ANT+ Simulator consists of two applications: the ANT+ Sensor Simulator and the ANT+ Display Simulator. The ANT+ Sensor Simulator is used to simulate a variety of ANT+ sensors, generating and broadcasting data according to their respective ANT+ device profiles. the ANT+ Display Simulator receives and decodes messages transmitted from a variety of broadcast ANT+ sensors.
The ANT+ Simulator, along with its full source code, is available in the ANT+ Adopter Zone of the website
http://www.thisisant.com/pages/ant/ant-simulator-tools

To get started, setup the ANT+ Sensor Simulator to send data, and receive it with the ANT+ Display Simulator. First, connect two USB sticks to the computer and open the ANT+ Sensor Simulator application. Select the appropriate USB Device Number and baud rate, depending on the type of USB stick, and connect to the ANT enabled USB stick. Then, configure the simulator sensor type as a Heart Rate Monitor. After enabling the “Transmitting” checkbox, the simulator will start broadcasting ANT+ HRM messages. Each transmitted packet may be observed in the left hand side text box.

[img size=600]http://www.thisisant.com/images/fbfiles/images/sensorsim.png[/img]

Similarly, open the ANT+ Display simulator. Connect to the second ANT enabled USB stick and configure the simulator as a Heart Rate Monitor display. After enabling the “Receiving” checkbox, the display simulator will search for the transmissions of a heart rate sensor. Once the transmissions from the sensor simulator are found, the raw broadcast messages are displayed in the left hand side text box. Decoded heart rate data will be displayed in the “Calculated Data” group, and decoded data from ANT+ common pages will be displayed in the “Global Data” group.

[img size=600]http://www.thisisant.com/images/fbfiles/images/displaysim.png[/img]

The ANT+ Simulator creates a log of the serial messages exchanged between ANT and the PC. The log is stored in the working directory of the application, and is named "DeviceX.txt", where X is a number. This log is very useful for troubleshooting purposes, and can also serve as a reference when creating your own applications. Familiarity with the ANT protocol is required to understand the format of these messages.

Getting Started with the ANT Protocol

Any developer working with ANT should be familiar with the concept of an ANT channel, the basic building block of all ANT networks. As such, it is highly recommended to review and understand the "ANT Message Protocol and Usage" document, available in the Developer Zone here
http://www.thisisant.com/pages/developer-zone/ant-protocol-and-usage

Sections 1 - 5 of this document provide an overview of the main features and functionality of the protocol, and are an essential resource for understanding ANT. The rest of the document describes in detail the messaging interface for configuring channels and exchanging messages with ANT. While it is not necessary to dive into the later sections of the document initially, you will need to refer to those sections frequently during your development.

Additionally, the ANT Basics presentation (~ 1 hr) provides an introduction to the technical details of ANT
http://www.youtube.com/view_play_list?p=A4AA10B39DB19291

To gain hands-on experience with ANT, we recommend next to get familiar with ANTwareII. ANTWareII is a GUI application used for the control of ANT devices, and it is an excellent resource to explore the capabilities of ANT. AntwareII can be used to setup ANT channels and experiment with ANT’s multiple configuration commands. This application, along with its user guide, can be downloaded from the Developer Zone of the website.
http://www.thisisant.com/pages/developer-zone/software-tools

[img size=600]http://www.thisisant.com/images/fbfiles/images/antware.png[/img]

Developing ANT Enabled Applications

The ANT Windows Library Package contains a set of libraries to facilitate development of ANT enabled applications, along with demonstration applications illustrating the usage of the ANT libraries. The libraries contain functionality to connect to ANT enabled USB sticks, handle the low level serial communication, ANT message framing, and optional logging of raw messages during communication sessions for debug purposes. The library package (including full source code) is available in the ANT+ Adopter Zone
http://www.thisisant.com/pages/ant/ant-software-tools

The ANT_Libraries.sln can be opened and compiled directly with Visual C++ 2008. This solution includes all settings to build the libraries and accompanying demos. Please have a look at the readme.txt file included within the Library Package, as it outlines its contents, the different projects available, and the dependencies between projects.

To get started:
1. Download the ANT Windows Library Package with source code from the DevZone.
2. Unzip the file.
3. Open the ANT_Libraries.sln solution.
4. Open the ANT_LIB project, and find the antfs_host.cpp file
5. Enter the ANT-FS network key, or set it to all 0’s if you are not using ANT-FS.
6. Right click on the Solution ANT_Libraries and select “Build Solution”.
7. Run DEMO_LIB or DEMO_DLL. These are simple console applications that show how to configure and open an ANT channel.

The source code of the demo applications is a great starting point to get familiar with the ANT library; all commands needed to configure and open an ANT channel are explained through documentation within the code.

The ANT_NET_Libraries.sln contains the ANT Managed library, for use with .NET applications. The ANT_LIB solution must be built before attempting to use the managed library, to resolve dependencies. Alternatively, the DLL’s from the BIN directory may be copied into the working directory of the built project. Copying the ANT_NET.xml file as well, and including it in a project using the ANT_NET.dll will enable IntelliSense documentation for the ANT Managed Library. The DEMO_NET project is the best example to get familiar with the usage of the managed library. To get started with this code:
1. Download the ANT Windows Library Package with source code from the DevZone.
2. Unzip the file.
3. Open the ANT_Libraries.sln solution (Visual C++)
4. Open the ANT_LIB project, and find the antfs_host.cpp file
5. Enter the ANT-FS network key, or set it to all 0’s if you are not using ANT-FS.
6. Right click on the Solution ANT_Libraries and select “Build Solution”.
7. Open the ANT_NET_Libraries.sln (Visual C#)
8. Build the entire solution.
7. Run DEMO_NET. This is a simple console application that shows how to configure and open an ANT channel.


Documentation for the PC Tools
Asides from the code related to loading the libraries and connecting to the USB stick, almost all the function calls in the libraries correspond to a message described in Section 9.5 of the "ANT Message Protocol and Usage Document". Please refer back to this document for a detailed description for each of the commands.



Decoding ANT+ Data

ANT+ Device Profiles define the channel parameters and format of the data payload of specific devices. In other words, for a display device, a device profile specifies how to configure an ANT channel to receive data from a particular sensor, and how to decode the data received from that sensor. For a sensor device, a device profile specifies how to configure an ANT channel to send data, and how to format the sensor data to be transmitted.

Device profiles are available in the ANT+ Adopter Zone of the website.
http://www.thisisant.com/pages/ant/ant-device-profiles

Each device profile contains a document with a detailed specification of the channel parameters and data format for each sensor type.

For sample code implementing the profiles, refer to the source code of the simulator, available in the ANT+ Adopter Zone
http://www.thisisant.com/pages/ant/ant-simulator-tools

To build the code, you can use Microsoft Visual C++ 2008 or later. The “devices” directory within the project contains the code specific to each sensor and display device, and can serve as a reference for PC applications implementing ANT+ functionality.

Embedded C reference code for the MSP430 for some of the profiles is also available in the ANT+ Adopter Zone.
http://www.thisisant.com/pages/ant/ant-embedded-reference-designs

Note for Mac Developers
ANTwareII and the ANT+ Simulator use the .NET framework, and therefore, are not available for Mac OS.
However, there is a version of the ANT Library Package for Mac OS on the Developer Zone on the website that can be used to develop ANT and ANT+ enabled applications for Mac OS. A sample Xcode project is provided; please refer to the DEMO_LIB and DEMO_DYLIB targets to get started. Drivers for the ANT USB1 and USB2 sticks (with black plastic casing) are available as well.


Note for Mobile App Developers
Most of the content in this post also applies to the development of ANT+ enabled mobile apps, as a working understanding of the ANT protocol and usage of the PC development tools is a good starting point for developing with ANT. For resources specific to the Android API, please refer to
http://www.thisisant.com/pages/developer-zone/android-api


Additional Resources
Registration as an ANT+ Adopter also provides access to the ANT+ section of the forum, with additional resources regarding specific device profiles and ANT-FS.
     

Signature

For a complete list of frequently asked questions and answers, please view the FAQ user profile by clicking on the FAQ user name.