4.12. Setting up encoder speed control

This section explains how to set up the Tic to read a quadrature encoder signal and use that signal to control the speed of the stepper motor.

The Tic does not support closed-loop control with encoder feedback. The Tic’s encoder input is meant to be connected to a rotary encoder that is turned by hand. If you have a stepper motor with an integrated encoder, you should not try to connect the motor’s encoder to the Tic.

If you have not done so already, you should follow the instructions in Section 4.3 to configure and test your stepper motor.

When in encoder mode, the Tic uses its RX and TX lines as encoder inputs. Each of these lines has an integrated 100 kΩ resistor pulling it up to 5 V and a 220 Ω or 470 Ω series resistor protecting it from short circuits (e.g. in case it is inadvertently put into serial mode, which uses TX as an output, with an encoder still connected). The Tic expects to see standard quadrature encoder signals like this on its encoder inputs:

The time between the channel transitions (labeled T1-4 in the diagram above) must be at least 100 µs.

For this control interface, we generally recommend common three-pin mechanical rotary encoders with quadrature outputs, though other kinds of quadrature encoders can also be used. A three-pin rotary encoder has two signal pins, A and B, which should be connected to RX and TX on the Tic, and a common pin (sometimes labeled “C”) that should be connected to ground. Note that the common pin is often in the middle, but you should always refer to your encoder documentation to identify which pin is which. These encoders do not require power as the signal pins just alternate between floating and ground as the dial is rotated. The built-in pull-ups on the RX and TX pins make the signal high during the times when the encoder outputs are floating, so there is no need for external pull-ups. Other kinds of quadrature encoders might require power, and the 5V output on the Tic can be used to power them if their documentation indicates they can operate at 5 V.

As a first step, you should turn off the power to your system and then connect your encoder to the Tic as described above and shown in the diagram below. You can swap your A and B connections to flip the direction of the encoder.

Now connect the Tic to your computer via USB. In the Tic Control Center software, set the Tic’s control mode to “Encoder speed”. In the “Scaling” box, you should change the target maximum to be equal to the maximum velocity that you want your motor to move in the forward/positive direction. Since you already set the “Max speed” parameter in the “Motor” box (see Section 4.3), you could just copy that value into the target maximum box. If you want your motor to go the same speed in both directions, you should set the target minimum to the negative of the target maximum. Otherwise, you should set the target minimum to be the lowest (most negative) velocity that you want your motor to have when moving in the other direction. If you have previously changed the encoder prescaler setting, you should change it back to its default value of 1. You should set the encoder postscaler to approximately one hundredth of the “Max speed”. Click “Apply settings” to save these settings to the Tic.

Now connect motor power to start your system running. As you turn your encoder, you should see the speed of your stepper motor changing proportionally: moving the encoder by one count should change the target velocity by the value you entered for the encoder postscaler.

If your motor speed is not changing as you turn the encoder, you should look at the message at the bottom of the Tic Control Center and also check for errors in Status tab. If there are any errors, you should address them before continuing. If the system is still not working, you should look at the “Encoder position” displayed in the Status tab, which is the raw count from your encoder. This number is pinned to zero when motor power is off, so make sure you have connected your motor power to the Tic. If you turn your encoder one way, this number should go up. If you turn it the other way, this number should go down. If the “Encoder position” is not changing, or only changing by one count, it is possible that your encoder is not wired correctly. Check all of your connections and soldering joints (if applicable). If you have access to an oscilloscope, you should check the signals on RX and TX. If the “Encoder position” is responding properly to the encoder but the “Input after scaling” variable is not, then make sure you set the Tic’s input settings as described above. The Tic expresses velocities in units of pulses per 10,000 seconds, so if the “Input after scaling” is a non-zero number that is much smaller than 10,000, your motor might be moving, but it would be moving too slowly to be easily noticed. Make sure you have set the encoder postscaler as described above.

The Tic expects that transitions on its encoder inputs will be at least 100 µs apart. If your encoder signal is faster than this, the Tic might miss some encoder counts or could even measure counts in the wrong direction. To see whether this is happening, you should try turning your encoder as fast as you expect it to be turned in your application. As you do this, look at the “Encoder skip” count shown in the “Errors” box in the “Status” tab. If the count goes up when you turn the encoder, that means the Tic is missing some encoder counts. In that case, if encoder accuracy is important in your application, you might consider getting a different encoder or turning your encoder more slowly.

You should make sure that the motor is moving in the correct direction. If it is not, you can swap the RX and TX connections or check the “Invert motor direction” checkbox to fix it. (You could also rewire the stepper motor to reverse the current in one coil, but be sure to turn off the stepper motor power before doing that.)

Finally, you should set the encoder prescaler and postscaler to specify how much the stepper motor speed should change as you turn the encoder. Every time the encoder position changes by the prescaler amount, the “Input after scaling” variable will be changed by the postscaler amount. So if you increase the prescaler from its default value of 1, it will take more encoder movement to get the same change in speed from the stepper motor. If your encoder has detents, it usually makes sense to set the encoder prescaler to the number of counts you get per detent, which is typically 4. If you decrease the postscaler, you will have finer control of the motor speed and it will take more turns of the encoder to reach full speed. If you increase the postscaler, you will have coarser control over the motor speed, and it will take fewer turns to reach full speed.

For details about how the Tic’s encoder input works, see Section 5.3.

Related Products

Tic T825 USB Multi-Interface Stepper Motor Controller (Connectors Soldered)
Tic T825 USB Multi-Interface Stepper Motor Controller
Tic T834 USB Multi-Interface Stepper Motor Controller (Connectors Soldered)
Tic T834 USB Multi-Interface Stepper Motor Controller
Tic T500 USB Multi-Interface Stepper Motor Controller (Connectors Soldered)
Tic T500 USB Multi-Interface Stepper Motor Controller
Tic T249 USB Multi-Interface Stepper Motor Controller (Connectors Soldered)
Tic T249 USB Multi-Interface Stepper Motor Controller
Tic 36v4 USB Multi-Interface High-Power Stepper Motor Controller (Connectors Soldered)
Tic 36v4 USB Multi-Interface High-Power Stepper Motor Controller

Related Categories

Tic Stepper Motor Controllers
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Menu
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors