Driving a 2 phase 4 wire stepper motor

I got a Arduino Uno Starter kit and I want some help in learning how to use it to drive a 2 phase 4 wire stepper motor. It's those very tiny steppers with drive voltage of 3-5V, used in digital cameras I think.

I want the shaft to swing like a pendulum, a certain degree clockwise and a certain degree counterclockwise, and repeat...

I'm totally lost on how to start this. I know C but have never programmed Arduino before. I hope this thread will provide me with the guidance. Does anyone have a basic code template? Or perhaps a wiring diagram for such a stepper. Thanks

Do some research by using the Search box at the top of the page. This is a common request so you will get a lot of reading.

The main thing to remember is that you cannot connect the motors directly to the Arduino outputs. You may need to purchase a driver board.

If you have a link to the motor, please post it. Otherwise a photo so we can see what you are using.

Weedpharma

You may find something useful in Stepper Motor Basics

...R

weedpharma:
Do some research by using the Search box at the top of the page. This is a common request so you will get a lot of reading.

The main thing to remember is that you cannot connect the motors directly to the Arduino outputs. You may need to purchase a driver board.

If you have a link to the motor, please post it. Otherwise a photo so we can see what you are using.

Weedpharma

So I guess I need to purchase a driver board? Thanks

What is the coil resistance?
Do you know what is the permitted coil current?

The usual stepper drivers that are mentioned here (eg Sparkfun Easydriver) are probably intended for much larger motors. The Easydriver can supply up to 750mA. I have no idea what its minimum is.

My guess is something much more basic would be sufficient - maybe a ULN2003 would do the job (but don't rely on me for that).

How many motors will there be in your project?

...R

There is only one motor for my project. I need the shaft to turn like a pendulum back and forth periodically. The load is small. I don't have the exam numbers for the torque required, but imagine if the said output shaft is the wheel axis of a (one wheeled) hot wheels car, all it has to do is make the car move.

I need it to be small and quiet, which is why I looked at those tiny steppers for digital cameras. I bought a couple off Ebay but they had no spec sheet. At this point, I don't even know if they will provide enough power, but that's probably not too important now. The goal at this point is to get something together and make the stepper turn in the way I want. Learning the basics of steppers and Arduino programming is more important now. I don't even care if I destroy some steppers along the way, they are cheap anyway.

Anyway, I found a spec sheet for a similar motor, and I may just get this off Amazon:

The winding resistance is 22 ohm.

It seems the current can be as high as 400mA. Drive voltage is 5V, according to the datasheet above.

According to the Q&A section on the Amazon page, someone said "If you are using an Arduino there is no need for a driver because they run on logic level voltage anyway."

So perhaps I don't need a driver?

Here's the page on Amazon:

Thanks

I've had good results with this or something similar for small motors.

www.adafruit.com/products/2448

Be careful not to cook the motor by having the current set too high - these small motors
typically need something like 70 to 150mA, and giving them 1A would fry them very fast.

Someone mentioned the ULN2003 - no use for a 4-wire motor at all I'm afraid, only suitable
for a unipolar (5, 6 or 8 wire).

You do need a driver because the Arduino I/O pins can only provide about 20mA (40 mA absolute max) and, in addition, motors cause voltage spikes that could fry your Arduino.

At 5v and 22ohms the current would be 227 mAmps.

You could control the motors with the device in Reply #6 or the Pololu DRV8833 which is the exact same price on the Pololu website. The 8833 will work with lower voltages - I am using one to drive a small DC motor from a 3.7v LiPo.

For all I know there may be simpler driver options - I have no experience of such small motors.

How many steps per second will the motor be required to make?
I presume the thing it is moving will not have enough momentum to make the motor miss steps when a change of direction is required? Or do you plan to use acceleration and deceleration to deal with that?

Thanks Mark for the correction about the ULN2003.

...R

Hi,
Look at the angle per step from the specs , 18Deg????
Not sure how they get the 20um/step.

Tom.... :slight_smile:

Robin2:
How many steps per second will the motor be required to make?
I presume the thing it is moving will not have enough momentum to make the motor miss steps when a change of direction is required? Or do you plan to use acceleration and deceleration to deal with that?

Thanks Mark for the correction about the ULN2003.

...R

Okay, I'll buy the driver given in reply 6, the Adafruit.

The brochure I gave above for the Nidec says step size is 18 degrees. I think this is a typo. Isn't 1.8 degree more common? I'll probably shoot for something like 30 steps per second to start with.

It's not a precision application so missing steps is not a big deal. Yes, the attachment it's moving has very little momentum.

I think I'm going to spend the next couple of days doing some reading first with all the resources out there so I can come back with more intelligent questions. In the meantime, feel free to comment or give advice.

thanks

Okay, those motors are unipolar right?

I found this gem:

This is an example that rotates the shaft in revolution clockwise and then one revolution counterclockwise. This is very close to what I'm looking for. I can tweak it as I get more advanced and add more features. But for now, this should suffice. It's great the page even tells me exactly what I need and has the code:

/*
Stepper Motor Control - one revolution

This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.

The motor should revolve one revolution in one direction, then
one revolution in the other direction.

Created 11 Mar. 2007
Modified 30 Nov. 2009
by Tom Igoe

*/

#include <Stepper.h>

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}

void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);

// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(500);
}

But depending on whether the motor is unipolar or bipolar, it either needs:

U2004 Darlington Array (if using a unipolar stepper)

or

SN754410ne H-Bridge (if using a bipolar stepper)

I just ordered a few different motors and I'm not sure if they are bipolar or unipolar. All it says is "2 phase 4 wire"!

But here are the pics:


They are different from the pics I showed earlier. They are bigger motors (6mm diameter) which I think is more suitable for my needs.

It really annoys me that I cannot figure out if those are unipolar or bipolar. Anyone with experience with these small motors, please advise. Thanks

Unipolar motors need 5 wires. If they have 4 (or 6) wires they are (or can be used as) bipolar motors.

Measure the resistance between all the pins and write it down in a table.

...R

To be more complete:

5-wire - unipolar only
4-wire - bipolar only
6 or 8-wire - can be wired as unipolar or bipolar. 8-wire can be wired as series or parallel bipolar
giving a choice of impedances.