Stepper Motor Connections, Control and Programming

Stepper Motor
Contents List
  1. Introduction
  2. What Is a Stepper Motor?
  3. How a Stepper Motor Works?
  4. Types of Stepper Motors
  5. Stepper Motor Specifications
  6. Identifying Stepper Motor Wires
  7. Choosing a Stepper Motor Driver
  8. Connecting a Stepper Motor to Arduino
  9. Controlling Stepper Motor Position and Speed
  10. Programming a Stepper Motor with Arduino
  11. Using a Driver with STEP and DIR Inputs
  12. Controlling Multiple Stepper Motors
  13. Common Stepper Motor Applications and Projects
  14. Troubleshooting and Safety Tips
  15. Frequently Asked Questions
  16. Conclusion

Time reading is 20min.

1. Introduction

A Stepper Motor is an electric motor that moves in discrete angular increments called steps. Instead of simply rotating continuously when power is applied, it moves in response to a controlled sequence of electrical signals. This makes it useful for applications that require repeatable movement, such as positioning a robot arm, moving a 3D printer axis, or rotating a platform to a selected angle.

Stepper motors are popular in electronics projects because their movement can often be controlled without an encoder. A microcontroller sends commands to a suitable motor driver, and the driver energizes the motor windings in the required sequence.

However, accurate movement is not automatic. Incorrect wiring, insufficient current, excessive speed, mechanical resistance, or sudden acceleration can cause the motor to vibrate, stall, or miss steps.

In this guide, you will learn how stepper motors work, how to identify their wires, how to choose a driver, and how to control position and speed using Arduino. Practical examples will help you build a foundation for more advanced motion-control projects.

2. What Is a Stepper Motor?

A Stepper Motor is an electric motor designed to rotate its shaft in small, defined increments. Each electrical command advances the motor by a step or microstep, depending on the motor and driver configuration.

Unlike a conventional brushed DC motor, which typically rotates continuously when supplied with power, a stepper motor uses a sequence of energized windings to establish magnetic fields that move the rotor from one position to another.

Main Components of a Stepper Motor

A typical stepper motor includes the following parts:

  • Stator: The stationary part containing the motor windings that produce magnetic fields.
  • Rotor: The rotating part that responds to the magnetic fields generated by the stator.
  • Windings or phases: The electrical coils energized in a controlled sequence to produce movement.
  • Shaft: The mechanical output that transfers rotation to the connected load.
  • Bearings: Support the shaft and help it rotate smoothly.
  • Motor housing: Protects the internal components and provides mechanical mounting.

The internal construction varies by motor type. For example, permanent-magnet and hybrid stepper motors use different rotor arrangements.

Why Use a Stepper Motor?

Stepper motors are useful when a system needs controlled incremental movement. In many applications, the controller can estimate the shaft’s position by counting the steps it has commanded.

Common advantages include:

  • Convenient incremental positioning.
  • Straightforward digital control.
  • Good low-speed control when correctly configured.
  • Holding torque while the windings are energized.
  • Compatibility with many microcontrollers and motion-control systems.

However, a stepper motor does not guarantee that every commanded step has been completed. If the motor stalls or loses synchronization, the controller’s estimated position may no longer match the actual shaft position.

3. How a Stepper Motor Works?

A stepper motor rotates when its windings are energized in a particular sequence. Each change in the magnetic field causes the rotor to move toward a new equilibrium position.

The Basic Stepping Process

A simplified operating sequence is:

  1. The controller sends a command to the motor driver.
  2. The driver energizes the appropriate motor winding or windings.
  3. The magnetic field changes.
  4. The rotor moves toward the new magnetic position.
  5. The driver advances the winding sequence to produce further movement.

By controlling the number of steps, the controller estimates how far the motor has moved. By controlling the rate of step commands, it controls the requested rotational speed.

What Determines Motor Direction?

Direction depends on the order in which the motor windings are energized. Reversing the sequence reverses the direction of rotation.

For drivers that use STEP and DIR inputs, the controller sends step pulses on the STEP pin and selects the direction using the DIR pin. The driver handles the winding sequence internally.

The electrical logic that represents clockwise or counterclockwise motion depends on the driver and motor wiring. Therefore, test the direction at low speed before connecting the motor to a mechanism.

Holding Torque

When a stepper motor is stationary, its driver may continue energizing the windings to hold the rotor against an external load. This produces holding torque, but it also consumes electrical power and generates heat.

Some drivers reduce the current when the motor is idle. This can reduce heating but also reduce the available holding torque.

If the application must hold a load safely, do not assume that the motor will maintain its position indefinitely without power or feedback. Consider the mechanical load, the driver’s configuration, and the consequences of losing power.

4. Types of Stepper Motors

Stepper motors differ in their internal construction and winding arrangement. Identifying the type helps you choose a compatible driver and connect the motor correctly.

Permanent-Magnet Stepper Motor

A permanent-magnet stepper motor uses a magnetized rotor that aligns with the magnetic fields produced by the stator windings.

These motors are used in some small positioning systems and educational projects. Their step angle and wiring depend on the particular design.

Variable-Reluctance Stepper Motor

A variable-reluctance stepper motor has a rotor made from magnetically permeable material, commonly with shaped teeth. The rotor moves toward the position that provides the lowest magnetic reluctance as the stator windings are energized.

This design differs from a permanent-magnet motor because the rotor does not rely on a permanent magnet in the same way.

Hybrid Stepper Motor

Hybrid stepper motors combine characteristics of permanent-magnet and variable-reluctance designs. They are widely used in CNC equipment, 3D printers, robotics, and positioning systems.

A common hybrid stepper motor has a full-step angle of 1.8 degrees, corresponding to 200 full steps per revolution. Other step angles are also available, so check the motor’s datasheet.

Unipolar and Bipolar Stepper Motors

The terms unipolar and bipolar describe winding arrangements and the way winding current is controlled.

  • Unipolar motors: Often provide center-tapped windings, allowing the magnetic field to be changed without reversing current through the entire winding in the same manner as a bipolar drive.
  • Bipolar motors: Use windings whose current direction is reversed during operation, generally requiring a driver with an H-bridge for each phase.

The number of wires can help identify the configuration, but it is not the only factor. Check the manufacturer’s wiring diagram before selecting a driver.

5. Stepper Motor Specifications

Before selecting a stepper motor, review its datasheet. The following specifications help determine whether the motor is suitable for the required movement and compatible with the driver.

Specification Meaning Why it matters
Step angle Angular movement per full step Determines the number of full steps per revolution
Rated phase current Specified current for a motor winding under stated conditions Helps configure the driver’s current limit
Winding resistance Electrical resistance of a winding Helps identify winding characteristics and power dissipation
Winding inductance Opposition to changes in winding current Influences current rise and high-speed performance
Holding torque Torque the energized motor can resist while stationary Helps determine its ability to hold a load
Detent torque Residual torque present when the motor is unpowered Indicates resistance to turning with the windings unenergized
Operating speed Speed achievable under specified conditions Helps assess performance for the intended load
Frame size Physical dimensions of the motor Determines mounting and mechanical compatibility
Step Angle and Steps per Revolution

The step angle is the nominal angle through which a motor moves in one full step.

The number of full steps per revolution is calculated as:

\[ N= \]

where:

  • \(N\) is the number of full steps per revolution.
  • \(\) is the full-step angle.

For a motor with a 1.8° step angle:

\[ N==200 \]

Therefore, the motor requires 200 full steps for one theoretical revolution. With a microstepping driver, the number of commanded microsteps per revolution increases according to the selected microstepping ratio.

Rated Current and Supply Voltage

Stepper motors are commonly specified by their rated winding current. With a current-regulating driver, the current limit must be configured according to the motor’s rating and the driver’s instructions.

The motor’s rated winding voltage is not necessarily the same as the supply voltage used by a current-regulating driver. Such drivers can use a higher supply voltage while actively limiting winding current, allowing current to rise more quickly during each step. This must be done only within the motor and driver’s specified limits.

Holding Torque and Operating Speed

Holding torque describes the torque the energized motor can resist while stationary. Available torque generally decreases as stepping speed increases, and the actual performance depends on the motor, driver, supply voltage, and load.

Do not select a motor based only on its holding-torque rating. Check the torque required throughout the intended speed range, including acceleration and mechanical friction.

6. Identifying Stepper Motor Wires

Before connecting a stepper motor to a driver, identify its winding configuration. Incorrect wiring can cause vibration, irregular movement, or failure to rotate.

Four-Wire Bipolar Stepper Motor

A four-wire bipolar motor has two separate windings, each with two wires.

  • Connect one winding to driver outputs A1 and A2.
  • Connect the other winding to outputs B1 and B2.

Wire colors vary by manufacturer. With the motor disconnected from all electronics, use a multimeter in resistance mode to identify the two coil pairs. Two wires belonging to the same winding show a measurable resistance between them.

Connect each pair to one driver channel. If the motor vibrates rather than rotates, check that the wires are paired correctly and that the driver is configured properly.

Five-Wire Unipolar Stepper Motor

A common five-wire unipolar motor has a shared internal connection between its windings. Many 28BYJ-48 motors use this arrangement and are commonly paired with a ULN2003 driver board.

A five-wire motor with a shared common connection generally cannot be connected directly to a conventional bipolar driver in the same way as a four-wire motor. Use a compatible unipolar driver or a verified motor modification and compatible driver arrangement.

Six-Wire and Eight-Wire Stepper Motors

Six-wire motors typically provide winding center taps, while eight-wire motors expose individual winding sections. Depending on the motor and driver, the windings may be configured for half-coil, series, or parallel operation.

These arrangements affect resistance, inductance, current requirements, heating, and achievable step rate. Always follow the motor and driver documentation when selecting a wiring configuration.

7. Choosing a Stepper Motor Driver

A stepper motor driver switches current through the motor windings in a controlled sequence. It acts as the power interface between a microcontroller and the motor.

The appropriate driver depends on the motor’s winding configuration, rated current, supply voltage, desired speed, microstepping requirements, and thermal conditions.

ULN2003 Driver Board

The ULN2003 is a transistor-array driver commonly used with compatible five-wire unipolar stepper motors, including many 28BYJ-48 variants.

It is suitable for beginner experiments and lightweight mechanisms. It does not provide the same current-regulated bipolar control and microstepping features as modern stepper-driver ICs.

A4988 Stepper Driver

The A4988 is a bipolar stepper-driver IC commonly used on compact breakout modules. It supports STEP/DIR control, current regulation, and selectable microstepping modes.

It is often used with four-wire bipolar motors in CNC prototypes, 3D printers, and positioning projects. The module’s practical current capacity depends on the PCB design, cooling, and operating conditions.

DRV8825 Stepper Driver

The DRV8825 is another bipolar stepper-driver option that provides a STEP/DIR interface, current regulation, and microstepping support.

Compare its operating limits with those of the A4988 and with your motor’s requirements. Do not assume that all breakout modules based on the same driver IC have identical current ratings or cooling performance.

