Question:
How to design a feedback system to determine the position of a DC motor spindle?
2014-04-17 02:08:44 UTC
using a potentiometer as an input and an H-bridge to control the DC motor's polarity, how do create a feedback system to determine the exact position of the motor spindle?

The motor spindle is attached to a light load similar to a clock's hands.
when the pot is turned, the 'hand' should turn similar to the pot's angle.

I do know how to implement an H-Bridge, a PID system using opamps, and basic coding with the PIC16 Family.

I have built a circuit as to that the DC motor turns counter clockwise or clockwise depending on the pot's angle (or input voltage).

But I am lost as how to implement a feedback system to determine the position of the 'hand' (or the load attached to the motor spindle) to be able to stop it at a certain angle.
Three answers:
Ecko
2014-04-17 09:50:10 UTC
The pot in your question is actually a speed control. In a perfect world, setting it to move the motor would control the motor speed, and when it gets near the position required you reduce the setting to zero so the motor stops. By comparing two pots, one for the desired angle (setting) and one for the shaft angle (position), a feedback system can be made.



Mechanically, the motor shaft is geared to the output shaft using reduction gears that are appropriate for the speed and torque involved. A position sensing pot is driven by this shaft to measure its angle. There are specific pots available that can rotate continuously, but as you can expect the actual angle range and so voltage is more like 5 degrees to 355 degrees with a blank zone around the 0/360 degree position. This is a discontinuity as the voltage jumps from 360 to 0 degrees as the rotation continues. The shaft gearing that drives the pot can be different, so the 360 degree discontinuity does not cause a dead zone. Typically the dead zone is avoided by only allowing a limited range of angles that is within the range of the position feedback sensor.



A pot limited to 270 degrees rotation can be used with additional gears to use a smaller part of the element per revolution of the output shaft. A 270 degree pot geared down further than the output shaft can then rotate only 270 degrees while the output shaft rotates the full 360 degrees. This system does not roll over at the 360 degrees point, rather the pointer rotates backwards all the way to 1 degree etc. Using a multi-turn pot is the same idea except that back lash is less of an issue.



This link shows how to program such a thing using a pic. Most of the processing can be done in software. In this case the pic determines the set point (it can be a keyboard setting or come from a calculation of what angle you want). It also measures the voltage from the feedback pot which represents the angle (position) of the shaft that the pot is attached too. By subtraction the result is the error, which is just a number in the software, but it actually represents degrees of error from where the position should be. The PID algorithm modifies the error signal appropriately, and is converted to PWM in the microprocessor. The PWM drive signal goes to the H bridge where it is converted to the power required for the motor. The output is filtered to provide the DC control voltage of the motor. The filter may not be needed as a separate component, as the motor and its inductance integrates the current to relatively smooth changes, even though the drive voltage is a large rectangular range.

http://www.shawnlankton.com/2005/03/pic-pid-controller/



The analogue version is similar. Using op-amps, the first stage is a voltage comparator (error comparator). This is a differential amplifier that compares the set point voltage with the feedback voltage from the position sensor. Its output is the difference between these two voltages. It is the error voltage that goes to the PID part of the controller. The output of the PID part is a modified version of the error signal, used to drive the motor through the power amplifier. This is the control output. The power amplifier could be an analogue DC power amplifier that drives the motor i either direction. The power amplifier is often a PWM modulator and a H bridge. The PWM and H bridge is a digital version of that DC amplifier, used for efficiency.



The gain of the error comparator is set to provide a band of error (representing degrees of error at the shaft) that is under control, considering the op-amp output is limited in voltage range. The error comparator gain should represent more like 10-30 degrees between the amplifier limits, rather than half a degree. The proportional control part (P) is a voltage amplifier for the error signal that has the gain set to just below the point that causes oscillation (hunting). There is a residual error which can be reduced by more gain, but there is a practical limit to the gain that is possible. This is caused by the time response of the motor, load and control loop. The error signal is still driving the motor when it should be slowing down. As the motor passes the desired angle, the error drops to zero and then reverses, but the motor doesn't stop immediately, so there is overshoot. This is a form of damped oscillation. Adding more gain, continuous oscillation starts.



