Phone

    00852-6915 1330

L297 L298 Circuit: Stepper Motor Controller

  • Contents

I Description

The performance and structure of the stepper motor driver chip L297 /L298 are analyzed. At the same time, combined with the AT89C52 single-chip microcomputer, a simple method of driving a stepper motor is introduced. This blog gives the control schematic diagram.

The actual measurement shows that the stepping motor drive system designed by this method has the characteristics of simple hardware structure, easy software programming, and low price.

stepper motor driver

Catalog

I Description

II Introduction

III Working principle

VI Hardware

V Software Composition

VI Conclusion

FAQ

Ordering & Quantity

II Introduction

What is a stepping motor?

stepping motor is a precision actuator that converts electrical pulse signals into angular displacement or linear displacement. The stepping motor has the characteristics of convenient control and small size. Therefore, it is widely used in numerical control systems, automatic production lines, automatic instruments, plotters, and computer peripherals.

L297 and L298  can easily form a stepping motor driver and combine with AT89C52  single-chip microcomputer for control. That is, it is possible to form a stepper motor drive circuit with good performance at a relatively cheap price.

III Working principle

Since a stepper motor is an actuator that converts electrical pulse signals into linear or angular displacement, it cannot be directly connected to AC and DC power supplies. Instead, a special device, a stepping motor.  must be used to control the driver. A typical stepping motor control system is shown in Figure 1.

The controller can send out pulse signals whose pulse frequency can be continuously changed from a few hertz to tens of kilohertz. It provides a pulse train for the ring distributor.

The main function of the ring distributor is to distribute the pulse sequence from the control link according to a certain rule. Then it is amplified by the power amplifier and added to the input terminals of the stepping motor  drive power supply to drive the rotation of the stepping motor

There are two main categories of ring distributors:

  • One is to use computer software design methods to achieve the functions required by the ring divider, usually called a soft ring divider.
  • The other is a ring distributor composed of hardware. Usually called a hard ring distributor.

The power amplifier mainly amplifies the smaller output signal of the ring distributor to achieve the purpose of driving the stepper motor.

Typical stepper motor control block diagram

Figure 1. Typical stepper motor control block diagram

VI Hardware

The stepper motor controlled in the blog is a four-phase unipolar 35BY48HJ120 deceleration stepper motor. The block diagram of the stepper motor control driver designed in this blog is shown in Figure 2. It consists of AT89C52  single-chip microcomputer, optocoupler, integrated chips L297  and L298.

Block diagram of stepper motor control driver

Figure 2. Block diagram of stepper motor control driver

The stepper motor introduced in the blog is a four-phase unipolar 35BY48HJ120 deceleration stepper motor. The block diagram of the stepper motor control driver designed in this article is shown in Figure 2. It is composed of AT89C52  single-chip microcomputer, photoelectric coupler, integrated chips L297 and L298.

AT89C52 is a low-voltage, high-performance 8-bit CMOS microcontroller from  ATMEL  in the United States. The chip has a built-in 8K bytes of re-erasable Flash memory, 256 bytes of RAM, three 16-bit timers, and a programmable serial UART channel. Therefore, it is sufficient to complete the simple control of the stepper motor.

L297 is a stepping motor controller (including ring distributor). L298  is a double H bridge driver. The interface of the microprocessor to the double-bridge stepping motor composed of them is shown in Figure 3.

The advantage of this combination is that it requires few components. As a result, the assembly cost is low, the reliability is high, and the space is small. And through software development, the burden of microcomputers can be simplified and reduced. In addition, L297  and L298  are independent chips, so the application is very flexible.

The L297  chip is a hardware loop integrated chip that can generate four-phase drive signals for computer-controlled two-phase bipolar or four-phase unipolar stepper motors.

The heart of the L297  is a set of decoders that can generate various required phase sequences. This part is controlled by two input modes, direction control (CW/CCW) and HALF/FULL, and stepping clock CLOCK. It advances the decoder from one step to another.

The decoder has four output points connected to the output logic section to provide the phase sequence required by the suppression and chopping functions. Therefore, L297  can generate three-phase sequence signals, corresponding to three different working modes: the half-step mode (HALFSTEP). Basic step (FULL STEP, full step) one-phase excitation method. Basic step two-phase excitation method.

Inside the pulse, the distributor is a 3bit reversible counter, plus some combinational logic to generate 8 steps of Gray code timing signal per cycle. This is the timing signal of the half-step working mode. At this time, the HALF/FULL signal is high. If HALF/FULL is set to a low level, the basic step working mode is obtained, that is, the double four-beat full-step working mode.

l297

Figure 3. L297 Picture

Another important component of  L297  is the two  PWM  choppers to control the phase winding currents to achieve constant current chopping control to obtain good torque-frequency characteristics.

Each chopper consists of a comparator, an RS flip-flop, and an external sampling resistor. A common oscillator is also provided to provide trigger pulse signals to the two choppers. In Figure 5, the frequency f is determined by the external 16-pin RC network. When R>10kΩ, f=1/0.69RC.

When the clock oscillator pulse sets the trigger to 1, the motor winding phase current rises. When the voltage on Rs of the sampling resistor rises to the reference voltage Uref, the comparator flips to reset the flip-flop, the power transistor is turned off, and the current drops, waiting for the arrival of the next oscillation pulse. In this way, the output of the trigger is a constant frequency  PWM signal, which modulates the output signal of L297.  and the peak value of the winding phase current is determined by Uref.