Comparing Common Driver Options
Driver Motor type Common applications Important consideration
ULN2003 Compatible unipolar motors Beginner projects and lightweight mechanisms Requires a compatible winding arrangement
A4988 Bipolar stepper motors CNC prototypes and 3D printers Current limit and cooling must be configured correctly
DRV8825 Bipolar stepper motors Motion-control projects Verify module-specific voltage, current, and thermal limits

Important: Never connect or disconnect a stepper motor while its driver is powered. This can damage the driver. Follow the manufacturer’s instructions for wiring, current-limit adjustment, and cooling.

8. Connecting a Stepper Motor to Arduino

The wiring depends on the motor and driver combination. The following examples cover a common beginner setup and a STEP/DIR driver setup.

Example A: 28BYJ-48 with a ULN2003 Board

This combination is often used in beginner projects because the motor and driver board are widely available together.

ULN2003 connection Arduino connection
IN1 Digital pin 8
IN2 Digital pin 9
IN3 Digital pin 10
IN4 Digital pin 11
VCC Suitable motor supply
GND Supply ground and Arduino GND
Motor connector Compatible 28BYJ-48 motor

Check the voltage rating of your specific motor and driver board. Many common 28BYJ-48 versions are designed for 5 V, but variants exist.

If you use an external supply, connect its ground to Arduino GND. The supply must be suitable for the motor and board.

Example B: Bipolar Motor with an A4988-Style Driver

A STEP/DIR driver simplifies the connection because it handles the winding-current sequence internally.

Driver connection Connect to
STEP Arduino digital output, for example pin 3
DIR Arduino digital output, for example pin 4
Logic supply Compatible logic voltage
Motor supply Suitable external motor supply
GND Common ground as required by the driver
A1 and A2 One motor winding
B1 and B2 The other motor winding
ENABLE, SLEEP, RESET Configure according to the module’s documentation

Pin labels and required logic states vary between modules. Check the driver documentation before applying power.

Power and Ground

The motor supply must meet the motor and driver’s requirements. The Arduino’s GPIO pins provide control signals and should not be used to supply the motor winding current.

Where the driver interface requires a common signal reference, connect the Arduino ground to the driver ground. Keep the motor supply wiring appropriate for the expected current and avoid loose connections.

9. Controlling Stepper Motor Position and Speed

Stepper motors move in discrete increments. The number of steps determines the commanded movement, while the rate of the steps determines the requested speed.

Calculating Steps for a Target Angle

For full-step operation:

\[ = \]

For example, a 1.8° stepper motor requires 50 full steps for a theoretical 90° movement:

\[ =50 \]

This assumes the motor follows every commanded step and that the mechanism introduces no additional error.

Controlling Speed

The controller adjusts speed by changing the frequency of the step commands. A higher step frequency generally increases rotational speed, but the motor must have enough torque to follow the requested rate.

If the step rate is too high, or acceleration is too abrupt, the motor may stall or miss steps. Start at a moderate rate and increase it gradually while testing the actual mechanical load.

Understanding Microstepping

Microstepping divides a full step into smaller commanded increments by regulating current in the motor windings.

For a 200-full-step motor operating at 1/8 microstepping:

\[ 200=1600 \]

This gives 1600 commanded microsteps per theoretical revolution. Microstepping can improve smoothness and reduce vibration, but it does not guarantee a proportional improvement in absolute positioning accuracy.

10. Programming a Stepper Motor with Arduino

Arduino can control a stepper motor using a suitable library or by generating control signals directly. The correct method depends on the motor and driver.

Example A: 28BYJ-48 with the Arduino Stepper Library

This example assumes a compatible 28BYJ-48 motor connected to a ULN2003 board. The motor moves one revolution in one direction, pauses, and then moves in the opposite direction.

#include <Stepper.h>

// Common approximation for some 28BYJ-48 motors
// with a typical full-step sequence.
// Verify the value for your motor and configuration.
const int stepsPerRevolution = 2048;

Stepper myStepper(
  stepsPerRevolution,
  8, 10, 9, 11
);

void setup() {
  myStepper.setSpeed(8);  // Requested speed in RPM
}

void loop() {
  myStepper.step(stepsPerRevolution);
  delay(1000);

  myStepper.step(-stepsPerRevolution);
  delay(1000);
}
Understanding the Code
  • #include <Stepper.h> loads the Arduino Stepper library.
  • stepsPerRevolution defines the assumed number of steps per revolution.
  • Stepper myStepper(...) creates the motor-control object and assigns the input pins.
  • setSpeed(8) requests a speed of 8 RPM.
  • A positive step count commands movement in one direction, while a negative count commands movement in the opposite direction.

The value 2048 is a common approximation for certain 28BYJ-48 motors and stepping sequences, not a universal value. Actual output movement depends on the motor variant, gearbox, and stepping mode. If the motor vibrates or moves erratically, check the wiring sequence and the library’s pin order.

Example B: Bipolar Motor with a STEP/DIR Driver

The following example is intended for a compatible A4988-style or similar driver. It sends step pulses and changes direction to move the motor back and forth.

const int stepPin = 3;
const int dirPin = 4;

const int stepsPerRevolution = 200;

void setup() {
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);

  digitalWrite(stepPin, LOW);
}

void moveSteps(int steps, bool clockwise) {
  digitalWrite(dirPin, clockwise ? HIGH : LOW);
  delayMicroseconds(10);

  for (int i = 0; i < steps; i++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(5);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(1000);
  }
}

void loop() {
  moveSteps(stepsPerRevolution, true);
  delay(1000);

  moveSteps(stepsPerRevolution, false);
  delay(1000);
}
Understanding STEP and DIR
  • stepPin sends pulses to advance the driver by a step or microstep.
  • dirPin selects the movement direction.
  • moveSteps() generates the requested number of pulses.
  • The delays determine the approximate step rate.
  • stepsPerRevolution = 200 assumes a 1.8° motor in full-step mode.

This example does not include acceleration ramps, limit switches, homing, or position feedback. Check the driver’s minimum pulse widths and direction setup and hold times before using the code with a specific module.

For smoother motion, use a motion-control library such as AccelStepper or implement an appropriate acceleration profile. Abrupt changes in step frequency can cause missed steps, particularly under load.

11. Using a Driver with STEP and DIR Inputs

STEP/DIR drivers are common in CNC machines, 3D printers, and positioning systems because they simplify the interface between a microcontroller and a stepper motor.

STEP Input

The STEP input receives pulses from the controller. Each accepted pulse advances the driver’s commanded position by one selected step or microstep.

The number of pulses required for one revolution depends on the motor’s full-step resolution and the driver’s microstepping setting.

DIR Input

The DIR input selects the direction of movement. The logic level associated with clockwise or counterclockwise rotation depends on the driver and motor wiring.

If the motor moves in the opposite direction from what you expect, adjust the direction logic in software or reverse one winding pair with the driver powered off.

ENABLE, SLEEP, and RESET

Some drivers include additional control pins:

  • ENABLE: Activates or disables the driver outputs, depending on the module’s logic.
  • SLEEP: Places the driver in a low-power state when supported.
  • RESET: Resets internal step-control logic on compatible drivers.
  • Microstep-selection pins: Configure the step subdivision on supported drivers.

These functions are not identical across all modules. Check the specific driver’s pinout and truth table before using them.

Setting the Current Limit

Many modern stepper drivers regulate winding current electronically. The current limit must be configured according to the motor’s winding rating and the driver’s instructions.

Do not assume that the current drawn from the power supply equals the current flowing through a motor winding. A switching driver can regulate winding current while drawing a different average current from its supply.

Incorrect current settings can cause overheating, insufficient torque, or driver damage. Follow the manufacturer’s procedure for configuring the current limit.

12. Controlling Multiple Stepper Motors

An Arduino can control multiple stepper motors if there are enough suitable driver channels and the software can generate the required signals.

Using Separate Driver Channels

Each motor normally needs its own driver channel or module. Do not connect two motors to one driver’s outputs unless the manufacturer explicitly supports that configuration and the combined electrical requirements are satisfied.

For STEP/DIR drivers, separate STEP signals allow independent movement. Direction signals may be shared when motors are intended to move together in the same direction and the driver interface supports that arrangement.

Power Supply Requirements

The supply must support the expected combined demand from the connected motors and drivers. Check the configured current limits, supply voltage, wiring, connectors, and thermal requirements.

If multiple motors accelerate simultaneously, the supply and driver system must be designed to handle the combined demand.

Coordinating Movement

For simple projects, the program can command each motor separately. More advanced applications may require synchronized motion and acceleration profiles.

For example, a two-axis CNC system must coordinate both motors to move a tool along the intended path. In such cases, use an appropriate motion-control library or controller rather than relying on long blocking delays.

13. Common Stepper Motor Applications and Projects

Stepper motors are useful when a project needs controlled incremental movement or repeatable positioning.

CNC Plotter

A small CNC plotter can use stepper motors to move a pen along two axes. The controller converts movement commands into step pulses for the X- and Y-axis drivers.

Mechanical alignment, step calibration, acceleration, and homing all affect the final positioning result.

3D Printer

Many 3D printers use stepper motors to move the print head, build platform, or filament-feeding mechanism. Drivers regulate winding current and generate the required stepping sequence.

Reliable operation depends on current settings, mechanical alignment, acceleration, and an appropriate power system.

Camera Slider

A stepper motor can move a camera along a rail at a controlled rate. A suitable motion profile helps reduce vibration and abrupt starts, which is important for smooth video recording.

Automatic Dispenser

A stepper motor can operate a screw, valve, or rotary dispenser. The controller commands a defined number of steps to dispense a repeatable amount of material.

However, open-loop step counting does not confirm that the mechanism completed the movement. If jams or missed steps could cause problems, add suitable sensors or feedback.

Rotating Platform

A stepper motor can rotate a platform to selected angles for photography, demonstrations, or sensor positioning. Use the motor’s step angle and microstepping configuration to estimate the required pulses.

If absolute angular accuracy matters, consider a home sensor, encoder, or another reference method to establish the actual position.

14. Troubleshooting and Safety Tips

Stepper motor problems are often caused by incorrect winding connections, unsuitable current settings, insufficient power, excessive acceleration, or mechanical resistance.

Problem Possible cause Recommended check
Motor vibrates but does not rotate Incorrect winding pairs or phase sequence Verify the winding pairs and driver connections
Motor does not move Missing supply, disabled driver, or incorrect signals Check power, ENABLE/SLEEP states, STEP pulses, and DIR
Motor skips steps Excessive speed or acceleration, insufficient torque, or mechanical binding Reduce speed, add acceleration ramps, and inspect the load
Motor overheats Current limit too high or excessive mechanical load Check the motor rating, current setting, and cooling
Driver overheats Excessive current or inadequate cooling Check module limits and thermal conditions
Motor moves in the wrong direction Direction logic or winding connections are reversed Adjust the DIR signal or reverse one winding pair with power off
Motor makes noise while stationary Holding current, resonance, or mechanical vibration Check current settings, mounting, and driver configuration
Position is inaccurate Missed steps, incorrect step count, or mechanical backlash Verify configuration and consider homing or feedback
Never Rewire a Powered Driver

