# PPM/PWM controlled, closed-loop stepper motor? [closed]

(It is easy to misunderstand what I'm describing if you read it too fast)

I've google this for a few days now. I'm looking to make or buy something that bolts onto the back of a stepper motor that makes the stepper motor function exactly like an RC servo. That means it receives PPM/PWM input, HAS A POTENTIOMETER to measure shaft position, and automatically moves the stepper CW or CCW until it is in the correct position according to pulse width. Think of it like RC servo electronics with a big stepper motor in place of the little DC motor that normally is found in the servo casing.

If for some crazy reason this doesn't already exist, one way that it could be made is by buying a cheap servo, desoldering the small DC motor from the control board, making some kind of interface that translates the -5v to 5v DC voltage to stepper pulses, and outputting that to a stepper motor.

A stepper with an optical encoder is not what I'm looking for. A stepper that receives a direction and speed as input, regardless of what is attached to it, is not what I'm looking for. I'm basically looking for something with the physical characteristics of a stepper (The ability to direct-mount other hardware to the output shaft, metal frame), the high torque of a stepper, but with the control characteristics of a RC servo. It needs to be able to be overloaded, externally knocked out of position, interrupted while moving yet still know where it is. Guessing where it is is not acceptable like it is with open-loop control.

Doesn't this already exist? If not, what would be the simplest design, with the fewest separately-bought pieces, for something like this?

## closed as off-topic by brhans, Daniel Grillo, Voltage Spike, Peter Smith, dimOct 20 '16 at 12:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

• It sounds to me like you just need a more powerful servo. Did I misunderstand? – Roger Rowland Oct 2 '16 at 17:15
• This is do-able with most MCUs, but perhaps not the best way to solve your actual problem. Steppers generally get used in places where the desire to avoid closed loop control complexity makes their mass and power inefficiency an acceptable tradeoff. Once you build closed loop control, you have to consider if those costs are still worthwhile, compared to using a suitable DC motor type servomechanism. – Chris Stratton Oct 2 '16 at 17:20

The whole reason for a stepper motor is to get accurate positioning without a closed loop feedback system. It could be done, but will have a larger deadband and be much slower than a normal servo. However there might be applications where it could be useful to operate a stepper motor this way.

one way that it could be made is by buying a cheap servo, desoldering the small DC motor from the control board, making some kind of interface that translates the -5v to 5v DC voltage to stepper pulses, and outputting that to a stepper motor.

This won't work properly because the servo control board is tuned to the characteristics of the motor and gear train.

The simplest design with fewest parts would probably be a small MCU and stepper motor driver IC. The MCU would receive the PWM signal and measure its width with a timer, operate the stepper motor phases via the driver, and read the pot with an A/D converter. Modules and source code to do all these things are readily available (would just take a bit of programming to get it all working together).

• Since motor voltage only controls no load speed depending on friction
• and motor current directly controls motor torque,

• thus neither V nor I controls motor position.
• The only way to control this in a non-stepper motor is with position feedback or a "closed loop servo".

• ** since position of a continuous pot has a dead-band at the ends, for continuous rotation , you need a quadrature dual pot ** or quadrature incremental shaft encoder
• since quadrature sin/cos pots became almost obsolete by virtue of cheaper methods using high res. quadrature shaft encoders, your options are limited on a small size and budget

The cheapest linear continuous pot I found at DigiKey was $16 !! and that wasn't even sin/cos. http://www.digikey.com/product-search/en/potentiometers-variable-resistors/rotary-potentiometers-rheostats/263488?k=pot&k=&pkeyword=pot&FV=125c0011%2Cfff40004%2Cfff80540&mnonly=0&newproducts=0&ColumnSort=1000011&page=1&stock=1&quantity=0&ptm=0&fid=0&pageSize=500 This is why hobby servo's with rotary position limited to <1 rotation are best bet. for you... • I don't need continuous rotation. 180 degrees if fine. I'm basically looking for a cheaper way to have a high-torque servo. Open-loop control is useless. It needs to be able to be overloaded, externally knocked out of position, interrupted while moving yet still know where it is. Guessing where it is is not acceptable like it is with open-loop control. – user2514676 Oct 2 '16 at 22:23 • This is trivial. connect the shaft of any Pot apply a regulated voltage and compare with desired voltage and regulate the Voltage using bipolar supply with complementary darlington emitter followers in a feedback loop. Optimize inertia and overshoot with a PID loop. Provide as much current as you need torque. Simple. – Sunnyskyguy EE75 Oct 3 '16 at 0:38 • For optimal control, use a Power MOSFET bridge, series inductor and shunt cap . The servo ramp speed can be optimized like a HDD actuator and a battery charger. CC mode then CC brake mode then position error signal (PES) tracking mode. This will give max. acceleration, max deacceleration then position tracking mode when near 0 velocity and 0 PES. The PID parameters are matched to the target electo-mechanical capabilities. ( Simple for any Servo-design engineer, not so simple for a newbie. ) – Sunnyskyguy EE75 Oct 3 '16 at 0:58 • The Voltage difference from start to stop must be stored to locate the midpoint and hold and determine in advance when to change directions of acceleration from full accel. to full brake assuming loading (work done) is constant and torque is equal in each direction. – Sunnyskyguy EE75 Oct 3 '16 at 1:03 If for some crazy reason this doesn't already exist, ... It (probably) doesn't exist because steppers aren't used for servo applications in this way. Most stepper applications home the stepper on power-up and then step out to the required position. The motor has to be sized adequately to ensure that it doesn't stall or miss steps during motion. If you insist on using a stepper for a servo application then you could try the following using a micro, stepper control board and regular stepper motor with some sort of opto or mechanical home switch: • On power-up stepper rotates in given direction until home switch turns on. • Stepper reverses rotation and runs in slow speed until home switch turns off. This is "home". • Micro reads PWM signal and calculates target position in steps from zero. Stepper drives to target position, keeping track of steps. Repeat the last step forever. Your measurement of the incomoing PWM might have a bit of jitter which would have the servo constantly stepping back and forward around the setpoint. You might want to put in a little deadband in your software to prevent this and once in position remain there until the setpoint changes by a minimum amount. • This doesn't really address the potentiometer the poster wants to use. – Chris Stratton Oct 2 '16 at 17:18 • I thought I had addressed that in my first paragraph. It might be a bit weak. I'm trying to say forget the pot for a stepper motor. – Transistor Oct 2 '16 at 17:21 • You've entirely failed to provide any argument for why the potentiometer is unworkable. – Chris Stratton Oct 2 '16 at 17:25 • It's not unworkable, Chris, it's just not normal. I've used steppers in industrial applications for many years and I've yet to see one with an encoder or pot. Many of the application notes mention them but few choose to use them. If he wants to use a pot in this application then it's just a matter of physical connection, feed the analog to the micro and have it adjust position. I don't think he'll find much off the shelf and, as you have commented on the question and Richard has just answered, there are better ways to do the job. – Transistor Oct 2 '16 at 17:33 • I'm basically looking for a cheaper way to have a high-torque servo. Open-loop control is useless. It needs to be able to be overloaded, externally knocked out of position, interrupted while moving yet still know where it is. Guessing where it is is not acceptable like it is with open-loop control. – user2514676 Oct 2 '16 at 22:20 The reason you have not been able to find anything is likely because using a potentiometer (vs. a shaft encoder) is both old-school technology, a vanishing category of component available, and a dangerous combination unless you modify the pot to allow for continuous rotation. You did not reveal why you think you want to use a potentiometer instead of a more modern solution? Your requirement seems arbitrary, counter-intuitive and extremely limiting (which you have discovered already). • I'm basically looking for a cheaper way to have a high-torque servo. Open-loop control is useless. It needs to be able to be overloaded, externally knocked out of position, interrupted while moving yet still know where it is. Guessing where it is is not acceptable like it is with open-loop control. – user2514676 Oct 2 '16 at 22:22 • I absolute position is your concern, then use a shaft POSITION encoder. It is the 21st century. We don't have to use our grandfathers' technology. Ref: en.wikipedia.org/wiki/Rotary_encoder#Absolute_rotary_encoder – Richard Crowley Oct 2 '16 at 22:37 • Can you buy a stepper with a absolute rotary encoder already mounted on it for <$150? I'm not seeing them packaged this conveniently... – user2514676 Oct 3 '16 at 15:40
• You can probably find some on the surplus market somewhere if you search long enough. But commercially, they are very likely well over \$150 and tend to be "semi-custom" where the customer specified which motor (with shaft diameter, length, etc.) and which kind of encoder to bolt onto the end. This kind of situation is typically not done with stepper motors which is why you don't see lots of solutions. – Richard Crowley Oct 3 '16 at 15:56

Stepper motors and brushless DC motors are conceptually similar, but stepper motors are designed to continuously handle enough current to accommodate their maximum torque while brushless motors are not. This allows stepper motors to be used in open-loop fashion while brushless motors cannot. Combining a stepper motor with a high-resolution position sensor whose steps had a known phase relationship with the stepper coils could allow the controller to adjust the applied current to improve efficiency, but a potentiometer would be unlikely to have the resolution or stability to offer such benefits.

About the only advantages I can see from using a pot in conjunction with a stepper motor, versus using a stepper motor alone, would be (1) one would have some idea of position on startup without having to home the motor first, and (2) if the torque of the stepper motor is insufficient to accelerate the load as fast as the motor is trying to go, the system could detect that the motor had slipped (though likely not fast enough to prevent it from slipping in the first place).

Using a brushless motor with an encoder, along with a worm gear and potentiometer, might offer some advantages over using a brush motor, but brush motors work pretty well in servo applications.

• Since motor voltage only controls no load speed depending on friction
• and motor current directly controls motor torque,

• thus neither V nor I controls motor position.
• The only way to control this in a non-stepper motor is with position feedback or a "closed loop servo".

• ** for better quality control , you need a quadrature dual pot ** or quadrature incremental shaft encoder, because the end-point of a pot is a "dead-spot"
• since quadrature sin/cos pots became almost obsolete by virtue of cheaper methods using high res. quadrature shaft encoders, your options are limited on a small size and budget
• Did you really intend to answer this twice? – Roger Rowland Oct 3 '16 at 5:57