cheapest and easiest way to control a stepper.

Hi all
I am a complete newby at both this forum and steppers.
I want to turn a pipe 45 deg. and back in a sweep motion but at 1 or 2 or 3….steps each time the power (12v) is turned on.
When it reaches a certain point at the end of 45 deg. it turns counter clockwise and does the same in reverse i.e.. power on 42 deg…power off….power on 40 deg… power off….power on 38 deg. etc. back to 0 deg then back clockwise.
I hope this makes sense.
I am trying to work out if there is a usb programmed controller or module that goes from 12 v power supply and tells the stepper motor what to do.
Sorry again for being a dummy.
I have spent hours trying to decipher what is what.

If it's only moving through a fixed arc of about 45 degrees, a servo might be a suitable actuator - that would be much easier to connect and control. How much torque does this thing need to apply?

I can easily turn the 40 mm pipe by hand. It is a little stiff because of the water resistance but turns easy enough.
It is a pump in the bottom of a fish pond that sweeps back and forth.
A pipe sits in spigot at the bottom of the pond and comes to the surface where it will be rotated through 45deg and the pump is attached to the pipe at the bottom.
I have got a wiper motor on it but can’t find a timer to come on for 1 second each time the pump switches on. It needs to move just a little to sweep the bottom and then have the pump run for ten minutes then switch off then when the 240v pump starts again it swishes in a slightly different spot.

Sounds like a servo would be the simplest and cheapest option. They come in a wide range of sizes. Look on the HobbyKing website, for example.

Servos sweep through about 180 degrees so if you only need 45 degrees you could "gear" it down with a lever to increase the torque for turning your pipe.


Are you familiar with ordinary model radio control servos like this?

There's nothing special about that particular one, and you can get better servos and cheaper ones. They also come bigger and smaller, so you can get servos suitable for a wide variety of applications which are all controlled in a similar way.

I get the general idea that you're turning the top of a vertical pipe which has a pump attached at the bottom, but I don't know what options you have for attaching to the top of the pipe. One approach would be to connect a pair of lugs to the sides of the pipe and then connect a pair of pushrods to a servo horn so that the servo pushes on one side and pulls on the other - this would produce a torque but no nett force. You'd need to attach the body of the servo to something fixed, but presumably you can do that.

The only thing left for you to do if you take this approach is to power the servo with a 5-6V DC supply capable of providing about 1A of current.

I have never seen a servo that big that would turn this. It is kind of a solid twist to turn it. It needs to rotate back and forth totally automatically so I am not sure how you would program a servo to do this
By the way thanks for your help.

I see some pretty cheap stepper motors that would attach right on to the top of the pipe and then the controller would just tell it to move 1 or steps the wait. I am just not sure what controller I need to tell it that or how to program it.
There seems to many options out there from a few dollars up wards but I just have no experience in selecting or programming.

move 1 or 2 steps then wait.

Sorry typo.

couple of things. a stepper will have about 200 steps per revolution. that means if you want it to spin 360, it will need 200 steps.
you only want 45° or 25 steps. very easy to do.

the rotation is well within the range of a servo, so you have two choices.

you said easiest, multiple people said servos are easier. because they contain the driver inside.

the Arduino is the controller
the power that drives it is the driver. the power unit is called a stepper driver, not a controller. the brains controls, the power drives. a lot of people mix them up.

since you are asking we assume....
you are not familiar with transistors.
since you need to use transistors to power the motor we will assume you are not familiar with making your own circuits.

based on those, and your decision to go with steppers, you need to get a stepper driver.

the cheap way is to buy a cheap stepper driver from e-bay.

the arduino tells the driver which way to move and how much.

you need a power supply for the the project. that is based on the size of your stepper.

while you are waiting the weeks for the cheap parts to come in from china, read and practice lighting LED's.

read up on "blink without delay" this is key for all you do.

use the pins you plan on using for the stepper, you need 4
connect LED's to those pins, with a dropping resistor.
you want to turn the leds on in sequence, like a chase.

press a button, it goes one way 6 times (like your stepper will)
press it again, it goes 6 times the other way.

4 led's. 6 times through = 24 total steps

the button will be your 'start' .

you have some time to play with the programming so that when you press the button, the lights blink.

when the driver comes in, connect the pins you used for the lights to the signal lines on the stepper driver.

by the time the stepper driver arrives, you should be able to make it control that stepper easily.

while you are waiting, figure out how to make everything waterproof !

By the time you have bought a stepper motor, a stepper motor driver board and a power supply (and have studied enough to know which ones to choose) it will cost a lot more than a servo - assuming you don’t choose the most expensive servos. Then you need to figure out how to program your Arduino to drive the stepper. And you will need one or two microswitches to enable the Arduino to detect when the servo is at the end of its permitted travel - and code for that as well.

