Not another stepper motor

Hi guys, Please excuse the noobness of my question..I am a hardware guy stumbling through learning to code
....
What's the best way to drive a stepper motor like a DC motor?
As in I am looking for constant rotation and vairable speed. . .
The grand plan I have is to rebuild a camera pan and tilt head using steppers and a thumb joystick for control (potentiometers). (The unit currently just has geared 24VAC motors and relays)

Why do I want to use stepper motors and not just DC motors is because of their fantastic torque and in they are relatively quite compared to geared motors.

Precision and repeatable positions are NOT key,

This is where I am stuck, I have spent days digging through forums and the wider arduino world and have come up with almost nil. Don't get me wrong there is huge amounts of information about stepper and driving them, but that all deals with only moving x amount of steps(and back again).. Nothing I have found looks at continues stepping.

So, if could someone (you) could please tell me if what I'm thinking will work or am I just mad,

I have been looking at the 'EasyDriver Stepper Motor Driver' from sparkfun, this only uses 2 pins (one for steps and one for direction) The Dir is just Hi or Low of a digitalout pin. .
Can I use a PWMout of the arduino for the step input of this driver board? Will it make the motor step like I want?

Anything help would be greatly thanked,

The grand plan I have is to rebuild a camera pan and tilt head using steppers and a thumb joystick for control (potentiometers).

As in I am looking for constant rotation and vairable speed. . .

If the camera never stops rotating and tilting, you won't get very good pictures, will you?

The continuous rotation bit doesn't make sense.

Can I use a PWMout of the arduino for the step input of this driver board?

Every time the step pin goes high, the stepper motor steps. PWM would have your stepper motor going nuts. Why do you think you want to use PWM?

Nothing I have found looks at continues stepping.

It's not that it can't be done. But, really, why do you want to? That isn't clear.

Sorry mabey i didnt say it corectly,

Think when the potentiometer is cented the motor is stoped, but when you push the pot to the left the camera pans to the left and the speed changes depending on how far you push the stick (like the throttle in a car).
Let the stick go and it goes back to the center and the motor stops.
The same happens for going righ, up, and down

I understand that when the pot is centered there will need to be a dead area outlined in the code so that it dosent step and that yes if the PWM could make it go far to fast, but cant that be fixed by ajusting the range of the PWM output??

Thanks,

The way I would do this is to read the joystick potentiometers on each pass through loop. The number of steps, the time between steps, and the direction would be based on the value of a pot relative to the middle. Move the joystick farther from center to make the stepper move faster, farther.

You'll need to experiment with the number of steps per execution of loop and the time between steps to get smooth motion.

Continuous stepping is pretty easy with the arduino library.

My first program (I drive a telescope attached in front of the camera, for the schematic of how to use a ULN2003 see the Arduino Stepper library example, I'm using unipolar steppers and control each motor with a keypad of five buttons instead of a pot) works like this:

  1. You define control variables, and setup your motors with some defaults (the variable definitions should go above the setup() block so that they are visible to the whole program):
s1direction = 1;
s1speed = 50; // steps per minute
s1 = Stepper(s1speed, pin1, pin2)

same for as many steppers as you need
s2 = ...
...
sX
  1. You define a function that has the motors perform single step
    e.g.
void makeSingleStep() {
  s1.step(s1direction);
  s1.step(s2direction);
  // ... many more :) I use three
  sX.step(sXdirection);
  // ...
}

The direction flag variables (sXdirection) hold either 1 or -1, depending on which way you want your motors to go.

  1. You write some code to quickly process your control events - this depends on what you use for input.

This function needs to do two things, fast:

  • read input responsible for direction and speed for each motor
  • set the corresponding control variables (steps per minute and direction) for each motor
  1. In your loop, you combine the above stuff like this:
void loop() {
   // read inputs, make necessary input processing calculations
   processControlEvents();

   // set direction and speed flags for the stepper objects
   // this can be combined with the one above
   // you also do setSpeed(newSpeed) for each motor here
   setDirectionFlagsAndSpeed();

   // make motors run one step
   makeSingleStep();

   // loop until last_step_time in the Stepper library overflows
}

This approach worked quite well for me so far. I read simple digital buttons for control, so no complex analog calculations. Takes lots of pins though. (The real reason I am using buttons is I prefer fine control over speed, and I find discrete changes easier than turning a pot ... and I had no suitable pots when I wrote the program.)

Potential problems:

I haven't looked into the Stepper library. You should take a look and make sure there isn't something that's going to overflow after a while. I haven't used mine for over 30 or 40 minutes at a time, so I haven't had issues, but who knows.

Hope this helps

Edit: okay there is a

long last_step_time

used in the stepper library which is set to millis(), and will eventually overflow, but it should be some days of operation before that happens. resetting the board should give you more days.

Wow, thanks for that jubal, Thats given me alot to think about!

I had another look at how PWM works and yes it uses a fixed frequency, so that wont work for drivinbg the easy stepper board at all.