Go Down

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

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!! :smiley-eek: :smiley-eek: :smiley-eek:

PaulS

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

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

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:
val = analogRead(potentiometer_pin);
if(val >= 510K && val <= 512)
stepper.stop();
else if(val >= 513)
turn.right();
else
turn.left();

PaulS

Quote
So(if i am not wrong) the code should look like:
val = analogRead(potentiometer_pin);
if(val >= 510K && val <= 512)

Well, that K looks out of place...

Go Up