This Did You Know? article covers the process of closing a simple analog position loop using a Q program and an Applied Motion stepper drive with differential inputs.
Some step motor applications require an operator to adjust a rotary valve or air vane and cannot use a homing sequence on power-up. The operator just needs to turn a control knob and have the load move to the correct location. The total motion in these applications may be a few degrees or perhaps several revolutions. A simple analog position loop using a Q program and a high quality potentiometer can provide an economical solution.
Analog inputs and the AS command
Many of our drives with Q programming have two separate analog inputs that can be configured to represent a single differential value using the AS command. Configuring the two analog inputs into a differential signal means the drive simply takes the difference between the two values (AIN1 minus AIN2). If AIN1 is 3 volts and AIN2 is 2.25 volts, then the difference is +0.75 volts. If AIN1 is 2.25 volts and AIN2 is 3 volts, then the difference is -0.75 volts. This ability to determine both the sign and the magnitude is required in closing a position loop. Figure 1 shows partial details of the AS command.
Wiring the potentiometers
Figure 2 shows the control wiring of the analog input using an ST stepper drive with Q programming (e.g. ST5-Q-NN). Notice that both potentiometer P1, used for setting the command value, and potentiometer P2, used for the feedback signal, are connected to the same +5V supply. This ensures that supply voltage variations will have negligible effects.
You’ll see that shielded cables are used. This is good practice whenever analog signals are used. Also notice the command AF500 in segment 1 of the Q program (Figure 3). This activates our analog filter software and sets the frequency cutoff to 10 Hz.
A word on resolution and accuracy
Analog systems are simpler to implement but offer lower resolution and accuracy than digital systems. As shown, the example system has a resolution of approximately 200 discrete positions. If a resolution of 800 discrete positions is needed the potentiometers should be supplied from a +/- 10 VDC source. For highest accuracy, select a feedback pot with a +/-0.25% independent linearity such as Bourns 6538S-1-102.
Additional notes before you begin
- The Q program referenced in this article can be downloaded here
- High quality potentiometers should be used in this type of system. Analog position loops can destroy low quality feedback potentiometers.
- Choose a potentiometer with a high rotational life of 500,000 revolutions or more. The Bourns 6538S series has a life of 20 million revolutions.
- If possible, select a potentiometer that permits continuous rotation so that if the motor moves beyond either mechanical limit of the potentiometer the potentiometer will not be destroyed.
- Set the idle current closer to the running current than normal, e.g. 50% or greater, if there will be a high torque load on the motor once it reaches its desired position. The Q program provided relies on the holding torque of the motor to maintain the position of the motor when not in motion, rather than the analog position loop.
- Set Register 1 (segment 1, line 8 of the Q program) to approximately 1.8 degrees mechanical if there is a high torque load on the motor once it reaches its desired position or if a lower quality potentiometer is used.
- The Register 1 value can be reduced to 0.6 degrees mechanical if there is a low torque load on the motor once it reaches its desired position and a high quality feedback potentiometer is used.
- Register 1 in the Q program sets the initial error value where motion will begin and Register 3 (segment 1, line 10) divides this to a smaller error when motion should stop. So motion will start when the absolute magnitude of Register [a] is less than 50% of Register 1. This approach requires a few more lines of code but ensures the two thresholds always stay scaled relative to each other if Register 1 is adjusted.
- This feedback loop runs best when identical potentiometers are used for the command and feedback signals.