Stepper motor control using 8051 microcontroller principle

Publisher:cyzceeLatest update time:2024-01-03 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

A stepper motor is a brushless synchronous motor that divides a complete rotation into steps. Each stepper motor will have some fixed step angle and the motor rotates at that angle. In this article I will show you how to interface a stepper motor with an 8051 using two different drivers (L293D and ULN 2003). Also, stepper motor control using 8051 microcontroller will be explained here.


Stepper motor control using 8051 microcontroller principle


The main principle of these circuits is to make the stepper motor rotate in steps at a specific step angle. Since the controller cannot provide the current required by the motor, the ULN2003 IC and L293D motor driver are used to drive the stepper motor.

Circuit 1: Stepper motor control using 8051 microcontroller and L293D

The first circuit in this project is implemented using the L293D motor driver IC. Since the L293D motor driver has the option of four output pins, you can only use it to drive bipolar stepper motors.

Circuit diagram

The figure below shows the circuit diagram for interfacing a bipolar stepper motor with an 8051 microcontroller and a L293D motor driver.


Required components

AT89C51 (8051 microcontroller)

L293D motor driver

5V bipolar stepper motor

16X2 LCD Diaplay

11.0592 MHz quartz crystal

10KΩ resistor X 2

10KΩ potentiometer

8 1KΩ resistor pack

33pF Ceramic Capacitor X 2

10μF/16V capacitor

ButtonX4

330Ω resistor

5V power supply

circuit design

First, the LCD's data pin is connected to the PORT0 pin of the 8051. Since PORT0 does not have any internal pull-up, use a resistor to pull PORT0 up. The RS and E pins of the LCD are connected to P2.0 and P2.1 of the 8051.

The RST pin is pulled down using a 10KΩ resistor. The combination of button and 10µF capacitor will be used to reset the microcontroller. Likewise, use a 10KΩ resistor to pull up the EA pin.

Next, the oscillator. It consists of two 80pF capacitors and an 11.0592 MHz crystal connected between the XTAL1 and XTAL2 pins of the 8051.

Going into the motor driver, the two enable pins and the two power pins are connected to the +5V supply. Four inputs are connected to the PORT1 pins of the 8051, namely P1.0, P1.1, P1.2 and P1.3. The four pins of the bipolar stepper motor are connected to the four output pins of the L293D.

To control the direction of the stepper motor, three buttons are connected to the PORT3 pins, namely P3.0, P3.1 and P3.2.

code

at work

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 pressed, the stepper motor will rotate in a clockwise direction.



Likewise, when the back button is pressed, it starts rotating in a counter-clockwise direction. To stop spinning completely, press the stop button.

Circuit 2: Stepper motor control using 8051 microcontroller and ULN2003

The second circuit of this project is to implement stepper motor control using 8051 microcontroller and ULN2003. Since the ULN2003 transistor array consists of 7 outputs, you can control both unipolar and bipolar stepper motors.

In this project I will show you how to control a 5-wire unipolar stepper motor using an 8051 microcontroller and a ULN2003 transistor array.

Circuit diagram

The figure below shows the circuit diagram for interfacing a stepper motor with an 8051 microcontroller and a ULN2003.


Circuit diagram of using AT89C51 microcontroller to control stepper motor

circuit components

AT89C51 microcontroller

ULN2003A

stepper motor

crystal

Resistor

Capacitors

circuit design

The circuit consists of AT89C51 microcontroller, ULN2003A, and motor. AT89c51 is a low power consumption, high performance, CMOS 8-bit 8051 series microcontroller. It has 32 programmable I/O lines. It has 4K bytes of Flash programmable and erasable memory. The external crystal oscillator is connected on pins 18 and 19 of the microcontroller. The motor is connected to port 2 of the microcontroller through the driver IC.

ULN2003A is a current driver IC. It is used to drive the current of the stepper motor as it requires more than 60mA. It is an array of Darlington pairs. It consists of seven pairs of Darlington arrays with a common transmitter. The integrated circuit consists of 16 pins, 7 of which are input pins, 7 of which are output pins, and the rest are VCC and ground. The first four input pins are connected to the microcontroller. Likewise, the four output pins are connected to the stepper motors.

Stepper motors have 6 pins. Out of these six pins, 2 pins are connected to the 12V power supply and the rest are connected to the output of the stepper motor. The stepper rotates at a given step angle. Each step of the rotation is a small part of the entire cycle. This depends on the mechanical parts and driving method.

Similar to all electric motors, a stepper motor will have a stator and a rotor. The rotor has permanent magnets and the stator has coils. A basic stepper motor has 4 coils, each with a 90-degree rotational step. The four coils are activated in a cyclic sequence. The image below shows the direction of rotation of the axis. There are many ways to drive stepper motors. Some of them are explained below.

Full Step Drive: In this method, both coils are energized simultaneously. Therefore, here two opposite coils are excited at once.

Half-step drive: In this method, the coils are energized alternately. Therefore, it rotates at half step angle. In this method, you can energize two coils at once, or you can energize a single coil. Therefore, it increases the number of revolutions per cycle. As shown below.

How to operate this stepper motor driver circuit?

First, connect the circuit.

The microcontroller starts to drive the stepper motor.

The rotation of the stepper motor can be observed

Stepper motors have four wires. They are yellow, blue, red and white. These can be powered as described below.

During full-step driving, please proceed in the following order

To drive the motor at half step angle, proceed in this sequence

Advantages of Stepper Motor Controller Circuit

It consumes less power.

Requires low operating voltage

Stepper Motor Control Application

This circuit can be used in robotic applications.

This can also be used in electromechanical applications.

Stepper motors can be used in disk drives, matrix printers, etc.


Reference address:Stepper motor control using 8051 microcontroller principle

Previous article:How to build an Android phone controlled robot using 8051 microcontroller and Bluetooth module
Next article:8051 microcontroller interrupt system structure and interrupt control principle

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号