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)

Code

Notes
  • read risk disclaimer
  • excuse my bad english

8 comments:

  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.

    ReplyDelete
    Replies
    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

      Delete
  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.

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

      Delete
  3. Hello David Ser,
    i want to drive 6 stepper motor using AVR Atmega series controller.is there any library for that.
    please let me know sir,
    Thank You, your tutorials always help me..

    ReplyDelete
    Replies
    1. Hello, you can try using this one: http://davidegironi.blogspot.it/2012/12/drive-up-to-12-stepper-motors-on-atmega.html

      Delete
  4. Hello Davide ... Do u have any idea about using ATmega328 with L298 to drive a bipolar stepper motor .... If please send me schematic ...thanks

    ReplyDelete
    Replies
    1. Hello, you can use this project, you just havwe to change the TIMER0 register setup. I suggest you to use PWM to drive motor if you need something more accurate, you can find my library here: http://davidegironi.blogspot.it/2013/11/driving-dc-motor-using-software-pwm.html but there are a few availbale. Here you can find a simple L298 schematics http://davidegironi.blogspot.it/2013/03/controlling-dc-motor-speed-and_6.html, you basically just need to connect the output PIN from your micro to the IC. Note: a scope can help you here investigating the PWM output signal of your micro.

      Delete