Engineers Gallery

Stepper Motor Control : Arduino

Stepper Motor Control : Arduino

[nextpage title=”Description” ]

Description

I’ve had a number of stepper motors sitting in my shop for years. If we really want to do anything fun with our Arduino, we are eventually going to have to run a stepper motor. So, here we go!

 
A little background on stepper motors and how they are different compared to a typical electric motor. Unlike a conventional electric motor that spins when power is applied, stepper motors incrementally spin (step), allowing control over exactly how far the motor’s shaft spins, even to the degree.
Stepper motors have a series of electromagnets that encircle an armature containing a magnet. Think of a compass with a shaft attached to the center of the needle. That needle becomes like the armature of the motor. To spin the armature, electromagnets are turned on and off around the outside of the compass, causing the needle to “step” (or point) from one electromagnet to the next. This picture may help illustrate the movement within a stepper motor.
[sam id=”5″ codes=”true”]
 
There are two common types of stepper motors: Bipolar and Unipolar. I’ve chosen to use a bipolar stepper motor in this project. It can be somewhat more difficult to use because of the need to reverse polarity on the stepper motor electromagnets to provide the proper stepping. Here’s a couple pictures of the motor I used:

[/nextpage]

[nextpage title=”Description1″ ]

 

A bipolar stepper motor has two electromagnetic winding sets. Because of this, it’s necessary to use some circuit to reverse the polarity of the winding. A common way to do this is through the use of an H-Bridge circuit.
 
I used this circuit to create my H-Bridge controller:
HBridge
I implemented the circuit on a perf board with a small 6 pin 90 degree header. I also added some LEDs to the circuit, just because everyone likes blinking lights, and I’m no exceptions. After all, that’s what got me into this as a child … blinking lights. Here’s a picture
of the H-Bridge:
[sam id=”5″ codes=”true”]
[sam id=”5″ codes=”true”]

[/nextpage]

[nextpage title=”Circuit Diagram” ]

 

I used the following diagram to pull the whole circuit together. There is an Inferred LED Interrupt sensor in this diagram. I’ll talk about that in a subsequent post, so disregard for now.
[visitor]
>> subscribe to view code& circuit diagram  (free  registration)
[/visitor]
[sam id=”5″ codes=”true”]
[member]
[/member]
[sam id=”5″ codes=”true”]

[/nextpage]

[nextpage title=”Code” ]

[sam id=”5″ codes=”true”]

[visitor]

>> subscribe to view code& circuit diagram  (free  registration)

[/visitor]
[member]
[message_box title=”MESSAGE TITLE” color=”red”]
I loaded the following very simple circuit onto the Arduino. It sets the speed of the motor to 10 RPM. Also, it turns the motor one revolution and then waits 2 seconds before looping.#include//create an instance of a stepper motor object
[sam id=”5″ codes=”true”]

Stepper stepper(96, 8, 9, 10, 11);void setup()
{
// set the speed of the motor to 10 RPMs
stepper.setSpeed(10);
}void loop()
{
stepper.step(96); //on revolution
delay(2000); //wait 2 seconds
}

[/message_box]
[/member]

[/nextpage]

[nextpage title=”Video” ]

[youtube height=”HEIGHT” width=”WIDTH”]http://youtu.be/fTYozg-EXkk[/youtube]

[sam id=”5″ codes=”true”]

[/nextpage]

[wysija_form id=”1″]

Exit mobile version