Shop OBEX P1 Docs P2 Docs Learn Events
motor control algorithms? — Parallax Forums

motor control algorithms?

henry99henry99 Posts: 67
edited 2008-08-26 03:39 in BASIC Stamp
Real servo boards seem to be rather expensive and complex and not readily available unlike stepper motor drivers (which count steps) or RC motor drivers (which take PWM inputs).

To implement the feedback control system to position a motor using the BS2, are there any examples of PID control?

Aren't most motors either forward/reverse on or off and the following pseudo code seems to achieve the goal:

if position·> wanted then
· power = forward
else·if position < wanted then
·power = reverse
else if position = wanted then
·power = off

Or is there something else usually involved?· I was thinking there might need to be a range of acceptable values to prevent "overshoots".

Also, what is the best way of stopping a reversible motor?· Does one just apply current in the opposite polarity briefly (using 2 SSRS, one for forward, one for reverse)?· I would think friction alone would not be that accurate to get a tight/fast position lock.

·

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2008-08-26 03:39
    Yes, most motors ARE "forward/reverse on or off". However, if you 'pulse' the power to the motor, the motor windings "average" the pulses, and you can get slower or less torque power out of the motor -- thus the importance of "Pulse-Width Modulation" or PWM.

    So, once you've got speed control, now you need some feed-back element, like a position sensor, to tell you where the motor shaft is.

    So, once you've got speed control, and position sensing, NOW you can use some PID (Proportional/Integral/Differential) error signal generating algorithm to ramp up and ramp down the speed of the motor to get more precise position settings.

    Oh, and "Stepper" motors have several sets of windings. Energizing one set after another gives you both speed control as well as position control -- so those are 'special'.

    And ALL of these approaches take more I/O pins than a position-comparing Servo -- but you do get more power, more torque, or more speed out of the result. If you add a position sensor to a modified-servo, you can do the same things in terms of PID algorithms as to an H-Bridge PWM controlled DC motor.
Sign In or Register to comment.