The input of the CONTROL terminal of  L297 determines that the chopper acts on the phase lines A, B, C, D or the suppression lines INH1 and INH2.

  • When CONTROL is high, it has a control effect on A, B, C, D;
  • When it is low level, it controls INH1 and INH2, so that the steering and torque of the motor can be controlled.

The L298  chip is a high-voltage, high-current dual full-bridge driver. L298  is designed to accept standard TTL logic level signals and drive inductive loads. For example, relays, cylindrical coils, DC motors, and stepping motors. It has two suppress inputs to make the device immune to the input signal. The emitters of the triodes of each bridge are connected together, and the corresponding external terminals can be used to connect peripheral sensing resistors. Another input power supply can be installed to enable the logic to work under low voltage.

The L298  chip is an integrated chip in a multi-watt in-line package with 15 leads.

l298

  Figure 4. L298 Picture

In Figure 5, AT89C52  is connected to the microcomputer through the serial port after  MAX232  level conversion and accepts instructions from the host computer. Then send clock signal, positive and negative signal, reset signal and enable control signal to L297

In the circuit, resistors R13 and R15 are used to adjust the reference voltage of the chopper circuit. This voltage will be compared with the magnitude of the potential fed back through pins 13, 14 to determine whether to perform chopping control. In order to achieve the purpose of controlling the peak value of the motor winding current and protecting the stepper motor.

Because L297 has a chopping constant current circuit inside, the peak value of the winding phase current is determined by Uref. When two pieces of L297 are used to drive the two windings of the stepping motor through L298.  and the Uref of each phase winding is changed through two D/A converters, the stepping motor subdivision driving circuit is formed.

In addition, in order to effectively suppress electromagnetic interference and improve the reliability of the system, an isolation circuit composed of two 16-pin photoelectric coupling devices TLP521-4 is used in the single-chip and stepping motor drive circuit. As shown in Figure 5.

Schematic diagram of stepper motor control driver

Figure 5. Schematic diagram of stepper motor control driver

Its function is to cut off the direct electrical connection between the microcontroller and the stepping motor drive circuit. In this way, the separate connection of the single-chip microcomputer and the driving circuit system ground is realized, and the interference signal generated by the driving circuit working under the high-current inductive load and the interference signal generated by the sudden change of the grid load is serially connected to the single-chip microcomputer through the line, which affects the normal operation of the single-chip microcomputer.

V Software Composition

In this circuit, set P1.0 port as the motor start button. P1.1, P1.2, P1.3 are speed selection buttons, the speed is from low to high. P1.4 is the motor stop button. The maximum speed of the three speeds is 500pps, 1000pps, and 2000pps. RXD, TXD have been connected to the serial port by MAX232 level conversion.

In addition, the start and stop frequency of a stepper motor is low, generally between 100-250 Hz. The maximum operating frequency is required to be higher, usually 1-3kHz. In order to ensure that it will not lose step during the whole process of starting, running and stopping, but also can reach the target position accurately as soon as possible, the running speed must have an acceleration-constant speed-deceleration process. Here, the commonly used discrete method is used to approximate the ideal trapezoidal acceleration and decrease curve, as shown in Figure 5.

That is, the timer interrupt mode is used to continuously change the size of the timer load value. In this example, for the convenience of calculation, the loading value required for the speed of each discrete point is converted into the required timing time by the formula and solidified in the ROM of the system. Here, TH0=(65536-time)/256,TL0= (65536-time)%256 is used to calculate the loading value, and time represents the timing time required for each step.

The system uses the look-up table method to find out the time required during operation, thereby greatly reducing the time occupied by the CPU and improving the corresponding speed of the system. Therefore, the program is mainly composed of control main program, acceleration and deceleration subroutine, and the main program block diagram is shown in Figure 6.

  Figure 6. Main block diagram

VI Conclusion

The innovation of this blog is to propose the application of single-chip microcomputer and L297, L298 integrated circuits to form a stepper motor control driver. It has the advantages of fewer components, high reliability, less space, and low assembly cost.

FAQ

What is L297 and L298?

L297 is a stepper motor controller that is used to generate two-phase bipolar. Drive signal (A, B, C, D) and motor current settings. L298 is used to drive the power output of the stepper motor. It is driven by a double full bridge mode.

 

What are the characteristics of a stepping motor?

Convenient control and small size

 

What does a stepping motor convert electrical pulse signals into?

Angular displacement or linear displacement

 

What is a stepper motor controller?

Stepper motors enable accurate positioning with ease. They are used in various types of equipment for accurate rotation angle and speed control using pulse signals.

Kynix

Kynix was founded in 2008, specializing in the electronic components distribution business. We adhere to honesty and ethics as our business philosophy and have gradually established an excellent reputation and credibility in our international business. With the accurate quotation, excellent credit, reasonable price, reliable quality, fast delivery, and authentic service, we have won the praise of the majority of customers.

Join our mailing list!

Be the first to know about new products, special offers, and more.

Leave a Reply

We'd love to hear from you! Feel free to share your thoughts and comments below. Rest assured, your email address will remain private.

Name *
Email *
Captcha *
Rating:

Kynix

  • How to purchase

  • Order
  • Search & Inquiry
  • Shipping & Tracking
  • Payment Methods
  • Contact Us

  • Tel: 00852-6915 1330
  • Email: info@kynix.com
  • Follow Us

authentication

Kynix

© 2008-2026 kynix.com all rights reserved.