Tuesday, December 4, 2012

Drive up to 3 stepper motors on Atmega using "stepper02" library 01

A stepper motor is a brushless DC electric motor that divides a full rotation into a number of equal steps.

Stepper02 is an AVR Atmega stepper motor library that can drive up to 3 motors having different direction, type and speed with a precision of 256us per step @8Mhz.
To drive a motors connect an ic driver between atmega pin and motor.
Setup parameters is stored in stepper02.h files.

This library was developed on Eclipse, built with avr-gcc on Atmega8 @ 8MHz (fuse LF: 0xE4, HF: 0xD9)


  • read risk disclaimer
  • excuse my bad english


  1. So with this library Do I have individual control over motors or all the motors will be running synchronously ?
    Can you please help , I want to make 3 or 4 axis bipolar stepper driver. I m using L293D to achieve this.

    1. motors can run independently
      setup ports for the motors in file stepper02.h, then use the same functions used in example file to move the motors.
      if you need more motors, you can try this library: http://davidegironi.blogspot.it/2012/12/drive-up-to-12-stepper-motors-on-atmega.html

  2. Hi, Could you please indicate driver and IC model you used to driver stepper motors?
    I tried with L298 but it was not driving motors. I tried again with L293D and it drove motors but in an odd way and was not smooth at all. I am using Atmega32a and 42BYGHM809 WANTAI bipolar stepper motors.

    1. Hello, the one I'm using in this sample is a ULN2003A. You can find these cheap motors + driver on ebay or aliexpress.