Disconnect power before connecting, disconnecting, or rearranging motor wires. Stepper-driver outputs can be damaged by connecting or disconnecting a motor while the driver is powered.

Set the Current Limit Correctly

A stepper motor’s winding resistance may be low, so applying a supply voltage without appropriate current control can cause excessive current. Use a driver suited to the motor and follow the manufacturer’s current-limit setup procedure.

Use Acceleration Ramps

Starting immediately at a high step frequency can prevent the rotor from following the commanded sequence. Gradually increasing the stepping rate gives the motor time to follow the changing magnetic field.

The suitable acceleration depends on motor torque, load inertia, supply voltage, and driver characteristics. Test the system under realistic operating conditions.

Understand Open-Loop Positioning

In a typical open-loop system, the controller counts commanded steps but does not directly verify the shaft’s actual position. If the motor stalls or misses steps, the controller’s estimated position can differ from reality.

Homing switches provide a reference point, while encoders can provide feedback when the application requires position verification or closed-loop control.

15. Frequently Asked Questions

What Is the Difference Between a Stepper Motor and a DC Motor?

A conventional DC motor generally rotates continuously when powered. A stepper motor moves in discrete steps when its windings are energized in a controlled sequence. Stepper motors are often useful for open-loop positioning, while ordinary DC motors typically need additional feedback hardware for accurate position control.

Can I Connect a Stepper Motor Directly to Arduino?

No. A typical stepper motor requires more current than an Arduino GPIO pin can supply. Use a suitable driver between the Arduino and motor, and ensure the driver matches the motor’s winding configuration and electrical requirements.

How Do I Identify Stepper Motor Wires?

Disconnect the motor from the circuit and use a multimeter to measure resistance between wire pairs. Wires belonging to the same winding show measurable resistance between them. For motors with center taps or multiple winding sections, consult the manufacturer’s wiring diagram.

What Is the Difference Between Unipolar and Bipolar Stepper Motors?

Unipolar motors use winding arrangements that allow the magnetic field to be switched without reversing current through the entire winding in the same way as a bipolar drive. Bipolar motors reverse current through each winding and typically require an H-bridge for each phase.

What Is Microstepping?

Microstepping divides a full step into smaller commanded increments by controlling winding current. It can make movement smoother and reduce vibration, but it does not guarantee a proportional improvement in absolute positioning accuracy.

How Do I Control a Stepper Motor’s Speed?

Control speed by changing the rate at which step commands are issued. Increasing the step frequency generally increases motor speed, but the motor may miss steps if the requested rate exceeds what it can achieve under the current load. Acceleration ramps improve reliability.

Why Does My Stepper Motor Vibrate Instead of Rotating?

Common causes include incorrect winding pairs, incorrect phase sequence, insufficient current, excessive step frequency, or incorrect driver configuration. Verify the wiring first, then test at a low stepping rate and check the current settings.

Can a Stepper Motor Rotate Continuously?

Yes. A stepper motor can rotate continuously if it receives a continuing sequence of step commands and can follow them under the current operating conditions. Its speed is primarily controlled by the step rate.

Do I Need an Encoder for a Stepper Motor?

Not always. Many stepper systems use open-loop control, assuming the motor follows every commanded step. An encoder is useful when actual position or speed must be measured, particularly when missed steps could affect performance or safety.

Which Stepper Motor Driver Is Best for Beginners?

It depends on the motor. A compatible 28BYJ-48 and ULN2003 board are convenient for basic educational experiments. For four-wire bipolar motors, A4988 or DRV8825 modules are common options. Check voltage and current limits, microstepping support, cooling requirements, and manufacturer instructions before choosing a driver.

16. Conclusion

Stepper motors are widely used in robotics, CNC machines, 3D printers, and DIY automation because they provide controlled incremental movement. Understanding winding configuration, step angle, current requirements, and driver interfaces is essential for building a reliable system.

For beginners, a 28BYJ-48 motor with a compatible ULN2003 board provides a straightforward introduction to stepper control. For bipolar motors, STEP/DIR drivers such as the A4988 and DRV8825 offer a practical way to control direction, step rate, and microstepping.

Remember three key principles: identify the motor windings correctly, configure the driver’s current limit according to its documentation, and use suitable speed and acceleration settings. These practices help reduce wiring errors, overheating, vibration, and missed steps.

As you advance, you can extend your projects with multiple motors, homing switches, coordinated movement, and encoder-based feedback for more demanding motion-control applications.

 

قائمة المحتويات

  1. مقدمة
  2. ما هو محرك الخطوة (Stepper Motor)؟
  3. كيف يعمل محرك الخطوة؟
  4. أنواع محركات الخطوة
  5. المواصفات الفنية لمحرك الخطوة
  6. كيفية تحديد أسلاك محرك الخطوة
  7. اختيار درايفر محرك الخطوة
  8. توصيل محرك الخطوة بلوحة Arduino
  9. التحكم في موضع محرك الخطوة وسرعته
  10. برمجة محرك الخطوة باستخدام Arduino
  11. استخدام درايفر بمدخلي STEP وDIR
  12. التحكم في عدة محركات خطوة
  13. أشهر تطبيقات ومشروعات محركات الخطوة
  14. استكشاف الأعطال ونصائح السلامة
  15. الأسئلة الشائعة
  16. الخاتمة

مدة القراءة: 20 دقيقة.

1. مقدمة

يُعد محرك الخطوة (Stepper Motor) نوعًا من المحركات الكهربائية التي تتحرك بزيادات زاوية محددة تُعرف باسم الخطوات (Steps). فعلى عكس المحركات التي تدور باستمرار بمجرد توصيلها بمصدر الطاقة، يتحرك محرك الخطوة استجابةً لتتابع من الإشارات الكهربائية يتم التحكم فيه بدقة. وهذا يجعله مناسبًا للتطبيقات التي تتطلب حركة متكررة ودقيقة، مثل تحديد موضع ذراع روبوتية، أو تحريك أحد محاور الطابعة ثلاثية الأبعاد، أو تدوير منصة إلى زاوية محددة.

محرك الخطوة ومكوناته وتطبيقاته

تحظى محركات الخطوة بشعبية كبيرة في المشروعات الإلكترونية؛ إذ يمكن في كثير من التطبيقات التحكم في حركتها دون الحاجة إلى استخدام مشفر موضع (Encoder). يرسل المتحكم الدقيق (Microcontroller) أوامر الحركة إلى درايفر مناسب للمحرك، ويتولى الدرايفر تنشيط ملفات المحرك بالتتابع المطلوب لإنتاج الحركة.

ومع ذلك، فإن الحصول على حركة دقيقة ليس أمرًا مضمونًا تلقائيًا. فقد يؤدي التوصيل غير الصحيح، أو عدم توفير التيار الكافي، أو ضبط سرعة مرتفعة، أو وجود مقاومة ميكانيكية، أو التسارع المفاجئ إلى اهتزاز المحرك أو توقفه أو فقدانه بعض الخطوات.

في هذا الدليل، ستتعرف على طريقة عمل محركات الخطوة، وكيفية تحديد أسلاكها، واختيار الدرايفر المناسب، والتحكم في الموضع والسرعة باستخدام Arduino. كما ستساعدك الأمثلة العملية على بناء أساس قوي لتطوير مشروعات أكثر تقدمًا في مجال التحكم في الحركة.

2. ما هو محرك الخطوة (Stepper Motor)؟

محرك الخطوة (Stepper Motor) هو محرك كهربائي صُمم لتدوير عموده بزيادات صغيرة ومحددة. تؤدي كل إشارة كهربائية إلى تحريك المحرك بمقدار خطوة واحدة أو خطوة دقيقة (Microstep)، وذلك وفقًا لنوع المحرك وإعدادات الدرايفر المستخدم.

وعلى عكس محرك التيار المستمر التقليدي ذي الفرش (Brushed DC Motor)، الذي يدور عادةً بصورة مستمرة عند توصيله بمصدر طاقة، يعتمد محرك الخطوة على تنشيط ملفات معينة وفق تسلسل محدد لتوليد مجالات مغناطيسية تحرك الجزء الدوار (Rotor) من موضع إلى آخر.

التركيب الداخلي لمحرك الخطوة ومكوناته الرئيسية

المكونات الرئيسية لمحرك الخطوة

يتكون محرك الخطوة النموذجي من الأجزاء الرئيسية التالية:

  • الجزء الثابت (Stator): الجزء الذي لا يتحرك، ويحتوي على ملفات المحرك التي تولّد المجالات المغناطيسية.
  • الجزء الدوار (Rotor): الجزء المتحرك الذي يستجيب للمجالات المغناطيسية الناتجة عن ملفات الجزء الثابت.
  • الملفات أو الأطوار (Windings or Phases): ملفات كهربائية يتم تنشيطها وفق تسلسل محدد لإنتاج الحركة.
  • عمود الدوران (Shaft): الجزء الميكانيكي الذي ينقل الحركة الدورانية إلى الحمل المتصل بالمحرك.
  • المحامل (Bearings): تدعم عمود الدوران وتساعده على الحركة بسلاسة.
  • هيكل المحرك (Motor Housing): يحمي المكونات الداخلية ويوفر وسيلة التثبيت الميكانيكي.

يختلف التركيب الداخلي لمحرك الخطوة باختلاف نوعه؛ فعلى سبيل المثال، تختلف طريقة ترتيب الجزء الدوار في المحركات ذات المغناطيس الدائم عن تلك المستخدمة في المحركات الهجينة.

لماذا نستخدم محرك الخطوة؟

تُستخدم محركات الخطوة عندما يحتاج النظام إلى حركة تدريجية يمكن التحكم فيها. ففي العديد من التطبيقات، يستطيع المتحكم تقدير موضع عمود المحرك من خلال حساب عدد الخطوات التي أرسل أوامر بتنفيذها.

ومن أبرز مميزات هذه المحركات:

  • سهولة التحكم في الحركة التدريجية وتحديد الموضع.
  • إمكانية التحكم الرقمي المباشر والبسيط.
  • أداء جيد عند السرعات المنخفضة عند ضبط المحرك بصورة صحيحة.
  • توفير عزم تثبيت (Holding Torque) عند استمرار تنشيط الملفات.
  • التوافق مع العديد من المتحكمات الدقيقة وأنظمة التحكم في الحركة.

ومع ذلك، لا يضمن محرك الخطوة تنفيذ جميع الخطوات المطلوبة فعليًا. فإذا توقف المحرك أو فقد التزامنه، فقد لا يتطابق الموضع الذي يقدّره المتحكم مع الموضع الفعلي لعمود المحرك.

3. كيف يعمل محرك الخطوة؟

