DigiKey-eMag-Sensors-Vol 19

Arduino sample code for SPI absolute encoders code for SPI absolute encoders By Damon Tarry, Design Applications Engineer, Same Sky

This Arduino sample code tutorial aims to give users a solid starting point for configuring and reading data from Same Sky’s AMT22 absolute encoders with Serial Peripheral Interface (SPI) communication. The tutorial will provide what hardware and software is needed, key setup requirements, and sample code packages and instructions for both single-turn and multi-turn output options. Here is a list of what is required to get started:

■ Download AMT22 Multi-Turn Sample Code

measures position within a single 360-degree rotation, while the multi-turn version tracks not only the position within a rotation but also the total number of complete rotations. Additionally, the single-turn variants feature a programmable zero point, enabling users to define a custom reference for the encoder’s origin. Getting started Ensure that the device is in RUN mode by adjusting the switch located on the back of the encoder to the appropriate position (Figure 1). Now mount the AMT22 encoder to a motor or assembly using the AMT mounting instructions to ensure proper installation. The AMT22 supports 9 different shaft sizes ranging from 2 mm to 8 mm.

AMT22 absolute encoder overview Same Sky’s (formerly CUI Devices) AMT22 is an absolute encoder offered in either 12-bit or 14-bit resolution, meaning it provides a precise number of unique positions per revolution. For the 12-bit variant, this translates to 4,096 distinct positions, while the 14-bit model features 16,384 positions per revolution. Regardless of how many times the device is rotated, it continuously reports its absolute position, giving users accurate feedback on the device’s exact angle. This encoder is available in both single-turn and multi-turn models. The single-turn variant

■ Arduino board

■ AMT22 encoder

■ AMT-06C-1-036 cable, or similar cable with proper connector

■ Arduino IDE

■ Download AMT22 Single-Turn Sample Code

46

Powered by