Grablo Help Grablo Help
  • User Manual
  • Tips
  • News
  • Go to
    • Grablo Home
    • Grablo App
  • 한국어
Grablo Help Grablo Help
문의하기
Grablo Help Grablo Help
  • User Manual
  • Tips
  • News
  • Go to
    • Grablo Home
    • Grablo App
  • 한국어
loading
  1. Home
  2. User Manuals
  3. I/O Device
  4. Stepper Motor Control
Updated on August 11, 2025

User Manuals

  • Folder icon closed Folder open iconQuick Start Guide
    • Grablo!
    • Basic Concepts
  • Folder icon closed Folder open iconProject
    • General
    • Sharing Project
  • Folder icon closed Folder open iconLogic
    • Logic
    • Control Group
    • Control
    • Condition Group
    • Action Group
    • Condition
      • General
      • Type
        • Always Met
        • Once Met
        • Variable Comparison
        • Schedule
        • Time Range
        • Time Interval
        • Condition Reference
        • Action Reference
        • Change Detection
        • Custom Condition
    • Action
      • General
      • Type
        • Write Variable
        • I/O Device Control
        • Time Delay
        • Timer
        • Display Image
        • Play Media
        • Synthesizer
        • Audio Recording
        • Audio Transform
        • Shell Command
        • Speech-to-Text
        • Text-to-Speech
        • File System
        • Read/Write File
        • Database
        • HTTP Communication
        • MQTT Communication
        • OPC UA Communication
        • Modbus Communication
        • Send Email
        • Telegram Message
        • User Defined Communication
        • PID Control
        • Statistics
        • Collection
        • Custom Action
  • Folder icon closed Folder open iconDashboard
    • General
    • Widgets
  • Folder icon closed Folder open iconSetting
    • GPIO
    • Variables
    • I/O Device
    • File Editor
    • Collection
    • Timer
    • Image Viewer
    • Audio Transfrom
    • Media Player
    • Synthesizer
    • Text-to-Speech
    • Speech-to-Text
    • Audio Recorder
    • MQTT Client
    • OPC UA Client
    • Modbus
    • Email Client
    • Telegram Bot
    • Database
    • User Defined Communication
    • PID Control
    • Statistics
  • Folder icon closed Folder open iconI/O Device
    • DS18B20 Digital Temperature Sensor
    • MAX31865 RTD Temperature Sensor
    • TinyGPS++ GPS Library
    • BMP180 Digital Pressure and Temperature Sensor
    • AHTx0 Temperature and Humidity Sensor
    • SHT2x Temperature and Humidity Sensor
    • Servo Motor Control
    • PWM Signal Output
    • PWM Signal Monitoring
    • Hardware PWM Signal Output
    • LED Control
    • Push Button Input
    • Digital I/O
    • Stepper Motor Control
    • High Speed Counter
    • ADS1x15 ADC
    • ADXL345 3-Axis Accelerometer
    • BME280 Temperature, Humidity, Pressure Sensor
    • BMP280 Temperature, Pressure Sensor
    • MLX90614 Infrared Temperature Sensor
    • MCP4725 DAC
    • QMC5883L 3-Axis Magnetometer
    • SHT31 Digital Temperature and Humidity Sensor
    • TCS34725 RGB Color Sensor
    • VEML6070 UV Sensor
    • BH1750 Digital Light Intensity Sensor
    • DS3231 RTC High-Precision Real-Time Clock
    • MPU-9250 9-Axis IMU Sensor
    • CCS811 Carbon Dioxide and TVOC Air Quality Sensor
    • VL53L0X ToF Laser Distance Sensor
    • TFmini Plus(S) LiDAR Distance Sensor
    • MAX7219 8-Digit 7-Segment Display
    • PCF8574 LCD Display Driver
    • HC-SR04 Ultrasonic Distance Sensor
    • LED Brightness Control
    • RGB LED Color Control
    • DC Motor Control
    • AT24C256 EEPROM Memory
    • DHTxx Temperature and Humidity Sensor
    • MCP3xxx ADC
    • LCD Display Driver (MCP23008, MCP23017)
    • MFRC522 RFID Reader
    • Passive Buzzer
    • NeoPixel (WS281x) LED
    • Infrared (IR) Receiver
    • NeoPixel Matrix
    • ST77xx TFT Color LCD
    • ILI9341 TFT Color LCD
    • SSD1306 0.96-inch Monochrome OLED Display
    • SH1106 1.3-inch Monochrome OLED Display
    • MAX7219 8×8 LED Dot Matrix
    • HT16K33 4-Digit 7-Segment Display
    • HX711 Load Cell 24-bit AD Converter
    • TCS3200 RGB Color Sensor
    • MPU6050 6-Axis Gyro Accelerometer
    • TM1637 4-Digit 7-Segment Display
    • PM2008(M) Particulate Matter Sensor
    • PMS x003 Particulate Matter Sensor
    • MAX30102 SpO2 and Heart Rate Sensor
    • AS608, FPM10A Fingerprint Sensor
    • TTP229 Capacitive 16-Key Touch Keypad
    • 4×4 Keypad Matrix
    • Analog to Digital Converter (ADC)
    • Digital to Analog Converter (DAC)
    • RPM Monitor
    • PCA9685 16-Channel 12-Bit PWM Servo Driver
    • INA219 DC Current Sensor
    • VL6180X ToF Distance Sensor
    • Custom Digital Waveform Output
    • NRF24L01 2.4GHz RF Module
  • Folder icon closed Folder open iconBlock Coding
    • General
    • Blocks
      • Values
      • Logic
      • Loop
      • Math
      • Date/Time
      • Text
      • Byte Array
      • List
      • Type Conversion
      • Unit Conversion
      • Science
      • Bit/Byte
      • Complex Numbers/Vectors
      • JSON
      • XML
      • Local Variables
      • Local Functions
  • Folder icon closed Folder open iconConnect & Run
    • Hardware and Operating System
    • Grablo Package Installation
    • Connect and Run