يدور محرك الخطوة عند تنشيط ملفاته الكهربائية وفق تسلسل معين. ويؤدي كل تغيير في المجال المغناطيسي إلى تحرك الجزء الدوار باتجاه موضع اتزان مغناطيسي جديد.

مبدأ عمل محرك الخطوة وتسلسل تنشيط الملفات

آلية الحركة الأساسية لمحرك الخطوة

يمكن تبسيط تسلسل التشغيل الأساسي للمحرك في الخطوات التالية:

  1. يرسل المتحكم أمرًا إلى درايفر المحرك.
  2. يقوم الدرايفر بتنشيط الملف أو الملفات المناسبة داخل المحرك.
  3. يتغير المجال المغناطيسي الناتج عن الملفات.
  4. يتحرك الجزء الدوار باتجاه الموضع المغناطيسي الجديد.
  5. ينتقل الدرايفر إلى المرحلة التالية من تسلسل تنشيط الملفات، فتستمر الحركة.

من خلال التحكم في عدد الخطوات، يستطيع المتحكم تقدير مقدار الحركة التي نفذها المحرك. أما التحكم في معدل إرسال أوامر الخطوات، فيحدد السرعة الدورانية المطلوبة.

ما الذي يحدد اتجاه دوران المحرك؟

يعتمد اتجاه دوران محرك الخطوة على ترتيب تنشيط ملفاته الكهربائية. فعند عكس تسلسل التنشيط، ينعكس اتجاه دوران المحرك أيضًا.

في الدرايفرات التي تستخدم مدخلي STEP وDIR، يرسل المتحكم نبضات الخطوات عبر مدخل STEP، بينما يحدد اتجاه الحركة من خلال مدخل DIR. ويتولى الدرايفر داخليًا تنفيذ تسلسل تنشيط ملفات المحرك.

تختلف الإشارة المنطقية التي تحدد الدوران مع عقارب الساعة أو عكسها حسب نوع الدرايفر وطريقة توصيل المحرك. لذلك، يُنصح باختبار اتجاه الدوران بسرعة منخفضة قبل توصيل المحرك بأي آلية ميكانيكية.

عزم التثبيت (Holding Torque)

عندما يتوقف محرك الخطوة عن الدوران، قد يستمر الدرايفر في تنشيط الملفات للمحافظة على موضع الجزء الدوار ومقاومة الحمل الخارجي. وينتج عن ذلك ما يُعرف بعزم التثبيت (Holding Torque)، لكنه يؤدي أيضًا إلى استهلاك الطاقة الكهربائية وتوليد الحرارة.

تعمل بعض الدرايفرات على تقليل التيار عند توقف المحرك، مما يساعد على خفض درجة حرارته، ولكنه يؤدي في المقابل إلى تقليل عزم التثبيت المتاح.

إذا كان التطبيق يتطلب تثبيت حمل بصورة آمنة، فلا تفترض أن المحرك سيحافظ على موضعه إلى أجل غير محدد عند انقطاع الطاقة أو في غياب نظام تغذية راجعة. يجب مراعاة طبيعة الحمل الميكانيكي، وإعدادات الدرايفر، والعواقب المحتملة لفقدان الطاقة.

4. أنواع محركات الخطوة

تختلف محركات الخطوة من حيث تركيبها الداخلي وطريقة ترتيب ملفاتها. ويساعد تحديد نوع المحرك على اختيار الدرايفر المتوافق معه وتوصيل الأسلاك بطريقة صحيحة.

أنواع محركات الخطوة المختلفة

محرك الخطوة ذو المغناطيس الدائم (Permanent-Magnet Stepper Motor)

يستخدم هذا النوع جزءًا دوارًا ممغنطًا، يصطف مع المجالات المغناطيسية التي تنتجها ملفات الجزء الثابت عند تنشيطها.

تُستخدم هذه المحركات في بعض أنظمة تحديد الموضع الصغيرة والمشروعات التعليمية. وتختلف زاوية الخطوة وطريقة التوصيل باختلاف التصميم المحدد للمحرك.

محرك الخطوة ذو الممانعة المتغيرة (Variable-Reluctance Stepper Motor)

يحتوي هذا النوع على جزء دوار مصنوع من مادة ذات نفاذية مغناطيسية عالية، وغالبًا ما يكون مزودًا بأسنان ذات أشكال محددة. ويتحرك الجزء الدوار نحو الموضع الذي يوفر أقل ممانعة مغناطيسية عندما يتم تنشيط ملفات الجزء الثابت.

ويختلف هذا التصميم عن محرك المغناطيس الدائم؛ لأن الجزء الدوار فيه لا يعتمد على مغناطيس دائم بالطريقة نفسها.

محرك الخطوة الهجين (Hybrid Stepper Motor)

يجمع محرك الخطوة الهجين بين خصائص محركات المغناطيس الدائم ومحركات الممانعة المتغيرة. ويُستخدم على نطاق واسع في معدات التحكم الرقمي بالحاسوب (CNC)، والطابعات ثلاثية الأبعاد، والروبوتات، وأنظمة تحديد الموضع.

تبلغ زاوية الخطوة الكاملة في أحد التصميمات الشائعة للمحركات الهجينة 1.8 درجة، وهو ما يعادل 200 خطوة كاملة لكل دورة. وتتوفر أيضًا محركات بزوايا خطوات مختلفة، لذلك يُنصح دائمًا بمراجعة ورقة البيانات الفنية (Datasheet) الخاصة بالمحرك.

محركات الخطوة أحادية القطب وثنائية القطب (Unipolar and Bipolar Stepper Motors)

يشير مصطلحا أحادي القطب (Unipolar) وثنائي القطب (Bipolar) إلى طريقة ترتيب ملفات المحرك وكيفية التحكم في اتجاه التيار المار خلالها.

  • محركات أحادية القطب (Unipolar Motors): تحتوي غالبًا على ملفات ذات نقطة توصيل وسطية (Center Tap)، مما يسمح بتغيير المجال المغناطيسي دون الحاجة إلى عكس اتجاه التيار خلال الملف بالكامل بالطريقة نفسها المستخدمة في قيادة المحركات ثنائية القطب.
  • محركات ثنائية القطب (Bipolar Motors): تعتمد على عكس اتجاه التيار المار في الملفات أثناء التشغيل، ولذلك تحتاج عادةً إلى درايفر يحتوي على دائرة جسر كامل (H-Bridge) لكل طور من أطوار المحرك.

يمكن أن يساعد عدد الأسلاك في تحديد تكوين المحرك، لكنه ليس العامل الوحيد الذي ينبغي الاعتماد عليه. لذلك، يجب الرجوع إلى مخطط التوصيل الصادر عن الشركة المصنعة قبل اختيار الدرايفر المناسب.

5. المواصفات الفنية لمحرك الخطوة (Stepper Motor Specifications)

قبل اختيار محرك الخطوة، من المهم مراجعة ورقة البيانات الفنية (Datasheet) الخاصة به. تساعدك المواصفات التالية على تحديد مدى ملاءمة المحرك للحركة المطلوبة، ومدى توافقه مع الدرايفر المستخدم.

المواصفات الفنية لمحرك الخطوة

المواصفة المعنى أهميتها
زاوية الخطوة (Step Angle) مقدار الإزاحة الزاوية التي ينفذها المحرك في كل خطوة كاملة. تحدد عدد الخطوات الكاملة اللازمة لإتمام دورة واحدة.
تيار الطور المقنن (Rated Phase Current) قيمة التيار المحددة لملف المحرك في ظروف التشغيل الموضحة في ورقة البيانات. تساعد في ضبط حد التيار المناسب للدرايفر.
مقاومة الملف (Winding Resistance) المقاومة الكهربائية لملف من ملفات المحرك. تساعد في تحديد خصائص الملف وفهم القدرة الكهربائية المفقودة على هيئة حرارة.
محاثة الملف (Winding Inductance) خاصية الملف التي تعارض التغير في التيار المار خلاله. تؤثر في سرعة ارتفاع التيار وأداء المحرك عند السرعات العالية.
عزم التثبيت (Holding Torque) العزم الذي يستطيع المحرك، عند تنشيط ملفاته وتوقفه عن الدوران، مقاومته. يساعد في تحديد قدرة المحرك على تثبيت الحمل في موضعه.
عزم التوقف غير المغذى (Detent Torque) العزم المتبقي الذي يظهر عند محاولة تدوير المحرك بينما تكون ملفاته غير مزودة بالطاقة. يوضح مقدار مقاومة المحرك للدوران عندما تكون الملفات غير نشطة.
سرعة التشغيل (Operating Speed) السرعة التي يمكن للمحرك الوصول إليها في ظروف تشغيل محددة. تساعد في تقييم أداء المحرك ومدى ملاءمته للحمل المطلوب.
حجم الهيكل (Frame Size) الأبعاد الميكانيكية الخارجية للمحرك. تحدد مدى توافق المحرك مع وسائل التثبيت والمساحة المتاحة في المشروع.
زاوية الخطوة وعدد الخطوات لكل دورة

زاوية الخطوة (Step Angle) هي مقدار الزاوية الاسمية التي يتحرك بها المحرك عند تنفيذ خطوة كاملة واحدة.

يمكن حساب عدد الخطوات الكاملة اللازمة لإتمام دورة واحدة باستخدام المعادلة التالية:

N = 360° / α

حيث:

  • N: عدد الخطوات الكاملة لكل دورة.
  • α: زاوية الخطوة الكاملة للمحرك بالدرجات.

على سبيل المثال، إذا كانت زاوية الخطوة للمحرك تساوي 1.8 درجة:

N = 360° / 1.8° = 200 خطوة

وبالتالي، يحتاج المحرك إلى 200 خطوة كاملة لإتمام دورة نظرية واحدة. وعند استخدام درايفر يدعم تقنية تقسيم الخطوة (Microstepping)، يزداد عدد النبضات أو الخطوات الدقيقة المطلوبة لكل دورة وفقًا لنسبة التقسيم المحددة.

التيار المقنن وجهد التغذية (Rated Current and Supply Voltage)

عادةً ما تُحدد مواصفات محركات الخطوة وفقًا للتيار المقنن المسموح بمروره في ملفاتها. وعند استخدام درايفر مزود بدائرة لتنظيم التيار، يجب ضبط حد التيار بما يتوافق مع التصنيف الكهربائي للمحرك وتعليمات الشركة المصنعة للدرايفر.

من المهم الانتباه إلى أن الجهد المقنن لملفات المحرك لا يساوي بالضرورة جهد مصدر التغذية المستخدم مع الدرايفر المزود بتنظيم التيار. إذ يمكن لبعض هذه الدرايفرات العمل بجهد تغذية أعلى مع الحد من التيار المار في الملفات إلكترونيًا، مما يسمح للتيار بالارتفاع بسرعة أكبر خلال كل خطوة.

