Difference between revisions of "Design Philosophy for Rigatoni’s Automated Steering Subsystem"

From RoboJackets Wiki
Jump to navigation Jump to search
Line 98: Line 98:
=== Encoder Firmware ===
=== Encoder Firmware ===
The encoder firmware can be found on the RoboJackets RoboRacing GitHub [https://github.com/RoboJackets/roboracing-firmware/blob/evgp_steering/new_cari/encoder/encoder.ino here].
The encoder firmware is quite long, so it better viewed on the RoboJackets RoboRacing GitHub [https://github.com/RoboJackets/roboracing-firmware/blob/evgp_steering/new_cari/encoder/encoder.ino here].

Revision as of 23:51, 25 November 2019

This Wiki article is designed to give RoboRacing members insight into the design of the electrical steering subsystem for RoboRacing’s autonomous go kart Rigatoni. Rigatoni is a full-size Top Kart electric go cart that RoboRacing is modifying to become autonomous, and it will compete in the 2020 evGrandPrix competition. This article will provide readers with an overview of the main parts driving the automated steering system: the stepper motor that will physically turn the steering shaft, the encoder that will tell the central processor the current steering angle and the design of the PCB running the steering subsystem. It will also provide brief reasoning for why each part was picked.

Stepper Motor

Decision Process

Figure 1. An image of the Nema 23 closed-loop geared stepper motor and its gearbox.

In order to have an automated go kart, the go kart must be able to steer on its own, and to do that it must be able to move the steering column on its own. To achieve this, a secondary motor dedicated to driving the steering system must be installed. This motor must be able to rotate to precise angular positions and have enough torque to be able to turn the steering column, so a stepper motor was chosen instead of a servo. Although servos have built in potentiometers and are accurate, many do not have the torque required to maintain a steady position. A stepper motor does have the necessary torque but requires a driver to take the angular input and turn the motor to the correct position. Stepper motors are made up of a DC motor with multiple coils to drive it. These coils are powered in a specific sequence allowing the motor to turn in steps. They have much more torque than a regular DC motor at low speed and are good for precision at low RPM. Because they move in predictable steps, rotational speed control is easily achieved. Unfortunately, stepper motors do not have internal feedback for their position like servos do, so an external solution is required, such as an absolute rotary encoder.

Nema 23 Closed-loop Geared Stepper Motor

Shortly after deciding to use a stepper motor, the RoboRacing team leads spec’d and chose the Nema 23 Closed-loop Geared Stepper Motor. It features 1.25 N•m holding torque motor attached to a planetary gearbox with a 15.3 gear ratio with 30 N•m maximum permissible torque and 50 N•m of moment permissible torque. To run it, RoboRacing chose the Stepperonline CL57T Closed-loop Stepper Drive. Communication with the stepper motor is done via a 15 pin ethernet connector, and the drive communicates using jumper wires plugged into screw sockets. This stepper motor and drive in tandem with an appropriate absolute encoder will be able to accurately choose and hold a steering angle during a race.


RoboRacing has decided to keep the seat and steering wheel for the go kart so that it can still be driven manually. Although convenient, this decision requires a work around. The Nema 23 has very low gear ratios and thus a lot of torque, so a driver (person, not the stepper driver) cannot turn the steering wheel if the stepper motor is always mounted to the steering system. A clutch system is being planned to put in place to detach the stepper motor from the steering system when the kart is being driven manually.


Decision Process

The other important part of an automated steering system is knowing the angular position of the steering column. The decision to keep the seat and steering wheel so that it can still be driven manually required the design to include an absolute rotary encoder rather than incremental encoder or limit switches. An absolute rotary encoder differs from an incremental encoder in that it can keep track of absolute angular position, even when powered off, whereas incremental encoders only report a change in position. Limit switches positioned at the limits of the steering angle were considered, however the steering would have to go through a zeroing sequence upon start-up, and the current angle would be held as a variable in software which does not account for physical shifts in the steering position that could be induced in a crash or other disturbance during a race.

Figure 2. An image of the CUI Devices AMT222B-V absolute rotary encoder with its various bore sockets.

An absolute rotary encoder allows for precise feedback to the software of the steering column’s real-time angle, rather than just assuming the angle within the software. It also allows the autonomous system to know precisely the angle of the steering column upon applying power. This way it does not matter the angle the steering column was left in when switching from manual to autonomous control.

The two most common types of encoders operate optically or magnetically. Optical encoders require photo-sensors and a led to read in differences in light to understand where the absolute angular position of the shaft that they are attached to. Although they are precise, they are susceptible to interference from inconsistent light and dirt, so they are not ideal for use on a racing go kart. Magnetic encoders use Hall effect sensors with magnets to read in angular position, and although they are rugged, they are not as precise as optical encoders and are susceptible to interference from other magnetic fields, which can be an issue if they are positioned near a stepper motor, which would be an issue as a stepper motor is being used in Rigatoni.

The steering sub team at RoboRacing opted to use a capacitive encoder, which reads modulations in a high frequency reference signal. This signal is modulated by a disk embedded with a sinusoid that rotates between a transmitter and a receiver, and the modulations are then translated into angular increments. This encoder is both rugged and precise, making it ideal for use on an autonomous go kart.

CUI Devices AMT222B-V Absolute Encoder

The encoder that was decided on is a CUI Devices AMT222B-V, which is a through-shaft radial single-turn capacitive rotary encoder. It offers 14-bit precision through a Serial Peripheral Interface (SPI) and its reference frequency updates every 100 μs or operates at 10,000 Hz. Since the steering column never goes through 360 degrees of rotation, only a single turn rotary encoder is necessary, and with 14-bit precision it can detect 16,384 positions.


Unfortunately, the through-shaft bore can only range from 2 to 8 mm, which is small for our application, so a parallel shaft will have to be mounted to rotate with the steering column at the correct gear ratio. Through-shaft encoders are available with bores that are much larger, however the prices of these encoders are much too high for RoboRacing’s budget; the AMT222B-V was chosen because it fits in our budget.


Figure 3. The final PCB designed by the RoboJackets RoboRacing team that will drive the automated steering subsystem.

Since this is a custom build, many of the parts need custom circuitry in order to communicate with each other. All of the designing of the circuitry was completed in Autodesk Eagle and included custom part schematics designed by members of the electrical steering sub team. The schematic shows the different electrical components used and connections made on the steering PCB, including the various switches, connectors and the microprocessor.


Driving the steering subsystem is an Arduino Leonardo ATmega32u4. This specific processor has the necessary data and interrupt pins as well as built-in USB communication for easier firmware programming. This processor was used in all testing for the parts and so it was easiest to just use it in the final design.

POE and Communication

Power and communication with Rigatoni’s central processor are done via ethernet. A WIZnet W5500 ethernet shield was outfitted to the steering board to achieve this. This specific chip provides the power-over-ethernet and can also handle SPI communication, which is necessary to communicate with the AMT222B-V encoder.

For current members: the board and schematic can be better viewed by cloning the Steering branch of the RoboJackets RoboRacing GitHub repository and viewing it in Eagle.


The firmware driving the stepper motor was developed through testing the stepper motor. It is currently very simple, and only turns the motor one step at a time with an interrupt by pushing a button. The firmware for the encoder on the other hand was provided free on CUI’s website. It requires modification as right now it is very general (designed to run multiple ATM22 series encoders), but gave RoboRacing a great starting point for developing our own firmware.

Stepper Motor Firmware

// Notes:
// Need to connect VDC GND and dir- to common GND
// Need to have feedback connected to function
// 15.3 (gear ratio) * 1600 = pulses per revolution

byte dirPin = 3;
byte pulsePin = 6;
byte interruptPin = 2;

void setup() {
  pinMode(dirPin, OUTPUT);
  pinMode(pulsePin, OUTPUT);
  pinMode(interruptPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(interruptPin), interrupt, FALLING);
  digitalWrite(dirPin, LOW); // HIGH: clockwise, LOW: counter clockwise
   for(int i=0; i<24480; i++)
    digitalWrite(pulsePin, HIGH);
    digitalWrite(pulsePin, LOW);
void loop() {


void interrupt(){
  digitalWrite(pulsePin, HIGH);
  digitalWrite(pulsePin, LOW);

Encoder Firmware

The encoder firmware is quite long, so it better viewed on the RoboJackets RoboRacing GitHub here.