Stepper Motor Control

Estimated reading: 6 minutes 256 views

Overview

Also known as step motor, this type of motor rotates by a fixed angle for each input pulse, making it suitable for precise position control or angle control. Multiple motors can be operated simultaneously, and each motor can be configured with continuous rotation or standby operations. Smooth motion can be achieved using acceleration and deceleration.


Supported GPIO
  • Raspberry Pi 0~4


Stepper motors are driven through drivers. The driver types and representative models are described below:

Type Description Models
1 Pulse

• STEP(PUL): Pulse input
• DIR: Forward/reverse rotation input

A4988, DRV8825, TB6600, A3967, etc.
2 Pulse

• CW: Clockwise pulse input
• CCW: Counter-clockwise pulse input

DCM8027, DCM8054, MD2/5 series, etc.
4 Pulse

• IN1: Pulse 1 input
• IN2: Pulse 2 input
• IN3: Pulse 3 input
• IN4: Pulse 4 input

L298N, L293D, ULN2003, etc.
Select an appropriate motor driver that matches the stepper motor’s type, voltage, and current requirements.

​

Commands

[INIT]

Configures initial settings for the stepper motor.

Item Type Description
Driver Type WRITE Select the stepper motor driver type (1 pulse, 2 pulse, 4 pulse).
Steps per Revolution WRITE Enter the number of steps required for one complete revolution of the stepper motor.

​

Driver Type: 1 pulse (STEP/DIR) Selected

Item Type Description
STEP/PUL Pin WRITE Enter the GPIO pin to connect to the driver’s STEP/PUL.
DIR Pin WRITE Enter the GPIO pin to connect to the driver’s DIR.


Driver Type: 2 pulse (CW/CCW) Selected

Item Type Description
CW Pin WRITE Enter the GPIO pin to connect to the driver’s CW.
CCW Pin WRITE Enter the GPIO pin to connect to the driver’s CCW.


Driver Type: 4 pulse (IN1~IN4) Selected

Item Type Description
IN1 Pin WRITE Enter the GPIO pin to connect to the driver’s IN1.
IN2 Pin WRITE Enter the GPIO pin to connect to the driver’s IN2.
IN3 Pin WRITE Enter the GPIO pin to connect to the driver’s IN3.
IN4 Pin WRITE Enter the GPIO pin to connect to the driver’s IN4.
Excitation Mode * WRITE Select the excitation mode (Full step, Half step).
* Half step mode uses twice as many pulses per revolution compared to full step mode, enabling more precise control. For example, the 28BYJ-48 stepper motor requires 2048 pulses for one revolution in full step mode and 4096 pulses in half step mode.

​

Item Type Description
Pulse Generation Time(ms) * WRITE Set the time interval for generating output pulses (Advanced).
Sync Control Group WRITE Set the group number this motor belongs to when using synchronized control.
* Stepper motors generate output pulses repeatedly at the pulse generation time interval. Default is 50ms, minimum is 10ms, maximum is 1000ms. If different values are used for multiple stepper motors, the largest value is used as the reference.

If the Raspberry Pi specifications are low or many tasks are running simultaneously, stepper motor rotation may become intermittent rather than continuous. Increasing the pulse generation time can resolve this issue.

However, response speed for motor start, stop, pause, and restart becomes slower as this value increases. For example, if pulse generation time is 1000ms (1 second), it may take up to 1 second for the stepper motor to actually stop after a stop command.
Therefore, for applications requiring fast response, set this value to the minimum 10ms, use a high-performance Raspberry Pi, and minimize concurrent tasks.


[ADD_MOTION]