ومع ذلك، يجب الالتزام دائمًا بحدود الجهد والتيار المحددة لكل من المحرك والدرايفر، وعدم تجاوز القيم المسموح بها في أوراق البيانات الفنية الخاصة بهما.

عزم التثبيت وسرعة التشغيل (Holding Torque and Operating Speed)

يشير عزم التثبيت (Holding Torque) إلى مقدار العزم الذي يستطيع المحرك مقاومته أثناء توقفه عن الدوران مع استمرار تنشيط ملفاته. وبشكل عام، ينخفض العزم المتاح للمحرك كلما زادت سرعة الخطوات، ويعتمد الأداء الفعلي على المحرك والدرايفر وجهد التغذية والحمل الميكانيكي.

لذلك، لا ينبغي اختيار المحرك اعتمادًا على قيمة عزم التثبيت وحدها. بل يجب التحقق من العزم المطلوب عبر نطاق السرعات المستهدف، مع مراعاة متطلبات التسارع والاحتكاك الميكانيكي أيضًا.

6. كيفية تحديد أسلاك محرك الخطوة (Identifying Stepper Motor Wires)

قبل توصيل محرك الخطوة بالدرايفر، يجب تحديد طريقة ترتيب ملفاته وتكوين أسلاكه. فقد يؤدي التوصيل غير الصحيح إلى اهتزاز المحرك أو حركته بصورة غير منتظمة أو عدم قدرته على الدوران.

طرق تحديد أسلاك وملفات محرك الخطوة

محرك خطوة ثنائي القطب بأربعة أسلاك (Four-Wire Bipolar Stepper Motor)

يحتوي محرك الخطوة ثنائي القطب ذي الأسلاك الأربعة على ملفين منفصلين، ويتكون كل ملف من سلكين.

  • يتم توصيل أحد الملفين بمخرجي الدرايفر A1 وA2.
  • يتم توصيل الملف الآخر بمخرجي الدرايفر B1 وB2.

تختلف ألوان الأسلاك من شركة مصنعة إلى أخرى. لذلك، يجب فصل المحرك تمامًا عن جميع الدوائر الإلكترونية، ثم استخدام جهاز قياس متعدد (Multimeter) مضبوط على وضع قياس المقاومة لتحديد أزواج الملفات. فالسلكان اللذان ينتميان إلى الملف نفسه تظهر بينهما قيمة مقاومة قابلة للقياس.

بعد تحديد كل زوج، يتم توصيله بقناة واحدة من قنوات خرج الدرايفر. وإذا اهتز المحرك بدلًا من الدوران، فتحقق من صحة تجميع أزواج الأسلاك ومن إعدادات الدرايفر.

محرك خطوة أحادي القطب بخمسة أسلاك (Five-Wire Unipolar Stepper Motor)

يحتوي أحد التصميمات الشائعة لمحركات الخطوة أحادية القطب ذات الأسلاك الخمسة على نقطة توصيل مشتركة داخلية تربط ملفات المحرك. وتستخدم العديد من إصدارات محرك 28BYJ-48 هذا الترتيب، وغالبًا ما يتم تشغيلها باستخدام لوحة الدرايفر ULN2003.

عادةً، لا يمكن توصيل محرك ذي خمسة أسلاك ونقطة مشتركة داخلية مباشرةً بدرايفر تقليدي مخصص للمحركات ثنائية القطب بالطريقة نفسها المستخدمة مع محرك ذي أربعة أسلاك. لذلك، يجب استخدام درايفر متوافق مع المحركات أحادية القطب، أو إجراء تعديل موثّق على المحرك مع استخدام ترتيب توصيل ودرايفر متوافقين مع هذا التعديل.

محركات الخطوة ذات الستة والثمانية أسلاك (Six-Wire and Eight-Wire Stepper Motors)

تحتوي محركات الخطوة ذات الستة أسلاك عادةً على نقاط توصيل وسطية لملفاتها (Center Taps)، بينما تتيح المحركات ذات الثمانية أسلاك الوصول إلى أقسام الملفات بشكل منفصل. وبحسب تصميم المحرك ونوع الدرايفر، يمكن ترتيب الملفات للعمل بنظام نصف الملف (Half-Coil)، أو التوصيل على التوالي (Series)، أو التوصيل على التوازي (Parallel).

تؤثر هذه الترتيبات في مقاومة الملفات ومحاثتها ومتطلبات التيار ودرجة الحرارة ومعدل الخطوات الذي يمكن تحقيقه. لذلك، يجب دائمًا اتباع تعليمات الشركة المصنعة للمحرك والدرايفر عند اختيار طريقة توصيل الملفات.

7. اختيار درايفر محرك الخطوة (Choosing a Stepper Motor Driver)

يتولى درايفر محرك الخطوة التحكم في التيار المار عبر ملفات المحرك وتبديل اتجاهه وفق تسلسل محدد. وبذلك يعمل كواجهة لتوفير الطاقة والتحكم بين المتحكم الدقيق والمحرك.

يعتمد اختيار الدرايفر المناسب على تكوين ملفات المحرك، والتيار المقنن، وجهد التغذية، والسرعة المطلوبة، ومتطلبات تقسيم الخطوة (Microstepping)، وظروف التشغيل الحرارية.

أنواع درايفرات محركات الخطوة المختلفة

لوحة الدرايفر ULN2003

يُعد ULN2003 مصفوفة من الترانزستورات تُستخدم كدرايفر، ويشيع استخدامها مع محركات الخطوة أحادية القطب المتوافقة ذات الأسلاك الخمسة، بما في ذلك العديد من إصدارات محرك 28BYJ-48.

تُعد هذه اللوحة مناسبة للتجارب التعليمية للمبتدئين والآليات الميكانيكية خفيفة الحمل. لكنها لا توفر خصائص التحكم ثنائي القطب بتنظيم التيار وتقنية تقسيم الخطوة (Microstepping) نفسها الموجودة في دوائر الدرايفر الحديثة المخصصة لمحركات الخطوة.

درايفر محرك الخطوة A4988

يُعد A4988 دائرة متكاملة مخصصة لقيادة محركات الخطوة ثنائية القطب، ويُستخدم عادةً ضمن وحدات إلكترونية صغيرة جاهزة للتوصيل (Breakout Modules). يدعم هذا الدرايفر التحكم باستخدام إشارات STEP وDIR، وتنظيم التيار، واختيار أوضاع مختلفة لتقسيم الخطوة (Microstepping).

يُستخدم هذا الدرايفر غالبًا مع محركات الخطوة ثنائية القطب ذات الأسلاك الأربعة في النماذج الأولية لماكينات CNC والطابعات ثلاثية الأبعاد ومشروعات تحديد الموضع. وتعتمد قدرة التيار العملية للوحدة على تصميم لوحة الدائرة المطبوعة (PCB)، وكفاءة التبريد، وظروف التشغيل.

درايفر محرك الخطوة DRV8825

يُعد DRV8825 خيارًا آخر لقيادة محركات الخطوة ثنائية القطب، حيث يوفر واجهة تحكم تعتمد على إشارات STEP وDIR، بالإضافة إلى تنظيم التيار ودعم تقنية تقسيم الخطوة (Microstepping).

عند الاختيار بينه وبين A4988، يجب مقارنة حدود التشغيل لكل منهما بمتطلبات المحرك المستخدم. ولا ينبغي افتراض أن جميع الوحدات التي تعتمد على الدائرة المتكاملة نفسها تمتلك تصنيفات متطابقة للتيار أو أداءً حراريًا متماثلًا.

مقارنة بين أشهر خيارات درايفرات محركات الخطوة
الدرايفر نوع المحرك التطبيقات الشائعة أهم ملاحظة
ULN2003 محركات أحادية القطب متوافقة مشروعات المبتدئين والآليات خفيفة الحمل يتطلب توافق ترتيب ملفات المحرك مع الدرايفر.
A4988 محركات خطوة ثنائية القطب نماذج CNC والطابعات ثلاثية الأبعاد يجب ضبط حد التيار والتبريد بصورة صحيحة.
DRV8825 محركات خطوة ثنائية القطب مشروعات التحكم في الحركة يجب التحقق من حدود الجهد والتيار والحرارة الخاصة بالوحدة المستخدمة.

ملاحظة مهمة: لا تقم أبدًا بتوصيل محرك الخطوة بالدرايفر أو فصله عنه أثناء وجود التغذية الكهربائية. فقد يؤدي ذلك إلى تلف الدرايفر. احرص دائمًا على اتباع تعليمات الشركة المصنعة فيما يتعلق بالتوصيلات وضبط حد التيار والتبريد.

8. توصيل محرك الخطوة بلوحة Arduino

تختلف طريقة التوصيل باختلاف نوع المحرك والدرايفر المستخدم. وفيما يلي مثالان شائعان: إعداد مناسب للمبتدئين، وإعداد آخر يعتمد على درايفر يستخدم إشارات STEP وDIR.

طرق توصيل محرك الخطوة بلوحة Arduino باستخدام الدرايفر المناسب

المثال A: توصيل محرك 28BYJ-48 بلوحة ULN2003

يُستخدم هذا التكوين كثيرًا في مشروعات المبتدئين؛ نظرًا إلى توافر محرك 28BYJ-48 ولوحة الدرايفر ULN2003 معًا في العديد من الأطقم التعليمية.

توصيل لوحة ULN2003 التوصيل بلوحة Arduino
IN1 المنفذ الرقمي 8 (Digital Pin 8)
IN2 المنفذ الرقمي 9 (Digital Pin 9)
IN3 المنفذ الرقمي 10 (Digital Pin 10)
IN4 المنفذ الرقمي 11 (Digital Pin 11)
VCC مصدر تغذية مناسب للمحرك
GND أرضي مصدر التغذية وأرضي لوحة Arduino
موصل المحرك (Motor Connector) محرك 28BYJ-48 متوافق

تحقق من قيمة جهد التشغيل المحددة لمحركك ولوحة الدرايفر المستخدمة. فالكثير من إصدارات محرك 28BYJ-48 الشائعة مصممة للعمل بجهد 5 فولت، ولكن توجد إصدارات أخرى بجهود تشغيل مختلفة.

إذا استخدمت مصدر تغذية خارجيًا، فتأكد من توصيل طرفه الأرضي (GND) مع الطرف الأرضي للوحة Arduino. كما يجب أن يكون مصدر التغذية مناسبًا لمتطلبات المحرك ولوحة الدرايفر.

المثال B: توصيل محرك ثنائي القطب باستخدام درايفر من نوع A4988

يُسهّل استخدام درايفر يعتمد على إشارات STEP وDIR عملية التوصيل؛ لأنه يتولى داخليًا تنفيذ تسلسل التحكم في التيار المار عبر ملفات المحرك.

