/AMT203

Library for the Arduino Uno to interface with CUI Inc.'s AMT203

Primary LanguageC++

Project: CUI AMT203 Arduino Library

A custom library to add simple functional calls for an AMT203 absolute rotary encoder manufactured by CUI Inc.

This library was built for use on the Arduino Uno (ATmega328P) development board which will act as a prototyping controller for the internal testing of various data acquisition projects.

Step 1: Installation

  1. Place the contained files within your working directory (where the .ino file is)

  2. Add an inclusion header to your .ino file

    #include "AMT203.h"
  3. Initialize an AMT203 object with SPI communications arguments

    AMT203 encoder(rotaryEncoderSCK, rotaryEncoderMOSI, rotaryEncoderMISO, rotaryEncoderCS, baudRate);

Step 2: Using the library

Call the newly defined object with the following functions as needed: (Copied from the header file, "AMT203.h")

void open();
    >> Opens an SPI communications stream between the encoder and the Arduino
bool setZero();
    >> Sets the current position of the encoder to "0" and future measurements will be an offset of this value
uint8_t command(uint8_t amtCommand);
    >> Sends a command of type 8-bit unsigned integer if you want to send a specific command directly to the encoder (unnecessary for normal operations)
uint16_t getPosition();
    >> Returns the current position as the exact unsigned integer reported by the encoder

Folder structure

  unoSensorIntegrate/       => Project sketch folder
    unoSensorIntegrate.ino  => main Arduino file (example)
    AMT203.cpp              => contains the functions for the AMT203 class
    AMT203.h                => header file with function skeletons and necessary variables
    ReadMe.adoc             => this file

License

This project is released under an MIT License.

Contributing

To contribute to this project please contact hodgsonresearch https://id.arduino.cc/hodgsonresearch

BOM

The following have been used in this early phase of develoment to produce a partially-functional prototype of the final device. Only the rotational position is reported with this design.

ID

Part name

Part number

Quantity

E1

Encoder

AMT203S-V

1

A1

Arduino Uno

A000066

1

Help

This document is written in the AsciiDoc format, a markup language to describe documents. If you need help you can search the AsciiDoc homepage or consult the AsciiDoc cheatsheet