Adds a rotation motion to the stepper motor buffer. The motor rotates with the target speed and rotation amount (revolutions or pulses), and can start and stop smoothly using acceleration and deceleration. This command can be combined with ADD_DELAY to configure multiple rotation or standby operations to execute consecutively.

Item Type Description
Speed (rpm) WRITE Enter the stepper motor’s revolutions per minute (rpm).
Rotation Unit WRITE Select rotation unit (Steps, Revolutions, Position, Continuous).
Steps 1 WRITE Enter the number of steps to rotate. Negative values rotate in opposite direction.
Revolutions 2 WRITE Enter the number of revolutions to rotate. Negative values rotate in opposite direction.
Position 3 WRITE Enter the target position to move to.
Direction 4 WRITE Select rotation direction (Forward, Reverse).
Acceleration (rpm/s) 5 WRITE Enter acceleration when starting rotation (speed increase per second).
Deceleration (rpm/s) 5 WRITE Enter deceleration when ending rotation (speed decrease per second).
1 Displayed only when rotation unit is “Steps”.
2 Displayed only when rotation unit is “Revolutions”.
3 Displayed only when rotation unit is “Position”.
4 Displayed only when rotation unit is “Continuous”.
5 For example, if starting from standstill with target rotation speed of 60 rpm and acceleration/deceleration of 60 rpm/s, the motor will smoothly accelerate from 0→60rpm over 1 second when starting and smoothly decelerate from 60→0rpm over 1 second when stopping.

​

[ADD_DELAY]

Adds a standby operation to the stepper motor buffer. The motor will remain stationary for the set time duration. This command can be combined with ADD_MOTION to configure multiple rotation or standby operations to execute consecutively.

Item Type Description
Delay Time WRITE Enter the time for the stepper motor to wait in stationary state.

​

[RUN]

Operates the stepper motor according to the rotation (ADD_MOTION) or standby (ADD_DELAY) operations stored in the buffer. Below is an operation example.

1. When executing rotation operations consecutively, acceleration or deceleration is automatically calculated considering the speed difference from the previous rotation operation.


[STOP]

Stops the stepper motor.

​

[PAUSE]

Pauses the stepper motor.

​

[RESUME]

Resumes the stepper motor.

​

[CLEAR]

Clears and initializes the stepper motor buffer.

​

[RUN_SYNC]

Operates multiple stepper motors in synchronized motion mode. Use this when precise timing control of multiple stepper motors is required. If a motor completes its operation first, it must wait until all other motors complete their operations.

Item Type Description
Group Number WRITE Enter the stepper motor group number to operate in synchronized mode.


Below is an example of operating two stepper motors in synchronized control mode.

1. Start operation simultaneously.
2. Motors that complete their operation first wait until all other motors finish.
3. Synchronized control is completed.

​

[STOP_ALL]

Stops all running stepper motors.

​

[PAUSE_ALL]

Pauses all running stepper motors.

​

[RESUME_ALL]

Resumes all paused stepper motors.

​

[CLEAR_ALL]

Clears and initializes buffers for all stepper motors.

​

[SET_POSITION]

Sets the stepper motor’s current position to the entered value.

Item Type Description
Position WRITE Enter the value to set as current position (e.g., set to origin → 0).

​

[GET_POSITION]

Reads the stepper motor’s current position.

Item Type Description
Position READ Current position of the stepper motor.

​

[GET_STATUS]

Reads the stepper motor’s current status.

Item Type Description
Status READ Current status of the stepper motor (0: Stopped, 1: Paused, 2: Running).

​

[EMG_STOP]

Immediately performs emergency stop for all running stepper motors.



Example

Objective

When clicking the dashboard button widget, operate the stepper motor according to the motion profile below. Must include acceleration and deceleration during rotation start and stop.

  • 3 revolutions clockwise
  • 1 second delay
  • 3 revolutions counter-clockwise


Parts
Part Quantity
Raspberry Pi 4 1
28BYJ-48 Stepper Motor 1
ULN2003 Driver 1
5V DC Power Supply 1


Wiring

Connect each component to the corresponding connection as listed in each row below.

5V DC Power ** Driver GPIO
​ IN1 23 *
​ IN2 24 *
​ IN3 25 *
​ IN4 8 *
+ + (5~12V) ​
– – GND
* All GPIO pins can be used.
** Use an appropriate external DC power supply that matches the stepper motor’s type, voltage, and current consumption.



Project Link

찾으시는 내용이 없나요? 문의하기

문의하기

공유하기

Stepper Motor Control

Or copy link

Clipboard Icon
콘탠츠

ㅤ

Grablo Inc.
support@grablo.co

Site Links

  • Grablo Home
  • Grablo App

이 사이트의 모든 컨텐츠는 저작권법에 보호받는 저작물로서, 무단으로 복제, 배포하는 경우에는 저작권법에 의하여 처벌을 받을 수 있습니다. Copyright 2024 grablo.co. All Rights Reserved.