طرف التوصيل في الدرايفر طريقة التوصيل
STEP منفذ خرج رقمي في Arduino، مثل المنفذ 3.
DIR منفذ خرج رقمي في Arduino، مثل المنفذ 4.
Logic Supply جهد تغذية منطقي متوافق مع مواصفات الدرايفر.
Motor Supply مصدر تغذية خارجي مناسب للمحرك والدرايفر.
GND أرضي مشترك حسب متطلبات الدرايفر.
A1 وA2 طرفا أحد ملفي المحرك.
B1 وB2 طرفا ملف المحرك الآخر.
ENABLE وSLEEP وRESET يتم ضبطها وفقًا لتعليمات ووثائق وحدة الدرايفر المستخدمة.

قد تختلف أسماء أطراف التوصيل والحالات المنطقية المطلوبة من وحدة إلى أخرى. لذلك، يجب مراجعة وثائق الدرايفر ومخطط أطرافه قبل توصيل مصدر الطاقة.

مصدر التغذية والأرضي (Power and Ground)

يجب أن يتوافق مصدر تغذية المحرك مع متطلبات كل من المحرك والدرايفر. وتُستخدم منافذ الإدخال والإخراج الرقمية (GPIO) في لوحة Arduino لإرسال إشارات التحكم فقط، ولا ينبغي استخدامها لتوفير التيار اللازم لتشغيل ملفات المحرك.

عندما تتطلب واجهة الدرايفر وجود مرجع كهربائي مشترك للإشارات، يجب توصيل الطرف الأرضي للوحة Arduino بالطرف الأرضي للدرايفر. كذلك، ينبغي اختيار أسلاك مصدر تغذية المحرك بما يتناسب مع التيار المتوقع، مع التأكد من إحكام جميع التوصيلات وتجنب الأطراف غير المثبتة جيدًا.

9. التحكم في موضع محرك الخطوة وسرعته (Controlling Stepper Motor Position and Speed)

تتحرك محركات الخطوة بزيادات محددة ومنفصلة. ويحدد عدد الخطوات مقدار الحركة المطلوبة، بينما يحدد معدل إرسال هذه الخطوات السرعة التي يُطلب من المحرك العمل بها.

التحكم في موضع محرك الخطوة وسرعته

حساب عدد الخطوات للوصول إلى زاوية محددة

عند تشغيل المحرك بنظام الخطوة الكاملة (Full-Step)، يمكن حساب عدد الخطوات المطلوبة للوصول إلى زاوية معينة باستخدام المعادلة التالية:

عدد الخطوات = الزاوية المطلوبة ÷ زاوية الخطوة

على سبيل المثال، يحتاج محرك زاوية خطوته 1.8 درجة إلى 50 خطوة كاملة لتنفيذ حركة نظرية مقدارها 90 درجة:

90° ÷ 1.8° = 50 خطوة

يفترض هذا الحساب أن المحرك ينفذ جميع الخطوات المطلوبة دون فقدان أي منها، وأن الآلية الميكانيكية المتصلة به لا تضيف أخطاء أخرى إلى الحركة.

التحكم في السرعة (Controlling Speed)

يتحكم المتحكم في سرعة المحرك عن طريق تغيير تردد نبضات الخطوات المرسلة إليه. وبشكل عام، يؤدي ارتفاع تردد هذه النبضات إلى زيادة سرعة الدوران، بشرط أن يكون عزم المحرك كافيًا لمتابعة معدل الخطوات المطلوب.

إذا كان معدل الخطوات مرتفعًا أكثر من اللازم، أو كان التسارع مفاجئًا، فقد يتوقف المحرك أو يفقد بعض الخطوات. لذلك، يُفضل البدء بسرعة متوسطة ثم زيادتها تدريجيًا، مع اختبار أداء المحرك تحت تأثير الحمل الميكانيكي الفعلي.

فهم تقنية تقسيم الخطوة (Microstepping)

تعتمد تقنية تقسيم الخطوة (Microstepping) على تقسيم الخطوة الكاملة إلى زيادات أصغر يمكن التحكم فيها، وذلك من خلال تنظيم التيار المار في ملفات المحرك.

على سبيل المثال، إذا كان المحرك ينفذ 200 خطوة كاملة لكل دورة، وتم ضبط الدرايفر على وضع تقسيم الخطوة بنسبة 1/8، فإن عدد الخطوات الدقيقة لكل دورة يصبح:

200 × 8 = 1600 خطوة دقيقة

وبذلك يصبح عدد أوامر الخطوات الدقيقة المطلوبة لإتمام دورة نظرية واحدة هو 1600 خطوة. ويمكن لتقنية تقسيم الخطوة تحسين سلاسة الحركة وتقليل الاهتزاز، لكنها لا تضمن زيادة دقة تحديد الموضع الفعلية بالنسبة نفسها؛ فالدقة المطلقة تعتمد أيضًا على خصائص المحرك والحمل والظروف الميكانيكية.

10. برمجة محرك الخطوة باستخدام Arduino (Programming a Stepper Motor with Arduino)

يمكن استخدام لوحة Arduino للتحكم في محرك الخطوة من خلال مكتبة برمجية مناسبة، أو عن طريق توليد إشارات التحكم مباشرةً. وتعتمد الطريقة الصحيحة على نوع المحرك والدرايفر المستخدم.

برمجة محرك الخطوة والتحكم فيه باستخدام Arduino

المثال A: تشغيل محرك 28BYJ-48 باستخدام مكتبة Stepper في Arduino

يفترض هذا المثال استخدام محرك 28BYJ-48 متوافق مع لوحة الدرايفر ULN2003. يتحرك المحرك دورة واحدة في اتجاه معين، ثم يتوقف مؤقتًا، وبعد ذلك يدور دورة أخرى في الاتجاه المعاكس.

#include <Stepper.h>

// Common approximation for some 28BYJ-48 motors
// with a typical full-step sequence.
// Verify the value for your motor and configuration.
const int stepsPerRevolution = 2048;

Stepper myStepper(
  stepsPerRevolution,
  8, 10, 9, 11
);

void setup() {
  myStepper.setSpeed(8);  // Requested speed in RPM
}

void loop() {
  myStepper.step(stepsPerRevolution);
  delay(1000);

  myStepper.step(-stepsPerRevolution);
  delay(1000);
}
شرح الكود البرمجي
  • #include <Stepper.h>: يستدعي مكتبة Stepper الخاصة بـ Arduino، والتي توفر الدوال اللازمة للتحكم في محركات الخطوة.
  • stepsPerRevolution: يحدد عدد الخطوات المفترض أن يحتاج إليها المحرك لإتمام دورة واحدة.
  • Stepper myStepper(...): ينشئ كائنًا برمجيًا للتحكم في المحرك، ويحدد عدد الخطوات لكل دورة وأرقام منافذ الإدخال المستخدمة.
  • setSpeed(8): يحدد السرعة المطلوبة للمحرك عند 8 دورات في الدقيقة (RPM).
  • عند استخدام قيمة موجبة في أمر الحركة، يدور المحرك في أحد الاتجاهين، بينما تؤدي القيمة السالبة إلى الدوران في الاتجاه المعاكس.

تُعد القيمة 2048 تقديرًا شائعًا لبعض إصدارات محرك 28BYJ-48 وعند استخدام تسلسل تشغيل معين بنظام الخطوة الكاملة، لكنها ليست قيمة ثابتة لجميع الإصدارات. إذ تعتمد الحركة الفعلية عند خرج المحرك على إصدار المحرك ونسبة علبة التروس (Gearbox) وطريقة تقسيم الخطوات المستخدمة.

إذا اهتز المحرك أو تحرك بصورة غير منتظمة، فتحقق من ترتيب توصيل الأسلاك ومن ترتيب المنافذ المحدد داخل المكتبة البرمجية.

المثال B: تشغيل محرك ثنائي القطب باستخدام درايفر STEP/DIR

يوضح المثال التالي طريقة التحكم في محرك خطوة ثنائي القطب باستخدام درايفر متوافق من نوع A4988 أو ما يشابهه. يرسل البرنامج نبضات الخطوات ويغير اتجاه الدوران لتحريك المحرك ذهابًا وإيابًا.

const int stepPin = 3;
const int dirPin = 4;

const int stepsPerRevolution = 200;

void setup() {
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);

  digitalWrite(stepPin, LOW);
}

void moveSteps(int steps, bool clockwise) {
  digitalWrite(dirPin, clockwise ? HIGH : LOW);
  delayMicroseconds(10);

  for (int i = 0; i < steps; i++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(5);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(1000);
  }
}

void loop() {
  moveSteps(stepsPerRevolution, true);
  delay(1000);

  moveSteps(stepsPerRevolution, false);
  delay(1000);
}
فهم إشارات STEP وDIR
  • stepPin: يرسل نبضات إلى الدرايفر لتحريك المحرك بمقدار خطوة أو خطوة دقيقة واحدة.
  • dirPin: يحدد اتجاه حركة المحرك.
  • moveSteps(): دالة برمجية تولّد العدد المطلوب من نبضات الخطوات.
  • فترات التأخير (Delays): تحدد معدل الخطوات التقريبي، وبالتالي تؤثر في سرعة دوران المحرك.
  • stepsPerRevolution = 200: تفترض استخدام محرك زاوية خطوته 1.8 درجة مع التشغيل بنظام الخطوة الكاملة.

لا يتضمن هذا المثال وظائف إضافية مثل منحنيات التسارع التدريجي، أو مفاتيح تحديد نهاية الحركة (Limit Switches)، أو تحديد نقطة البداية المرجعية (Homing)، أو التغذية الراجعة لتحديد الموضع. لذلك، يجب مراجعة الحد الأدنى لعرض نبضة STEP وأزمنة إعداد وتثبيت إشارة DIR المطلوبة قبل استخدام الكود مع وحدة درايفر محددة.

للحصول على حركة أكثر سلاسة، يمكن استخدام مكتبة متخصصة في التحكم بالحركة مثل AccelStepper، أو تنفيذ خوارزمية مناسبة للتسارع التدريجي. فالتغير المفاجئ في تردد نبضات الخطوات قد يؤدي إلى فقدان بعض الخطوات، خاصةً عند وجود حمل ميكانيكي.

11. استخدام درايفر بمدخلي STEP وDIR (Using a Driver with STEP and DIR Inputs)

تُستخدم الدرايفرات التي تعتمد على إشارات STEP وDIR على نطاق واسع في ماكينات التحكم الرقمي بالحاسوب (CNC)، والطابعات ثلاثية الأبعاد، وأنظمة تحديد الموضع؛ لأنها تبسط طريقة الاتصال والتحكم بين المتحكم الدقيق ومحرك الخطوة.

درايفر محرك خطوة بمدخلي STEP وDIR وأطراف التحكم الإضافية

مدخل STEP

يستقبل مدخل STEP نبضات التحكم المرسلة من المتحكم. وتؤدي كل نبضة مقبولة إلى تحريك الموضع المطلوب للمحرك بمقدار خطوة واحدة أو خطوة دقيقة، وفقًا لإعدادات الدرايفر.

