Shop OBEX P1 Docs P2 Docs Learn Events
Weird Motor Behavior — Parallax Forums

Weird Motor Behavior

I did an experiment using two comparators to see if I could get a DC motor to behave like a servo. I connected a control-potentiometer to the inputs of two comparators, one inverting input and the other non-inverting. I did the same with the motor's feedback potentiometer using the opposite inputs. The comparator outputs were fed to an h-bridge.
I thought this would allow me to control the position of the motor without having to use a micro-controller. At worst I thought the motor would chatter as it kept trying to find the neutral point. What I got was more like Parkinsons disease because the motor would turn to the spot but shake continuously.
I have already done it with a Prop and an ADC chip. I wanted to know if I could do the same thing with a simpler circuit.
I don't know if it's worth going any further. I would love to hear an explanation for the shaking behavior.
I removed the PCB from an old servo and connected the five wires to a breadboard for the experiment.
I drew up the image below to show the basic idea.
841 x 526 - 64K

Comments

  • kwinnkwinn Posts: 8,697
    The shaking is due to the inertia of the motor and the high gain of the comparators. The comparators always apply full power to the motors so the inertia of the armature will drive the positioning potentiometer beyond the set point. The polarity of the comparators will then apply full reverse power to the motor and overshhoot the set point in the opposite direction ad infinitum. Typical cure for such oscillation is to reduce power to the motor as the set point is approached and/or have a dead band around the set point.
  • kwinn wrote: »
    The shaking is due to the inertia of the motor and the high gain of the comparators. The comparators always apply full power to the motors so the inertia of the armature will drive the positioning potentiometer beyond the set point. The polarity of the comparators will then apply full reverse power to the motor and overshhoot the set point in the opposite direction ad infinitum. Typical cure for such oscillation is to reduce power to the motor as the set point is approached and/or have a dead band around the set point.

    That's it! I knew that was the correct explanation the moment I read it. Thank you.
    I know from my experiments with a Prop and an ADC that I had to do those very things you mentioned in the "cure".
  • You may want to consider summing in an integral stage to dampen the overshoot. But the price for that may be a somewhat slower overall response in moving to position. For a good read without deep math, check out "Real Time Programming: Neglected Topics" by Caxton C. Foster. Lot of good stuff in there with enough to point you towards the actual rabbit hole of your choice......
  • @"frank freedman", "...without deep math..." sounds like an excellent read. I'll check it out. Thanks.
  • Add some positive feedback to your comparators. Maybe the resulting hysteresis will cure the shakes.

    -Phil
  • lardomlardom Posts: 1,659
    edited 2019-11-04 15:27
    @"Phil Pilgrim (PhiPi)", when I tried to hold the motor shaft with my thumb and forefinger the oscillation tendency was still pretty strong. Kwinn's reply seemed to explain the Parkinson's disease behavior so I decided not to use comparators in this situation. Maybe I could use a rocker switch for direction control and a relay as a brake. A study of power-window circuits would be a good place to start.
    I watched a video where the narrator said late model cars have a power-window control module with a "ripple counter". He said the mechanical commutator creates ripples when it changes contacts which the module uses to determine distance. I said to myself if that's true 'maybe' I can use comparators to count pulses in DC motors.
    I will test diodes to see if if there is anything useful.
  • Did you try feedback resistors?

    -Phil
  • Did you try feedback resistors?
    -Phil
    If you mean Schmitt triggers no I didn't. Truthfully, I haven't learned enough about how to configure the upper and lower thresholds. I will do some op amp experiments, plugging in resistors to see what happens.
    It absolutely is time for me to learn how to filter out electrical noise from my motor circuits.
  • kwinnkwinn Posts: 8,697
    lardom wrote: »
    Did you try feedback resistors?
    -Phil
    If you mean Schmitt triggers no I didn't. Truthfully, I haven't learned enough about how to configure the upper and lower thresholds. I will do some op amp experiments, plugging in resistors to see what happens.
    It absolutely is time for me to learn how to filter out electrical noise from my motor circuits.

    The feedback resistors Phil is referring to are placed between the output and +input of the comparator. They make the comparator work like a Schmitt trigger and create a dead zone around the set point. Of course they also reduce the position accuracy. The old analog drive pipetters I worked on used two high gain op amps and transistors in an H bridge drive circuit for the x and y motors, and had feedback potentiometers to adjust the dead band. They only had to get close enough to the desired position to place a tiny tube in a test tube, but still required frequent calibration. The switch to stepper motors on this equipment was a blessing.
  • lardomlardom Posts: 1,659
    edited 2019-11-05 01:42
    kwinn wrote: »

    The feedback resistors Phil is referring to are placed between the output and +input of the comparator. They make the comparator work like a Schmitt trigger and create a dead zone around the set point. Of course they also reduce the position accuracy.

    I think I understand. I'll set up an experiment to see how the motor behaves.
    EDIT: If I understand correctly, the feedback resistor would be a small resistance.
  • lardon wrote:
    EDIT: If I understand correctly, the feedback resistor would be a small resistance.
    No, a large resistance compared to the resistance of your pots. Start with about a 50:1 ratio, and adjust from there. If you still get vibration, decrease the resistance; if the deadband is too large and the precision is wanting, increase it.

    -Phil
  • ercoerco Posts: 20,256
    edited 2019-11-06 22:02
    Also, consider using a motor driver (H-bridge or equivalent) which has dynamic braking. Makes all the difference in the world to stop on a dime. Without that, you switch your motor off but it keeps coasting past your intended set point and your system gets the DTs.

    I keep hoarding stocking up on these for small motors (under $1): https://forums.parallax.com/discussion/168432/h-bridges-of-madison-county-77-cents The Ebay link in that post is dead, so see https://www.ebay.com/itm/142061997859 Truth table at https://forums.parallax.com/discussion/download/122689/h-bridge TT MX1508.jpg

    Edit: Gramps here in the forum several years ago was using relays to drive a window motor. His post contains videos showing before & after dynamic braking. https://forums.parallax.com/discussion/123305/heavy-lifting-with-gasp-relays
  • I just fried my LM358. I'm not upset. I just didn't prepare for the inevitable magic smoke. I'll order a few and pick up where I left off.
    @erco, thanks for the links. I definitely could use motor drivers that have dynamic braking.
Sign In or Register to comment.