CUI AMT21 series RS485 encoder support for moteus
As of release 2023-09-26, moteus controllers can now use CUI AMT21 series encoders for any encoder source. CUI’s AMT21 series encoders are rugged, with resolution up to 14 bits, and since they use RS485 for communication can be located a significant distance from the motor driver if necessary. Setting one up is easy with the moteus-n1, which is what I’ll cover here.
Hardware
The moteus N1 has JST GH-6 connector labeled “RS422” with all the pins necessary to power and communicate with an AMT21. Since the AMT21 is RS485, not RS422, it is required to tie the A and Y pins together and the B and Z pins together. An easy option is to do so in the harness, either by crimping multiple wires into the Molex terminal for the AMT21, or by splicing wires. The desired schematic looks like:
Software
With the moteus-n1, the software configuration is straightforward, and basically the same as for the AksIM-2.
aux1.uart.mode 4 # cui_amt21
aux1.uart.rs422 1 # True
aux1.pins.3.mode 3 # uart
aux1.pins.4.mode 3 # uart
Once the aux1 UART is configured, then it can be selected as the source for any of the motor_position
sources and selected for either commutation sensing, output/load sensing, or as an auxiliary sensor. For instance, to use it as the primary encoder instead of the onboard one, you would do:
motor_position.sources.0.aux_number 1
motor_position.sources.0.type 2 # uart
motor_position.sources.0.cpr 16384 # AMT21 devices report as 14 bit
motor_position.commutation_source 0
motor_position.output.source 0
moteus-r4
As with the AksIM-2, a moteus-r4 can be used to drive the CUI AMT21 series, but additional interface hardware is required. An example schematic can be found in the “RLS AksIM-2” section of the initial “worked examples” post.