3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Drive a Stepper Motor with an AVR Microprocessor

Drive a Stepper Motor with an AVR Microprocessor
Got some scavenged stepper motors from printers/disk drives/etc lying around?

Some probing with an ohmeter, followed by some simple driver code on your microprocessor and you'll be stepping in style.

 
Remove these adsRemove these ads by Signing Up
 

Step 1Get to Know Steppers

Get to Know Steppers
«
  • stepper driver 00015.jpg
  • stepper driver 00017.jpg
Basically, you're going to need to figure out where all the little wires go.

First step is to figure out if it's a unipolar or bipolar motor. Have a look at Jones on Steppers for some deeper background, then at Ian Harries' Site for a simple method to figure out an unknown motor.

Read up a bit, then join me in a walkthrough of this motor I got for cheap. (They're on sale for $0.99 right now. They're small, relatively light, but don't have much torque. Don't know what it'll be good for yet.)

« Previous StepDownload PDFView All StepsNext Step »
38 comments
Jan 4, 2012. 7:46 AMawais mughal says:
bro can i use hard disk motor ...?
Dec 16, 2011. 8:59 AMadamshizu says:
hi there, I made a attiny13 + uln2003 to controll a small stepper motor, which can only running at ~40 rpm, if I increase the output, the motor just not run, what's happened help please.
May 7, 2011. 12:06 PMuberdum05 says:
An idea for the stepper motor, use two of them in a small robot as the drive motors to do fancy precision moves :)
Dec 24, 2010. 3:19 AMspecospec says:
what about using l293d
Jul 28, 2010. 3:43 AMvhk says:
Hi I have a unipolar stepper motor 0.4A,15v,1.8 degree my chip is attiny3213, can i drive it with ULN2803?
Jul 31, 2010. 11:12 PMnm17 says:
Should be fine. According to manufacturers site: "currents up to 1 A at voltages from 4.5 V to 36 V"
Jan 2, 2010. 6:58 AMwijting says:
I m working with this stepper and a Picaxe 28x project board.
I want to make a 90 degree swing,  that would be about 5 steps, based on the 20 steps for 360 degree
anyone an idea how to do this in the Picaxe Basic language?
I can make it step but not exactly 90 degree forward and backwards
Any suggestion is welcome, thanks


Sep 14, 2009. 9:51 PMEbay says:
where did u get that thing on the end of your motor to indicate it is turning?
Jun 9, 2009. 6:30 PMgeeklord says:
Can someone please find me a good reference/explanation of the different functions/commands/whatever that are used for AVR's? I've been dinging around for a while now with an Arduino and would really like to start using just the uC and not a developement board and simple language with it. I pretty sure I can get past getting the HEX file on the chip, I just need help with the language. Thx for any help.
Jun 11, 2009. 6:07 PMgeeklord says:
Wow, thanks a lot. Nice to get help from people who know what they're doing. The Instructables community is awesome!
Mar 17, 2009. 3:47 AMTobiasPl says:
I really like this tutorial! Very easy to follow, but I have a questions left: Lets say the sequence is BLUE BLACK RED YELLOW and RED is set to 5V, all others to 0V. Now I turn off the current and later on, I turn it on again but the IC now again starts with BLUE at 5V instead of RED. What will happen?
Mar 16, 2008. 3:44 PMTurboTronix says:
I want to use this setup to open and close a valve (for water current)...
May 10, 2008. 10:37 PMHerodotus says:
I went to the hardware today (Sydney, Australia) to get a solenoid garden watering valve to use on my yacht. All seemed to be either mains power or 24 volt DC - no 12 volt available. Anypne know where I can get a 12 volt DC one please?
Mar 20, 2008. 7:38 AMTurboTronix says:
It is for a school project. I changed it a little though. Now all I need is to use your setup but with some sort of a switch that will allow me to choose the spinning direction. I tried adding a simple ON/OFF switch to one of the ATTINY2313 chip without success. I ordered the H-bridge and should be getting it shortly. Do you know by any chance how should your code look with an input?
Mar 17, 2008. 1:48 PMTurboTronix says:
ya i guess you are right... A selenoid would be a better idea. I saw an electrical one so basically it would be a simple ON/OFF switch rather then spin.
Mar 17, 2008. 12:57 PMTurboTronix says:
Yes it works but not clean. I need to get the H-bridge going... Also can you by any chance give me an example code where I'll use this setup with an input pin (i.e. a photocell which will base the rotation side of the motor based on its input)? I tried but could not get it going well.
Mar 16, 2008. 2:20 PMTurboTronix says:
All worked until I used the code in your stepperMotor.c Nothing happens, the motor does not run anymore...
Mar 15, 2008. 7:15 PMxenomorph says:
manuka um I beleive that he/she's using the attiny 2313 wich is $3 at spark fun
Sep 26, 2007. 2:44 AMmanuka says:
(removed by author or community request)
Jan 6, 2008. 4:08 PMstasterisk says:
AVRs only cost ~$1.50
Jul 17, 2007. 1:12 AMThomas Countz says:
So in building this, should I put a diode between each motor winding and the SN754410, or should I put a diode between the power supply and the 8(Vcc2) pin of the SN754410.
Jul 1, 2007. 1:37 PMcoolguy says:
If you want a cheap solution to greatly increasing the torque and resolution, add gearing. You could probably build one of those homebuilt CNC machines with really cheap unsophisticated parts if you incorporated gearing. BTW nice tutorial. I now have a reason to play with steppers and microprocessors.
Nov 28, 2006. 9:53 PMAP says:
With a motor this small it may not matter, but it's generally a good idea to stick a diode betwen the motor and the rest of the electronics to block back current or give it a shunt to ground.
Nov 29, 2006. 1:10 AMCaptain Pedantic says:
I have this exact motor. Figured for .99 it's a great way to learn about steppers. I haven't gotten around to playing with it yet. I did assemble the parts for their driver, though. This looks much more comprehensible. Great instructable.
Nov 28, 2006. 4:09 PMlotmi127 says:
Ideas for stepper motor projects?
check this guy out!
http://www.taomc.com/gallery/sand.htm
Nov 28, 2006. 1:44 AMwestfw says:
It's pretty cool that you're able to drive the motor directly from the the AVR without letting the magic smoke out; I'll have to give that a try. I'll note that the diagram you derived for a bipolar stepper doesn't match the diagram Electronics Goldmine has on their website (for something closer to a 3-phase motor.) At least you have data to back up your version! Interesting.
Nov 28, 2006. 10:04 AMHovercraft says:
Good work and good instructable! Oh and the 2nd and 3rd videos are identical. I think you mis-linked the half-stepping one.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
95
Followers
7
Author:The Real Elliot