How to control DC motor forward and reverse with one potentiometer

David82:
Why can't you just use a a 12v battery, a pot, and a 12v motor? This is an Open-loop system. Because of that fact, servos aren't necessary even though they could be used. There should be a way to construct a simple, analog circuit that consists of not much more than a battery, pot, and dc motor but still allows for proportional forward and reverse movement of that motor.

You could do this - but it's going to take a few more parts. I'm envisioning something using the parts you mentioned, plus a window comparator or two (to sense voltage above or below a mid-point value, taken from the pot as a voltage divider), with those outputs feeding into a square-wave VCO or something (for PWM), and from there into one side or the other of an h-bridge.

In short, you would simply be redesigning what is inside a servo - with the feedback potentiometer being the "controller", the motor of the servo running open loop. In fact, I would look into the analog circuits used by early servos (talking stuff from the 1960s-1980s or so) as an idea (or you could just use one of the various chips used in servos today; they still require more than a few extra parts - a couple of transistors for a half-bridge, and a handful of diodes, caps, and resistors - maybe an inductor or two).

It'd be easier to just emulate it all with an ATTiny (but you'd still need an h-bridge)...

Why is everyone assuming he wants to control a servo, he said he wants to control a DC motor.
Where did servo come from?

There should be a way to construct a simple, analog circuit that consists of not much more than a battery, pot, and dc motor but still allows for proportional forward and reverse movement of that motor.

Well, just skip all that other stuff and get two switches like below (one for each motor).

Why is everyone assuming he wants to control a servo, he said he wants to control a DC motor.
Where did servo come from?

Because it is the closest analogy to the requirement stated?
Clearly a pot, motor and battery alone aren't going to be sufficient because they don't allow for current reversal to allow the motor to change direction, unless, perhaps you have a battery with centre tap. You're going to need some active components in there.

I know he needs an H-bridge, but all he asked was can he control a DC motor with a POT.
YES, he can. He will need a H- bridge, to supply the proper current to the motor, and if he wires it up correctly, the code I wrote will work.

the code I wrote will work.

Maybe, but it isn't an analogue solution, as requested in the original post (though what it is doing in this forum beats me XD )

For a motor (with h-bridge/motor shield of course!). You read the pot with ADC and then values above (say ) 700 are forward, values below 300 are backward and values in between are stop. But you still need one pot per motor.

Mark

In the big picture there will be a 2-axis joystick controlling two DC motors.

this is simple too. It is only a differential setup.

Pseudocode.
if ( Y > 0 && XL > 0 || XR < 0) //forward with left or right turning
{
M1F = Y - XL;         M2F = Y - XR;              //XL and XR can be set by an IF statement, if analogRead(A0) > 0, then put it in XL
M1R = 0 or LOW     M2R = 0 or LOW           // else put it in XR
}
else if ( Y < 0 && XL > 0 || XR < 0) // reverse with left or right turning
{
M1R = Y - XL;         M2R = Y - XR;        
M1F = 0 or LOW     M2F = 0 or LOW
}

More code for 360 turning...

else 
{...full stop... }

holmes4:
For a motor (with h-bridge/motor shield of course!). You read the pot with ADC and then values above (say ) 700 are forward, values below 300 are backward and values in between are stop. But you still need one pot per motor.

Mark

That looks to be correct. Do you have a link to a recommended h-bridge/motor shield? Remember, I'm simply using a analog, 2-axis joystick (with 2 pots total) to control a pair open-loop motors for use in a pan tilt system. For example, if the joystick is half-way tilted to the right, the pan/tilt system will go half-speed in that direction. I've done this plenty of times with servos but now the components need to be basic, dc motors.

I've done this plenty of times with servos but now the components need to be basic, dc motors.

Then my solution is the one you want to use.

It gets data from the 2 pots and tells the motors how to move.If you dont like my second way, then just repeat my first way for both motors.

This controls the forward and backwards movement of ONE motor, repeat for second motor.

// say the lowest is 350 and the highest is 650, the difference is 300
// so divide 300 by 2, you get 150.
// then 350 + 150= 500 (center) 
//offset, you decide how much dead zone you want, for the center. 
// +-10 should be enough.
If( POT1< 490) { // offset(10) - center(500)
...go forward...
}
Else if (POT1 > 510) {
... Go backwards...
}
Else { 
... Full stop...
}

Which motor shield depends on how much current the motors would require. Take a look and the Arduino one in the hardware section of the main site as a starter. This runs two motors each with speed and direction (4 digital pins in all).

As for the pots one end to earth one to the 5v and the center wiper to the analog pin.

Mark

This runs two motors each with speed and direction (4 digital pins in all).

You may also want to add another couple of pins for the brakes.

And two for current sensing?

Mark

The quick fix would be to get two of the below (one for each joystick pot) motor controllers, and connect the joystick pots in place of the pots on the controllers.

http://www.electronickits.com/kit/complete/motor/k166.htm

zoomkat:
The quick fix would be to get two of the below (one for each joystick pot) motor controllers, and connect the joystick pots in place of the pots on the controllers.

http://www.electronickits.com/kit/complete/motor/k166.htm

That looks to be perfect. So to summarize, you would use one of these:

and wire each one to one of these in place of the pots that they come with:

is that correct?

If so, where else can I get these? They are expensive http://www.electronickits.com/kit/complete/motor/k166.htm
Also, don't I also have to make sure the pots on the joystick are the same resistance as the pots that were originally on the speed controller?

David82:
Also, don't I also have to make sure the pots on the joystick are the same resistance as the pots that were originally on the speed controller?

It's a 100k pot. Looking at the schematics it's not simply connected to V+ and ground. There is a 100k resistor on the high side and a 10k connecting it to ground. So yeah it won't act the same unless the joystick pots are 100k. Or you change the resistors to compensate.

Good point. Now, knowing that, what would I have to change those two resistors to to be able to use the 5k pots that are on the joystick instead?

Or maybe replace the pots in the joystick.

http://www.ebay.com/itm/10pcs-100K-Ohm-B100K-Knurled-Shaft-Linear-Rotary-Taper-Potentiometer-/260985205438?pt=LH_DefaultDomain_0&hash=item3cc3ee32be

Replacing the pots might be a better idea. But if you want to change the resistors you just need to reduce them by the same factor. ie, your 5k pots are 1/20 of the original pot's value. So the top 100k resistor will become 5k, and the bottom 10k will become 500R. That's going to increase the current through that leg but it's still only 1.1mA or so.

Yep. The pots that came with the motor driver will either fit in the joystick or they won't. If they don't, then I'll have to wither find 100k pots that fit correctly in the joystick or replace the resistors and use the 5k pots. I'll report back after the parts get here.