Download this article in PDF form here
Please read http://www.triindia.co.in/resources/?p=40 if you are handling the stepper motor for the first time.

Example describes stepper motor driver using ULN2803. In this example code two stepper motors are driven by a single timer. Code is written for ATmega16/32 running at 8MHz, for serial baudrate of 19200 and winavr platform.
Circuit description:
It is a simple unipolar drive. Circuit for a single stepper is shown same circuit is used for other stepper also. A B A’ B’ of first motor are connected to PORTB0-PORTB3. and other motor is connected to PORTD4-PORTD7.
Program description:
Include uart.h and makefile in your project folder and name your main program as main.c.
Stepper motors run by interrupt of Timer 0. Timer 0 is configured in CTC mode(refer datasheet) with pre-scalar of 1024. Every time interrupt is executed motors move by one step. Delay between the steps can be controlled by OCR0. To increase the speed of motor lower the value of OCR0 and do reverse to decrease the speed.
I use serial port of PC to configure speed and number of steps to rotate, this program runs without serial connection but motors will rotate only 100 steps each time it is switched ON. Connect a RS232 to TTL level converter like MAX 232 between TX and RX pin of uC and PC serial port.
Please read http://www.triindia.co.in/resources/?p=35 to configure your hyperterminal to be able to communicate with your robot through PC serial port.
Uart.h enables us to use C functions printf , scanf with controller. printf (“string”); writes specified string on hyperterminal screen and scanf can be used to take input from hyperterminal.
I have tested this circuit and program and it works fine but, There may be some bug introduced while writing this article so please post your comments to find the bug if any.
Downlaod stepper.zip from http://www.swapniljariwala.co.nr/upload.php
It contains main.c and uart.h.
July 30, 2008 at 8:48 am
Nice article for motor control.
August 2, 2008 at 11:39 am
hi,
we want datasheet of ULN2003 and ULN2803. please replay.
August 16, 2008 at 3:03 pm
HI…
VISIT datasheet4u.com….
U WILL GET ALL THE DATASHEETS THERE!!!
March 7, 2009 at 6:07 am
hi,
i need a PDF about stepper motor control by using ATmega32l microcontroller . Where uln2308 is motor diver is used. would u like to send me tht pdf file please. and i need some data sheet about stepper motor also.
March 30, 2009 at 9:18 am
Good article… It is better if you provide the internal operation of stepper motor also
March 30, 2009 at 5:11 pm
I have searched about the word “stepper motor” and you blog appeared to me.
where can I read about stepper motor in details in your blog?!