A stepper motor is a brushless and synchronous motor which divides the complete rotation into the number of steps. Each stepper motor will have some fixed step angle and motor rotates at this angle. Here in this article, I’ll show you how to interface a Stepper Motor with 8051 using two different drivers: L293D and ULN 2003. Also, the Stepper Motor Control using 8051 Microcontroller is explained here.
Stepper Motor Control using 8051 Microcontroller Principle
The main principle of these circuits is to rotate the stepper motor stepwise at a particular step angle. The ULN2003 IC and the L293D Motor Driver are used to drive the stepper motor as the controller cannot provide the current required by the motor.
Circuit 1: Stepper Motor Control using 8051 Microcontroller & L293D
The first circuit in this project is implemented using an L293D Motor Driver IC. Since the L293D Motor Driver has an option for four output pins, only a Bipolar Stepper Motor can be driven using it.
The circuit diagram of interfacing a Bipolar Stepper Motor with 8051 Microcontroller and L293D Motor Driver is shown in the image below.
- AT89C51 (8051 Microcontroller)
- L293D Motor Driver
- 5V Bipolar Stepper Motor
- 16X2 LCD Display
- 11.0592 MHz Quartz Crystal
- 10KΩ Resistors X 2
- 10KΩ POT
- 8x 1KΩ Resistor Pack
- 33pF Ceramic Capacitors X 2
- 10μF/16V Capacitor
- Push Buttons X 4
- 330Ω Resistor
- 5V Power Supply
First, the data pins of the LCD are connected to the PORT0 Pins of 8051. Since PORT0 doesn’t have any internal pull-up, a resistor pack is used to pull the PORT0 up. The RS and E Pins of LCD are connected to P2.0 and P2.1 of 8051.
The RST Pin is pulled-down using a 10KΩ resistor. The combination of a Push Button and a 10μF Capacitor will be used to reset the microcontroller. Also, the EA Pin is pulled-up using a 10KΩ resistor.
Next, the oscillator. It consists of two 33pF Capacitors and an 11.0592 MHz Crystal connected between XTAL1 and XTAL2 Pins of 8051.
Coming to the Motor Driver, the two enable pins and two supply pins are connected to the +5V supply. The four inputs are connected to PORT1 pins of 8051 i.e. P1.0, P1.1, P1.2 and P1.3. The four pins of the Bipolar Stepper Motor are connected to the four out pins of L293D.
In order to control the direction of the Stepper Motor, three buttons are connected to PORT3 pins i.e. P3.0, P3.1, and P3.2.
The working of this circuit is very simple. A method called Half-Stepping is implemented in the program to rotate the Stepper Motor. When the forward button is pushed, the stepper motor rotates in clockwise direction.
Similarly, when the back button is pushed, it starts rotating in an anti-clockwise direction. To stop the rotation completely, you can press the stop button.
Circuit 2: Stepper Motor Control using 8051 Microcontroller & ULN2003
The second circuit in the project is to implement a Stepper Motor Control using 8051 Microcontroller and ULN2003. Since the ULN2003 Transistor Array consists of 7 outputs, you can control both the Unipolar and Bipolar Stepper Motors.
In this project, I’ll show you how to control a 5-Wire Unipolar Stepper Motor using 8051 Microcontroller and ULN2003 Transistor Array.
Following image shows the circuit diagram of interfacing a Stepper Motor with 8051 Microcontroller and ULN2003.
- AT89C51 Microcontroller
- Stepper Motor
The circuit consists of AT89C51 microcontroller, ULN2003A, Motor. AT89c51 is low power, high-performance, CMOS 8bit, 8051 family microcontroller. It has 32 programmable I/O lines. It has 4K bytes of Flash programmable and erasable memory. An external crystal oscillator is connected at the 18 and 19 pins of the microcontroller. The motor is connected to the port2 of the microcontroller through a driver IC.
The ULN2003A is a current driver IC. It is used to drive the current of the stepper motor as it requires more than 60mA of current. It is an array of Darlington pairs. It consists of seven pairs of Darlington arrays with a common emitter. The IC consists of 16 pins in which 7 are input pins, 7 are output pins and remaining are VCC and Ground. The first four input pins are connected to the microcontroller. In the same way, four output pins are connected to the stepper motor.
Stepper motor has 6 pins. In these six pins, 2 pins are connected to the supply of 12V and the remaining are connected to the output of the stepper motor. Stepper rotates at a given step angle. Each step in a rotation is a fraction of full cycle. This depends on the mechanical parts and the driving method.
Similar to all the motors, stepper motors will have stator and rotor. Rotor has permanent magnet and stator has a coil. The basic stepper motor has 4 coils with 90 degrees rotation step. These four coils are activated in the cyclic order. The below figure shows you the direction of rotation of the shaft. There are different methods to drive a stepper motor. Some of these are explained below.
Full Step Drive: In this method, two coils are energized at a time. Thus, here the two opposite coils are excited at a time.
Half Step Drive: In this method, coils are energized alternately. Thus it rotates with half step angle. In this method, two coils can be energized at a time or a single coil can be energized. Thus it increases the number of rotations per cycle. It is shown in the below figure.
Circuit Simulation Video of Interfacing Stepper Motor with 8051 & ULN2003
How to Operate this Stepper Motor Driver Circuit?
- Initially, switch on the circuit.
- Microcontroller starts driving the stepper motor.
- One can observe the rotation of the stepper motor
- The stepper motor has four wires. They are yellow, blue, red and white. These are energized alternatively as given below.
- In full step driving, use the following sequence
- To drive the motor in half step angle, use the following sequence
Stepper Motor Controller Circuit Advantages
- It consumes less power.
- It requires a low operating voltage
Stepper Motor Control Applications
- This circuit can be used in the robotic applications.
- This can also be used in mechatronics applications.
- The stepper motors can be used in disk drives, matrix printers, etc.