Unipolar Stepper Motor
A unipolar stepper motor has one winding with center tap per phase. Each section of windings is switched on for each direction of magnetic field. Since in this arrangement a magnetic pole can be reversed without switching the direction of current, the commutation circuit can be made very simple (e.g., a single transistor) for each winding. Typically, given a phase, the center tap of each winding is made common: giving three leads per phase and six leads for a typical two phase motor. Often, these two phase commons are internally joined, so the motor has only five leads.
Components Required
- ATmega32 microcontroller
- AVR programmer board
- Crystal
- Capacitors
- Unipolar Stepper Motor
- ULN2803
- +5 V Supply
- Battery Equivalent to the voltage rating of the motor
- Breadboard
- Connecting wires
Circuit Diagram
Description
- PC0 to PC3 are connected to the four inputs of the ULN2803 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 a unipolar stepper, you use a Darlington Transistor Array. The stepping sequence is as shown below. Wires 5 and 6 are wired to the supply voltage.
Source Code
/*The following code will make the stepper motor to run continously*/
#include <avr/io.h>
#include<util/delay.h>
#ifndef F_CPU
#define F_CPU 1000000UL
#endif
int main()
{
DDRC = 0xFF; //All pins of PORT C as output
PORTC = 0x00; //Initially all pins as output low
while (1) //infinite loop
{
PORTC = 0x03; //0011
_delay_ms(100);
PORTC = 0x06; //0110
_delay_ms(100);
PORTC = 0x0C; //1100
_delay_ms(100);
PORTC = 0x09; //1001
_delay_ms(100);
}
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=20;
DDRC = 0xFF; //All pins of PORT C as output
PORTC = 0x00; //Initially all pins as output low
while (x) //loop till x is not equal to zero
{
PORTC = 0x03; //0011
_delay_ms(100);
PORTC = 0x06; //0110
_delay_ms(100);
PORTC = 0x0C; //1100
_delay_ms(100);
PORTC = 0x09; //1001
_delay_ms(100);
x--; //decrement x by 1
}
return 0;
}
No comments:
Post a Comment