Motorized fader won't stop where it is supposed to

Hi, I am working on a DMX controller project where I need my recently bougth motorized potentiometeres, or "flying faders" to go to a given value. This is a potentiometer where you move a knob up and down along a linear axis, and you can read the value from 0-1023, just like a normal pot, but these have a builtin 10V DC motor, so you can position the knob to a given value in your program (the knob will physically move, but you will need an H-bridge, of course). See picture attached (I have three of these faders, one for each of the colors RGB, and therefore three H-bridges. All connected properly to an Arduino Mega, with an external power supply). I just built a program so that I can type a number in the serial monitor and then the middle fader should go to that value.

The problem is that since it is not a stepper motor or a servo, the motor itself does not know where to stop. You have to set the motor to go one way, and when you reach the value you typed, the motor should stop, but since it stops when it reaches the value, the motor keeps going until it stops of friction, I believe, regardless of the fact that the power is taken away. So the knob always goes beyond where it is supposed to. Here is what I have tried to solve it:

  • I tried to use PWM signals to slow the motor, but a PWM under 150 is not strong enough to make it move properly, and over 150 is still going beyond.
  • I tried to stop the motor some "distance" (values) away from the destination point, but depending on how long the "trip" is, that distance will vary.
  • I tried to program it so that when it reached the destination point, the motor would go on the other direction for some time, to stop the movement, but again, depending on how long the knob had traveled, its speed would vary, and some constant time would therefore be inaccurate.
  • I tried to program it so that the knob would move slower and slower the nearer it got the destination point, but this failed, since I could not make the PWM signals cooperate.

It's so bad so that if i position it at 0, and tell it to go to 50, it goes to about 130, and if it is at 0 and I tell it to go to 700, it goes to about 1000 ... I did not post any code, since there is multiple failed attempts, but if it is needed, I will provide it. If someone has ideas of how I can get more accurate results, I am open for any advice :smiley:

Photo of the faders (sorry for my messy desk):

A PID controller takes into account how far the fader is from the target and how fast it is moving. I would install the "PID" library (use Tools->Manage libraries...). The "PID_Basic" example that comes with the library is a good starting point but only does one-way control (default output range is 0 to 255). I would change the output limits to -255 to +255 and use the sign of the output to control the direction you drive the motor.

The hard part is tuning the PID parameters to get the slider to move quickly to a new position without too much overshoot.

You seem to have tried all the obvious solutions. Have you tried doing a minimal move with a pulse of power a few milliseconds long? That might enable you to correct the overshoot with a series of "jogs" back to the desired position.

Another approach might be to build a table of times and distances by experiment. Then you know how long the pulse is to reach the distance you need. It may need to be a separate table for each slider and you may need to rebuild the tables occasionally to allow for wear.

If the table approach isn't quite accurate enough, you could use the jog approach to finish up.

Is it possible you're trying to get PWM out of a non-PWM pin? On the MEGA, only pins 2 through 13 and 44 through 46 can be used for PWM. If you use analogWrite() on any other pin, it will be LOW for values below 128 and HIGH for values of 128 or above.

The pins I am using for PWM control is the pins 2 - 7 on the Mega board, they should be PWM pins.

Thanks to both of you! The project is at a senter, and I am home at the moment, but I will try to get up there tomorrow to try your suggestions!

Can you please post a schematic?
A hand drawn would be fine, please include power supplies and pin numbers/names.

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.