In contrast the servos just need a suitable 5v or 6v power supply and a connection to the Arduino. The code to drive the servo will be simple because inherently a servo “knows” where it is.

If you can’t measure the amount of torque needed to turn the pipe (and I assume you have done your best to reduce friction) and thus figure out what size servo is needed then buy a cheap mid-sized servo and try it out. You can power it from 4 AA batteries for testing.


Just thinking how this could be done mechanically using the water pressure from your pump system.

Maybe a spring loaded piston that moves so far when there is pressure on and when there is no pressure it retracts.

It moves a ratchet gear that in turn moves a arm system that will sweep back and forth much like the windsheild wiper.

Interesting idea @justone.

It prompted me to think of mounting a vane (like a boat's rudder) at the pump outlet and "steering" the vane with a servo just like you would on a model boat.


I have never seen a servo that big that would turn this

Bear in mind that all we know is what you've told us - that it turns easily by hand. Put some numbers to it - how many foot-pounds of torque does this thing need to turn?

Thanks so much to everyone for there input.
I researched the servo idea and it seems that you can get some pretty powerful servos…It has changed a lot since I played with radio gear.
Sorry again for the lack of understanding but if I get you correctly I could connect a servo to the top of the pipe and program a arduino to move a few degrees every time it was powered up then stop. When it gets to the end of the 45Deg then start back the other way.
How hard would it be to program for a complete newly like me. :grin:
Do you download software from internet then plug in the arduino via usb then program it. Does it holds that program in its memory regardless if it has power to it.

My wish list is that
1, Kambrook timer turns on the 240v water pump and the 12v regulated power supply both at the same time.
2, The power supply has 6 and 12v outputs.
3, The power supply powers up a programmed arduino that tells the servo to move clockwise 5 deg then stop.
4. The Kambrook switches off the pump after 10 minutes and everything goes to sleep.
5, The cycle happens 6 times in the night blasting water across the bottom of the pond sweeping all the debris away to the other end, The sediment will just fall in a spot with no current so this is why the sweeping action is required.
I am a fish man not an Arduino man. If you need any asters on filtration I am happy to help. Ha!

How hard would it be to program for a complete newly like me. :grin:

You can download the Arduino IDE (integrated development environment - a fancy name for the software that you use for developing Arduino programs) for free and without having any Arduino hardware. This will allow you to get a feel for how easy it is to create programs (sketches in Arduino-speak). You can load up example programs or write your own and see if they compile (verify) although, of course you can't actually run the programs without an Arduino board. An Arduino Uno is probably the best choice for a beginner as most examples are designed for it.

There are many example sketches included with the IDE several of which are probably directly relevant to what you want to do. For example there is one that illustrates how to make a servo sweep back and forth which will probably do what you want with only minor changes to set the angles you want.


Thanks Again

I could connect a servo to the top of the pipe and program a arduino to move a few degrees every time it was powered up then stop. When it gets to the end of the 45Deg then start back the other way.
How hard would it be to program for a complete newly like me. :grin:

The program will be quite simple. The main difference between your project and the standard servo example sketches is that you will need your project to save its current position in EEPROM each time it runs, so that it knows what position to move to next time. I’d expect the whole thing to be a couple of dozen lines of code - not trivial for a novice, but perfectly feasible if you are willing to spend time learning to code.

Do you download software from internet then plug in the arduino via usb then program it. Does it holds that program in its memory regardless if it has power to it.

You use the Arduino IDE to write your code and upload it to the Arduino. Once it is uploaded, it stays in the Arduino until you overwrite it by uploading something else. Each time the Arduino is powered up, it runs whatever code is currently loaded in it. In other words, this will be ideal for what you want to achieve.

Here I am again
I have now a big servo.
Freetronics eleven
I have it set up and running the sweep program well
I can pick out and change some variables and change timing and speed etc.
I desperately need help as I don't have time to create the code to do what I want
I go overseas working in a week and would like it done before I go.
I am very interested but a lot of other things are also needing to be done.
In an ideal world if someone could write the programme I would be very grateful.
My wish list would be as follows

Power comes on. The unit starts at 0 deg and stays there. 5 minutes moves to 10 deg then at 10 minutes to 20 deg, 15 minutes to 30 deg then at 20 minutes sweeps out continuous to 45 deg and back to 30 deg, 20 deg and 10 deg back to 0 to complete the loop.
Ideally this would happen with power switching off an on with a random timer and the unit just stopping wherever it is and then starting where it left off.
Thanks for everyones input
Gratefully appreciated.
This is very interesting stuff and can't wait to get my teeth in to it and play with it. I have many applications.

I'm sure you will find plenty of people willing to advise you how to write the sketch, and fix any problems with it.

If you want somebody to write it for you, the Gigs & Collaborations section is the place to ask. Note that most people would expect to be paid for working for you.