The I and D parts take into account the time response of the motor and control system. The derivative (D) anticipates the shaft position, so increases or reduces the control voltage in advance by using a differentiator. This is according to the rate of change of the error signal. The integral term considers the history of the error signal using an integrator, so the error can be eliminated or at least minimized over time. In a way it cancels the error if it continues too long. The 3 terms are "tuned" to suit the motor and its load. Sometimes it is necessary to add further control to the motor current (torque) to keep it in the range of the motor ratings. As the load changes the tuning might be a compromise.



If you look at an analogue clock it usually uses a stepper motor, because it can step continually around. It is acting as a mechanical counter of clock ticks if you think about it. A feedback system is not the same. It is typically going to advance from 0 degrees through to 360 degrees, and then reverse all the way back to zero degrees at the 12 position. This is sometimes described as a keyhole effect. It cannot move past 360 degrees, so it has to get from 360 to 0 degrees by reversing. By counting pulses per revolution to provide the the position feedback, the counter for feedback can be reset at 360 degrees of the output shaft, and this is equivalent to the stepper motor. This is more complex, but in software is just a couple of statements in the right places really. The sensor is a pulse type of optical encoder, like used for speed feedback. This is a slightly different shaft encoder. Maybe it generates 1024 pulses per revolution. This encoder is better placed on the motor shaft to get more and faster pulses (less delay in position caused by filtering them), instead of the output shaft, which works because the two are locked together by gears, though gear back lash might appear.



I don't know if yahoo email messaging still works, but you are welcome to try. I have a good range of simulations on motor control.
veeyesvee
2014-04-17 05:15:58 UTC
WHAT YOU HAVE IS A POSITION CONTROL SYSTEM. The position of the shaft is controlled by controlling the speed of the motor. In control system parlance we call it a type 1 system. Be that as it may, plan to rotate the motor at very low speeds such as perhaps 6 rpm that takes full 10 secs for one rotation. If necessary use a gear box to step down the speed. You can have a sensor attached to shaft. I generally prefer a 10 turn pot set to 5 turns so that you can have full 360 degree control. the voltage output of the pot is compared with a reference voltage that you set and the control system makes the motor run in clockwise or anti.. direction so that the error is zero. error is difference between the sensed voltage and set voltage. The 10 turn pot may be fed with 10V and at five turns the output will be about 5V. So when set point (that you provide from say another pot.. could be a ten turn pot also..) is 5V the motor does not have to rotate. When the set point is increased to 3.1V, the shaft will have to rotate by 36 degrees so that sensed voltage is equal to set voltage. The sensed voltage is 5.1V at 36 degrees, 3.2v at 72 deg, and 6V at 360 deg. the sense potentiometer is fixed to shaft so that when shaft rotates, the potentiometer rotates. Do not let the motor rotate by more than 1 turn, but no harm happens when it rotates through even four full turns as the sense pot used is a 10 turn pot. the down side is that the systems' step response is pretty bad. So rotate the set point pot, slowly. For better step response, the feedback should also include speed instead of just position. Or the "D" in PID will help.
John
2014-04-17 02:19:55 UTC
refer to my site

http://www.skillbank.co.uk/arduino/motor3.htm



You need a sensor to measure the motor position.

1: if the motor can only turn through a limited angle, (eg 270 degrees) you can connect a pot spindle to the motor shaft. For larger angles you may use a 10 turn pot. A voltage is applied across the ends of the pot, and the voltage at the slider measures position.

2: If the motor may be allowed to rotate through larger angle (ie more than 9*360 degrees) you need a different sensor; you can use an optical shaft encoder.



The sensor voltage is compared with the input voltage to control the motor. You can add PID if needed, once its working.



An arduino can measure and compare the voltages from your input pot and the sensor pot

http://www.skillbank.co.uk/arduino/measure1.htm


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...