Go Down

### Topic: 12VSTEPPER MOTOR CONTROL WITH ANALOG--NEED HELP (Read 1 time)previous topic - next topic

#### lownoise008

##### May 03, 2012, 08:17 pm
Hello I am trying to control a stepper motor with a potentiometer, but eventually I would like to use a pulse sensor to move the motor.

I'm using this biploar stepper motor: http://www.adafruit.com/products/324

I've gotten it to work using this motor sheild:
http://arduino.cc/it/Main/ArduinoMotorShieldR3

using code i found here: http://arduino.cc/forum/index.php?topic=89468.0

But I'm confused as to how to create code that will allow the potentiometer to control this motor.

(I'm new to arduino!!)

Any help would be awesome!!

#### PaulS

#1
##### May 03, 2012, 09:21 pm
This is ironic. Someone named lownoise screaming at us.

Quote
But I'm confused as to how to create code that will allow the potentiometer to control this motor.

So, you've noticed that a stepper motor steps. It does nothing else. How, exactly, do you want a potentiometer to "control" the stepper motor?

#### Slam

#2
##### Jun 24, 2012, 07:36 pm
By control he means regulate the motor's speed and direction using the potentiometer.

I have the same question, some sample code would be greatly appreciated!

Thanks,
-Slam

#### Mastino

#3
##### Jun 27, 2012, 10:26 am
Let's say you take 10K potentiometer. When you connect it(potentiometer) to arduino, it will show you the numbers from 0 to 1023.
Middle position of potentiometer should show you something about 510-512.
So(if i am not wrong) the code should look like:
if(val >= 510K && val <= 512)
stepper.stop();
else if(val >= 513)
turn.right();
else
turn.left();

#### PaulS

#4
##### Jul 02, 2012, 02:26 pm
Quote
So(if i am not wrong) the code should look like:
if(val >= 510K && val <= 512)

Well, that K looks out of place...

Go Up

Please enter a valid email to subscribe