How to control motor on motorized slide potentiometer

Hi there

I just got a new motorized slide pot.

It has two output signal but I don’t see how this could not just be one since the reading is the same. (I guess for analog sound etc.?)

The potentiometer is equipped with a small DC motor.
I need to be able to stop the motor, corresponding to precise desired values of the potentiometer.
So far I have only been able to find out about direction and speed control of a motor. This however is not enough.

Since a servo does exactly what I need, very easely, and the thing that enables a servo to do just that, is the fact that there is a potentiometer attached to it, I guess this is the type of controller I need to get or make.
In order to learn, I find it a bad solution to just scavenge a controller from a servo. It must be possible with some chip and some wire and other simple components.
What i need is a way to turn my DC motor, with a feedback potentiometer already attached, into a complete servo.
When i search for these controllers and how to make them i find one of two things:

  1. A controller to control a servo. This requires the servo to all ready have a “servo-controller” on board,
    and only controls the, all ready finished, servo.
  2. A motor-controller. This only allows for direction and speed control. (or does it?)

I have been reading ALOT of forums and googled the web thin to find a good way to control the motor but it only leaves more questions:

Will a h-bridge do that?
Will a 555-timer do that?
Will a L293 do that?
Will a PID do that and if so… is there any way to buy a finishedand adjustable PID network? (I find them quite complicated)

Could it be done with direction control and some code that would not take up all of the chip-storage?
something like “if desired_value > actual_value, drive motor one way
if desired_value = actual_value, do nothing
if desired_value < actual_value, drive motor the other way”
The problem with this kind of logic, the way I see it, still is that the motor would not know when to stop.
This could be done by saying that the motor should drive for a specific short amount of time, and then rely on the loop to
eventually get the fader button to its destination. That would however slow down the rest of the sketch and I guess it would
also make the fader button move in a “stuttery” way.

How can I get the complete control of this motorized slide potentiometer and how do i hook-up the solution?

Please help me! I have really done everything i could to find out on my own before asking here. If this helps me on my way, I will eventually post a complete description on how to do this, since I cant be the only one.

i am/was doing something similar but with a rotary pot:

i used an h-bridge to control the motor and read in the values from the pot to tell it which direction it should go in… if that makes sense. you’ll need to slow down the motor via pwm when it gets close to the desired analog reading from the pot or you’ll have it bouncing back and forth until it hits the desired value.

i’m really new to this so there probably is a better solution. but that one was working for me.

Add a deadband to the feedback math, otherwise slowed down or not it will hunt. The deadband tell the controller to kill power and set braking just early enough that motor inertia lands the motor dead on the target position.

Sounds like you have the makings there for a servo - you have one channel of output you can use for feedback, and one channel for whatever use you might want.

You might look up PID for Arduino as there is code available to do that without having to try to create it yourself.

You need a driver for the motor that has an analog speed input and a digital direction input or an H-Bridge you could drive with a 2 pwm signals, 1 for forward, 1 for reverse.

Your input to the PID is position - which is the resistor feedback, and the desired position. The PID would calculate how much out of position and would return a value that would be the correction, which you would then tweek and use to control the motor. They are a pain to setup the first time, but once you do it it will make sense and PID loops do, in the long term, simplify things by handling the process for you.

PID is used for temperature control, speed control, position control.

You would set up the PID to give you an error value - Ideally a plus or minus value. You would then use that to select which outputs are turned on and the PWM value, if you are using that. It might need some scaling, or it might be usable as is. Plus is one direction, and minus is the other. And you have a 50% chance of hooking them up backwards the first time.

Deadband is a margin above and below the target feedback voltage at which point you coast and let inertia take you the remainder of the way to the setpoint. when a position change is seen the amount of change must be greater or less than the current position +/- the deadband before the motor is told to start. It also keeps load effects from items connected to the slider arm from causing ht emotor to constantly cycle trying to take up the backlash in the gearing and worm.

JosM: scott_fx, it looks pretty advanced to me. Is there any chance you would tell me about the structure of your code... for the motor part :)

sorry i didnt get any notifications about this topic.

My code is SUPER messy (aka... still learning). I'll try to work on it tomorrow night a little and get something to you.

one thing that i did play with was a 'kick back' function. where it counts how many times it overshoots the desired position. This lets me limit how many times the motor goes back and forth and then just accepts the error. I did this as a test on another sketch where it will ultimately be integrated into my the control system from the video. However, it'll control a large hydrofoil via linear actuators and not a motorized pot. I don't want them bouncing back and fourth and ruining the actuators. at 'kick 1' (meaning it overshot and is returning) you could have reduce the motor speed even further. then if it passes it a second or third time, you could have it stop completely.

that; of course, is very crude and probably not the best use of the motor controller. I didnt know about PID until your post. :) That being said, I'm very interested in implementing the pid control as well in my set up so maybe we can work back and forth if we run into problems. (I may not use it for the motorized pot, but this will ultimately control the hydrofoil's linear actuators via a second h-bridge where i can see the advantages for the pid)

I think you dont need "kickback" function, you can do it by tuning your PID values and get smooth operation. Look at wiki there is axplained what P, I and D variables does.

i didn't see the use of pwm speed control. you can subtract the desired value from the actual value to get a linear speed control (slows down as the pot approaches it's desired position). of course you'd set limits so that above a certain distance it would always move at full speed (255) and as it gets close it wont creep and take for ever (say; dont go below 40). in my tests this worked really well and was simple to implement