Saturday, October 26, 2013

Interfacing Bipolar Stepper motor using L293D


Bipolar Stepper motor

Bipolar motors have a single winding per phase. The current in a winding needs to be reversed in order to reverse a magnetic pole, so the driving circuit must be more complicated, typically with an H - bridge arrangement (however there are several off-the-shelf driver chips available to make this a simple affair). There are two leads per phase, none are common.Dithering the stepper signal at a higher frequency than the motor can respond to will reduce this "static friction" effect.
Because windings are better utilized, they are more powerful than a unipolar motor of the same weight. This is due to the physical space occupied by the windings. A unipolar motor has twice the amount of wire in the same space, but only half used at any point in time, hence is 50% efficient (or approximately 70% of the torque output available). Though a bipolar stepper motor is more complicated to drive, the abundance of driver chips means this is much less difficult to achieve.


Components Required

  • ATmega32 microcontroller
  • AVR programmer board
  • Crystal
  • Capacitors
  • Bipolar Stepper Motor
  • L293D
  • +5 V Supply
  • Battery Equivalent to the voltage rating of the motor
  • Breadboard
  • Connecting wires 

Circuit Diagram


For details on L293D IC go to 

Description

  • PB0 to PB3 are connected to the four inputs of the L293D IC.
  • Both the enable pins are separately connected to Vcc.
  • A crystal is connected to the XTAL1 and XTAL2 pins to provide the clock pulse.
  • Reset is connected to +5 volt

Control Logic

To control the bipolar motor,apply voltage to each of the coils in a specific sequence. The sequence would go like this:


Source Code

/* This code will make the stepper motor to run continously */ 

#include <avr/io.h>
#include <util/delay.h>

#ifndef F_CPU
#define F_CPU 1000000UL         // frequency of external crystal
#endif

int main()
 { 
DDRB = 0xFF;                   //All pins of PORTB as output
PORTB = 0x00;                 //Initially all pins as output high
while(1)
{
PORTB = 0x01;          //0001
_delay_ms(10);
PORTB = 0x04;          //0100
_delay_ms(10);
PORTB = 0x02;          //0010
_delay_ms(10);
PORTB = 0x08;          //1000
_delay_ms(10);
}
return 0;
}


Source Code for controlled Rotation

/* This code will make the stepper motor to run for a specific angle */ 

#include <avr/io.h>
#include <util/delay.h>

#ifndef F_CPU
#define F_CPU 1000000UL         // frequency of external crystal
#endif

int main()
 {
         /*Calculate x by the minimum step angle of your motor and required rotation angle*/
         int x = 200;
         DDRB = 0xFF;                   //All pins of PORTB as output
 PORTB = 0x00;                 //Initially all pins as output high
while(x)                              //will loop till x is not equal to zero
{
PORTB = 0x01;          //0001
_delay_ms(10);
PORTB = 0x04;          //0100
_delay_ms(10);
PORTB = 0x02;          //0010
_delay_ms(10);
PORTB = 0x08;          //1000
_delay_ms(10);
                x--;                             //decrement x by 1
}
return 0;
}

For more tutorial and information, like the Facebook Page 


1 comment:

  1. Sands Casino Hotel & Spa in Las Vegas, NV | S Resort
    The Sands Hotel & Casino features over 1,000 deluxe rooms. The Sands offers slot machines, video poker and a table game facility. The 샌즈 카지노 3 만 Sands Casino features

    ReplyDelete