يعتمد عدد النبضات المطلوبة لإتمام دورة واحدة على عدد الخطوات الكاملة للمحرك لكل دورة، بالإضافة إلى إعداد تقسيم الخطوة (Microstepping) المحدد في الدرايفر.

مدخل DIR

يحدد مدخل DIR اتجاه حركة المحرك. وتعتمد الحالة المنطقية التي تمثل الدوران مع عقارب الساعة أو عكسها على نوع الدرايفر وطريقة توصيل ملفات المحرك.

إذا تحرك المحرك في الاتجاه المعاكس للاتجاه المتوقع، فيمكن تعديل منطق إشارة الاتجاه داخل البرنامج، أو عكس توصيل أحد أزواج الملفات بعد فصل الطاقة عن الدرايفر تمامًا.

أطراف ENABLE وSLEEP وRESET

تحتوي بعض الدرايفرات على أطراف تحكم إضافية، من أهمها:

  • ENABLE: يُستخدم لتفعيل أو تعطيل مخارج الدرايفر، وفقًا للمنطق المستخدم في الوحدة.
  • SLEEP: يضع الدرايفر في وضع استهلاك منخفض للطاقة، إذا كانت هذه الخاصية مدعومة.
  • RESET: يعيد ضبط منطق التحكم الداخلي في الخطوات في الدرايفرات المتوافقة.
  • أطراف اختيار تقسيم الخطوة (Microstep Selection Pins): تُستخدم لتحديد نسبة تقسيم الخطوة في الدرايفرات التي تدعم هذه الخاصية.

لا تعمل هذه الأطراف بالطريقة نفسها في جميع وحدات الدرايفر. لذلك، يجب مراجعة مخطط أطراف التوصيل (Pinout) وجدول الحالات المنطقية (Truth Table) الخاص بالوحدة المستخدمة قبل توصيلها.

ضبط حد التيار (Setting the Current Limit)

تعمل العديد من درايفرات محركات الخطوة الحديثة على تنظيم التيار المار في الملفات إلكترونيًا. ويجب ضبط حد التيار بما يتوافق مع التيار المقنن لملفات المحرك وتعليمات الشركة المصنعة للدرايفر.

لا تفترض أن التيار المسحوب من مصدر التغذية يساوي التيار المار داخل أحد ملفات المحرك. فالدرايفر الذي يعتمد على التبديل الإلكتروني (Switching Driver) يستطيع تنظيم تيار الملفات مع سحب متوسط تيار مختلف من مصدر التغذية.

قد يؤدي ضبط التيار بطريقة غير صحيحة إلى ارتفاع درجة حرارة المحرك أو انخفاض العزم المتاح أو تلف الدرايفر. لذلك، اتبع دائمًا الإجراء الذي تحدده الشركة المصنعة لضبط حد التيار.

12. التحكم في عدة محركات خطوة (Controlling Multiple Stepper Motors)

يمكن استخدام لوحة Arduino للتحكم في عدة محركات خطوة، بشرط توفر عدد كافٍ من قنوات الدرايفر المناسبة، وقدرة البرنامج على توليد إشارات التحكم المطلوبة لكل محرك.

التحكم في عدة محركات خطوة باستخدام Arduino ودرايفرات منفصلة

استخدام قنوات درايفر منفصلة (Using Separate Driver Channels)

يحتاج كل محرك عادةً إلى قناة درايفر مستقلة أو وحدة درايفر خاصة به. ولا ينبغي توصيل محركين بمخارج درايفر واحد، إلا إذا كانت الشركة المصنعة تدعم هذا التكوين بشكل صريح، وكانت المتطلبات الكهربائية الإجمالية متوافقة مع حدود الدرايفر.

عند استخدام درايفرات STEP/DIR، تسمح إشارات STEP المنفصلة بالتحكم المستقل في حركة كل محرك. أما إشارات DIR، فيمكن مشاركتها بين المحركات عندما يكون المطلوب تحريكها معًا في الاتجاه نفسه، بشرط أن تدعم واجهة الدرايفر هذا الترتيب.

متطلبات مصدر التغذية (Power Supply Requirements)

يجب أن يكون مصدر التغذية قادرًا على توفير الطاقة اللازمة لتشغيل جميع المحركات والدرايفرات المتصلة بالنظام. لذلك، يجب مراعاة حدود التيار المضبوطة، وجهد التغذية، ومقاسات الأسلاك والموصلات، ومتطلبات التبريد.

إذا تسارعت عدة محركات في الوقت نفسه، فيجب تصميم مصدر التغذية ونظام الدرايفرات بحيث يتحملان الطلب الكهربائي الإجمالي الناتج عن تشغيلها معًا.

تنسيق الحركة بين المحركات (Coordinating Movement)

في المشروعات البسيطة، يمكن للبرنامج إرسال أوامر الحركة إلى كل محرك بصورة منفصلة. أما التطبيقات الأكثر تقدمًا، فقد تتطلب تنسيق الحركة بين المحركات ومزامنة ملفات التسارع والتباطؤ.

على سبيل المثال، يحتاج نظام CNC ذي المحورين إلى تنسيق حركة المحركين معًا لتحريك أداة التشغيل على المسار المطلوب. وفي مثل هذه الحالات، يُفضل استخدام مكتبة متخصصة في التحكم بالحركة أو وحدة تحكم مناسبة، بدلًا من الاعتماد على فترات تأخير طويلة تؤدي إلى إيقاف تنفيذ بقية مهام البرنامج أثناء الحركة.

13. أشهر تطبيقات ومشروعات محركات الخطوة (Common Stepper Motor Applications and Projects)

تُعد محركات الخطوة خيارًا مناسبًا للعديد من المشروعات التي تتطلب حركة تدريجية يمكن التحكم فيها أو تحديد مواضع متكررة بدقة.

تطبيقات ومشروعات محركات الخطوة

راسم الرسومات باستخدام CNC (CNC Plotter)

يمكن استخدام محركات الخطوة في جهاز رسم صغير يعمل بتقنية التحكم الرقمي بالحاسوب (CNC)، حيث تتولى تحريك قلم الرسم على محورين. ويقوم المتحكم بتحويل أوامر الحركة إلى نبضات خطوات تُرسل إلى درايفري المحورين X وY.

وتؤثر عدة عوامل في دقة تحديد الموضع النهائي، من أهمها المحاذاة الميكانيكية، ومعايرة عدد الخطوات، وإعدادات التسارع، وتحديد نقطة البداية المرجعية (Homing).

الطابعة ثلاثية الأبعاد (3D Printer)

تستخدم العديد من الطابعات ثلاثية الأبعاد محركات الخطوة لتحريك رأس الطباعة أو منصة البناء أو آلية تغذية الخيوط البلاستيكية (Filament). وتتولى الدرايفرات تنظيم التيار المار في الملفات وتوليد تسلسل الخطوات المطلوب.

ويعتمد التشغيل الموثوق للطابعة على ضبط التيار بصورة صحيحة، والمحاذاة الميكانيكية، وإعدادات التسارع، واستخدام نظام تغذية كهربائية مناسب.

منصة تحريك الكاميرا (Camera Slider)

يمكن استخدام محرك الخطوة لتحريك الكاميرا على مسار خطي بسرعة يمكن التحكم فيها. ويساعد اختيار منحنى حركة مناسب على تقليل الاهتزاز والبدايات المفاجئة، وهو أمر مهم للحصول على تسجيل فيديو سلس ومستقر.

جهاز التوزيع الآلي (Automatic Dispenser)

يمكن استخدام محرك الخطوة لتشغيل لولب ميكانيكي أو صمام أو آلية توزيع دوارة. ويرسل المتحكم عددًا محددًا من أوامر الخطوات بهدف توزيع كمية متكررة من مادة معينة.

ومع ذلك، فإن الاعتماد على حساب الخطوات في نظام تحكم مفتوح الحلقة (Open-Loop) لا يؤكد أن الآلية قد أكملت الحركة المطلوبة بالفعل. فإذا كان حدوث انسداد أو فقدان بعض الخطوات قد يؤدي إلى مشكلات في التشغيل، فمن الأفضل إضافة مستشعرات مناسبة أو نظام تغذية راجعة للتحقق من الحركة.

منصة دوارة (Rotating Platform)

يمكن استخدام محرك الخطوة لتدوير منصة إلى زوايا محددة، وذلك في تطبيقات التصوير الفوتوغرافي أو العروض التوضيحية أو تحديد موضع المستشعرات. ويمكن تقدير عدد النبضات المطلوبة بالاعتماد على زاوية خطوة المحرك وإعدادات تقسيم الخطوة (Microstepping).

إذا كان التطبيق يتطلب دقة زاوية مطلقة، فيُنصح باستخدام مستشعر لتحديد نقطة البداية (Home Sensor)، أو مشفر موضع (Encoder)، أو وسيلة مرجعية أخرى لتحديد الموضع الفعلي للمنصة.

14. استكشاف الأعطال ونصائح السلامة (Troubleshooting and Safety Tips)

غالبًا ما تنتج مشكلات محركات الخطوة عن التوصيل غير الصحيح للملفات، أو ضبط التيار بصورة غير مناسبة، أو عدم كفاية مصدر التغذية، أو التسارع المفرط، أو وجود مقاومة ميكانيكية تعوق الحركة.

استكشاف أعطال محركات الخطوة ونصائح السلامة

المشكلة السبب المحتمل الفحص أو الحل المقترح
المحرك يهتز لكنه لا يدور. تحديد أزواج الملفات بصورة خاطئة أو عدم صحة تسلسل تنشيط الأطوار. تحقق من أزواج الملفات ومن صحة توصيلها بالدرايفر.
المحرك لا يتحرك. عدم وجود مصدر تغذية، أو تعطيل الدرايفر، أو إرسال إشارات تحكم غير صحيحة. افحص مصدر الطاقة وحالات ENABLE وSLEEP ونبضات STEP وإشارة DIR.
المحرك يفقد بعض الخطوات. ارتفاع السرعة أو التسارع أكثر من اللازم، أو عدم كفاية العزم، أو وجود عائق ميكانيكي. قلل السرعة، واستخدم تسارعًا تدريجيًا، وافحص الحمل الميكانيكي.
ارتفاع درجة حرارة المحرك. ضبط حد التيار على قيمة مرتفعة جدًا أو وجود حمل ميكانيكي زائد. تحقق من تصنيف المحرك وإعداد التيار وكفاءة التبريد.
ارتفاع درجة حرارة الدرايفر. مرور تيار أكبر من المسموح أو عدم كفاية التبريد. تحقق من حدود تشغيل الوحدة وظروفها الحرارية.
المحرك يدور في الاتجاه المعاكس للمطلوب. عكس منطق إشارة الاتجاه أو توصيل الملفات بصورة معكوسة. عدّل إشارة DIR أو اعكس توصيل أحد أزواج الملفات بعد فصل الطاقة.
صدور ضوضاء من المحرك أثناء توقفه. تيار التثبيت أو ظاهرة الرنين أو الاهتزاز الميكانيكي. افحص إعدادات التيار وطريقة التثبيت وإعدادات الدرايفر.
عدم دقة الموضع. فقدان الخطوات أو خطأ في عدد الخطوات أو وجود خلوص ميكانيكي (Backlash). تحقق من إعدادات النظام، وفكر في استخدام تحديد نقطة البداية أو التغذية الراجعة.
لا تعِد توصيل الأسلاك أثناء تشغيل الدرايفر (Never Rewire a Powered Driver)

افصل مصدر التغذية الكهربائية قبل توصيل أسلاك المحرك أو فصلها أو تغيير ترتيبها. فقد تتعرض مخارج درايفر محرك الخطوة للتلف إذا تم توصيل المحرك أو فصله بينما يكون الدرايفر قيد التشغيل.

اضبط حد التيار بصورة صحيحة (Set the Current Limit Correctly)

قد تكون مقاومة ملفات محرك الخطوة منخفضة، ولذلك فإن تطبيق جهد التغذية مباشرةً دون وجود وسيلة مناسبة لتنظيم التيار قد يؤدي إلى مرور تيار مرتفع بصورة مفرطة.

استخدم درايفر متوافقًا مع المحرك، واتبع إجراءات الشركة المصنعة لضبط حد التيار. فالإعداد الصحيح يساعد على حماية ملفات المحرك والدرايفر من ارتفاع الحرارة أو التلف.

استخدم منحنيات التسارع التدريجي (Use Acceleration Ramps)

قد يؤدي البدء مباشرةً بتردد مرتفع لنبضات الخطوات إلى عدم قدرة الجزء الدوار على متابعة تسلسل الحركة المطلوب. أما زيادة معدل الخطوات تدريجيًا، فتمنح المحرك الوقت الكافي لمتابعة التغير في المجال المغناطيسي.

يعتمد معدل التسارع المناسب على عزم المحرك وقصور الحمل الذاتي وجهد التغذية وخصائص الدرايفر. لذلك، يجب اختبار النظام في ظروف تشغيل واقعية تماثل ظروف الاستخدام الفعلي.

فهم تحديد الموضع بنظام الحلقة المفتوحة (Understand Open-Loop Positioning)

في أنظمة التحكم مفتوحة الحلقة (Open-Loop)، يقوم المتحكم عادةً بحساب عدد الخطوات التي أصدر أوامر بتنفيذها، لكنه لا يتحقق مباشرةً من الموضع الفعلي لعمود المحرك. فإذا توقف المحرك أو فقد بعض الخطوات، فقد يختلف الموضع الذي يقدّره المتحكم عن الموضع الحقيقي.

توفر مفاتيح تحديد نقطة البداية (Homing Switches) نقطة مرجعية يمكن الاعتماد عليها لبدء الحركة، بينما توفر مشفرات الموضع (Encoders) تغذية راجعة يمكن استخدامها عندما يتطلب التطبيق التحقق من الموضع أو استخدام نظام تحكم مغلق الحلقة (Closed-Loop Control).

15. الأسئلة الشائعة (Frequently Asked Questions)

ما الفرق بين محرك الخطوة ومحرك التيار المستمر (DC Motor)؟

يدور محرك التيار المستمر التقليدي عادةً بصورة مستمرة عند توصيله بمصدر الطاقة، بينما يتحرك محرك الخطوة بزيادات زاوية محددة عند تنشيط ملفاته وفق تسلسل كهربائي يتم التحكم فيه.

تُعد محركات الخطوة مناسبة في كثير من التطبيقات التي تتطلب تحديد الموضع باستخدام نظام تحكم مفتوح الحلقة، بينما تحتاج محركات التيار المستمر العادية عادةً إلى مكونات إضافية للتغذية الراجعة إذا كان التطبيق يتطلب تحكمًا دقيقًا في الموضع.

هل يمكن توصيل محرك الخطوة مباشرةً بلوحة Arduino؟

لا. يحتاج محرك الخطوة عادةً إلى تيار أكبر مما يمكن أن يوفره أحد منافذ الإدخال والإخراج الرقمية (GPIO) في لوحة Arduino. لذلك، يجب استخدام درايفر مناسب بين اللوحة والمحرك، مع التأكد من توافق الدرايفر مع ترتيب ملفات المحرك ومتطلباته الكهربائية.

كيف يمكن تحديد أسلاك محرك الخطوة؟

افصل المحرك عن الدائرة الإلكترونية، ثم استخدم جهاز قياس متعدد (Multimeter) لقياس المقاومة بين أزواج الأسلاك المختلفة. فالسلكان اللذان ينتميان إلى الملف نفسه تظهر بينهما مقاومة قابلة للقياس.

أما المحركات التي تحتوي على نقاط توصيل وسطية أو عدة أقسام للملفات، فيُفضل الرجوع إلى مخطط التوصيل الصادر عن الشركة المصنعة لتحديد ترتيب الأسلاك بصورة صحيحة.

ما الفرق بين محركات الخطوة أحادية القطب وثنائية القطب (Unipolar and Bipolar)؟

تعتمد محركات الخطوة أحادية القطب على ترتيب للملفات يسمح بتغيير المجال المغناطيسي دون عكس اتجاه التيار خلال الملف بالكامل بالطريقة نفسها المستخدمة في المحركات ثنائية القطب.

أما المحركات ثنائية القطب، فيتم فيها عكس اتجاه التيار المار عبر كل ملف أثناء التشغيل، ولذلك تحتاج عادةً إلى دائرة جسر كامل (H-Bridge) لكل طور من أطوار المحرك.

ما المقصود بتقنية تقسيم الخطوة (Microstepping)؟

تقنية تقسيم الخطوة هي طريقة لتقسيم الخطوة الكاملة إلى زيادات أصغر يتم التحكم فيها عن طريق تنظيم التيار المار في ملفات المحرك. ويمكن أن تساعد هذه التقنية على جعل الحركة أكثر سلاسة وتقليل الاهتزاز، لكنها لا تضمن تحسنًا متناسبًا في دقة تحديد الموضع المطلقة.

كيف يمكن التحكم في سرعة محرك الخطوة؟

يتم التحكم في سرعة محرك الخطوة عن طريق تغيير معدل إرسال أوامر الخطوات إليه. فزيادة تردد نبضات الخطوات تؤدي عمومًا إلى زيادة سرعة المحرك، ولكن قد يفقد المحرك بعض الخطوات إذا تجاوز المعدل المطلوب قدرته على الحركة تحت تأثير الحمل الحالي.

ويساعد استخدام منحنيات التسارع التدريجي على تحسين موثوقية التشغيل وتقليل احتمالية فقدان الخطوات.

لماذا يهتز محرك الخطوة بدلًا من الدوران؟

تشمل الأسباب الشائعة لهذه المشكلة التوصيل غير الصحيح لأزواج الملفات، أو عدم صحة تسلسل تنشيط الأطوار، أو عدم كفاية التيار، أو ارتفاع تردد الخطوات أكثر من اللازم، أو وجود إعدادات غير صحيحة للدرايفر.

ابدأ بالتحقق من توصيل الأسلاك، ثم اختبر المحرك بمعدل خطوات منخفض، وتأكد من ضبط التيار بصورة مناسبة.

هل يمكن لمحرك الخطوة الدوران بشكل مستمر؟

نعم، يمكن لمحرك الخطوة الاستمرار في الدوران عند تلقيه تسلسلًا مستمرًا من أوامر الخطوات، بشرط أن يكون قادرًا على متابعة هذه الأوامر في ظل ظروف التشغيل والحمل الميكانيكي الحاليين. وتعتمد سرعة دورانه بصورة أساسية على معدل نبضات الخطوات المرسلة إليه.

هل أحتاج إلى مشفر موضع (Encoder) مع محرك الخطوة؟

ليس بالضرورة. إذ تعتمد العديد من أنظمة محركات الخطوة على التحكم مفتوح الحلقة (Open-Loop)، مع افتراض أن المحرك ينفذ جميع الخطوات المطلوبة. ولكن يصبح استخدام مشفر الموضع مفيدًا عندما يحتاج النظام إلى قياس الموضع الفعلي أو السرعة الفعلية، خاصةً في التطبيقات التي قد يؤثر فيها فقدان الخطوات على الأداء أو السلامة.

ما أفضل درايفر لمحرك الخطوة بالنسبة للمبتدئين؟

يعتمد اختيار الدرايفر على نوع المحرك المستخدم. فمحرك 28BYJ-48 المتوافق مع لوحة ULN2003 يُعد خيارًا مناسبًا للتجارب التعليمية والمشروعات الأساسية.

أما المحركات ثنائية القطب ذات الأسلاك الأربعة، فتُعد وحدات A4988 وDRV8825 من الخيارات الشائعة. وقبل اختيار الدرايفر، يجب التحقق من حدود الجهد والتيار، ودعم تقسيم الخطوة (Microstepping)، ومتطلبات التبريد، وتعليمات الشركة المصنعة.

16. الخاتمة (Conclusion)

تُستخدم محركات الخطوة على نطاق واسع في الروبوتات، وماكينات CNC، والطابعات ثلاثية الأبعاد، ومشروعات الأتمتة المنزلية والهوايات الإلكترونية؛ نظرًا لقدرتها على توفير حركة تدريجية يمكن التحكم فيها. ويُعد فهم ترتيب ملفات المحرك، وزاوية الخطوة، ومتطلبات التيار، وواجهات الدرايفر أمرًا أساسيًا لبناء نظام موثوق للتحكم في الحركة.

محرك الخطوة وتطبيقاته في أنظمة التحكم في الحركة

بالنسبة للمبتدئين، يوفر محرك 28BYJ-48 مع لوحة ULN2003 المتوافقة معه نقطة بداية سهلة لفهم أساسيات التحكم في محركات الخطوة. أما عند استخدام المحركات ثنائية القطب، فتقدم الدرايفرات التي تعتمد على إشارات STEP وDIR، مثل A4988 وDRV8825، وسيلة عملية للتحكم في اتجاه الحركة ومعدل الخطوات وتقسيمها إلى خطوات دقيقة.

تذكر ثلاثة مبادئ أساسية: تحديد ملفات المحرك بصورة صحيحة، وضبط حد التيار في الدرايفر وفقًا لتعليمات الشركة المصنعة، واستخدام إعدادات مناسبة للسرعة والتسارع. تساعد هذه الممارسات على تقليل أخطاء التوصيل وارتفاع درجة الحرارة والاهتزاز وفقدان الخطوات.

ومع اكتساب المزيد من الخبرة، يمكنك تطوير مشروعاتك بإضافة محركات متعددة، ومفاتيح تحديد نقطة البداية (Homing Switches)، وتنسيق الحركة بين المحاور، واستخدام التغذية الراجعة المعتمدة على مشفرات الموضع (Encoders) لتنفيذ تطبيقات أكثر تقدمًا في مجال التحكم في الحركة.

Leave a comment