Documentation Index
Fetch the complete documentation index at: https://learn.pcbcupid.com/llms.txt
Use this file to discover all available pages before exploring further.
Stepper Motor
Overview
Stepper motors allow precise control of angular position, speed, and acceleration. The DRV8825 stepper driver module provides an easy interface to control bipolar stepper motors via simple digital signals (STEP and DIR). Stepper Motor A stepper motor is a type of electric motor that moves in precise, small steps instead of spinning continuously like a regular motor.- Each step rotates the motor by a fixed angle (called step angle).
- You can control position, speed, and direction very accurately.
- No need for feedback sensors (in most basic systems).
- Multiple electromagnets (coils) arranged around a central rotor.
- When you energize coils in a specific sequence, the magnetic field causes the rotor to move one “step” at a time.
- STEP: Each pulse advances motor by one microstep.
- DIR: Sets direction of rotation (HIGH = one direction, LOW = opposite).
- ENABLE: Enables or disables motor coils (LOW = enable, HIGH = disable).
- Microstep Pins (MS1, MS2, MS3): Select microstepping resolution.
- VMOT & GND: Power supply for the motor.
Pin Configuration
- STEP: GPIO 18
- DIR : GPIO 15
- ENABLE : GPIO 20 (OPTIONAL)
- VMOT: External Motor Power
- GND : External Motor Power
- GND (Logic) : GND (GLYPH BOARD)
- SLP : 5V SUPPLY (GLYPH BOARD)
- RST : 5V SUPPLY(GLYPH BOARD)
- Common approach in DRV8825 modules.
- Keeps both active together.
Key Features
- Accurate Stepper Motor Control
- Adjustable Speed via DelayMicroseconds
- Direction Control
- Enable/Disable Motor Driver
- Compatible with GLYPH-C6 (ESP32-C6)
Application
- Precision motion control systems
- Positioning and alignment mechanisms
- Robotics and automation projects
- CNC machines and engraving systems
- 3D printers and fabrication devices
- Smart home motorized appliances Conveyor and material handling systems Camera sliders and pan-tilt systems Automatic feeders and dispensing units Valve and actuator control systems Industrial control applications IoT-based remote motor control projects
Step 1: Hardware Required
- GLYPH-C6 Board (ESP32-C6)
- DRV8825 Stepper Motor Driver Module
- Bipolar Stepper Motor (e.g., NEMA 17)
- External Motor Power Supply (12V recommended)
Step 2: Circuit Diagram
Step 3: Code Setup
- Open Arduino IDE.
- Make sure to install the library
- Copy and paste the following code into the Arduino IDE:
Step 4: Upload the Code
- Connect the Board
- Connect your GLYPH board to your computer
- Select the Board and Port
Tools > Board > esp32 > Pcbcupid GLYPH C6
Tools > Portand select the port connected to your GLYPH.Tools > USB CDC on Boot >Enabled
-
Upload the Code
- Click the upload button (➡️ icon) or use the shortcut
CRTL + Uin Arduino IDE to upload the code to the board.
- Click the upload button (➡️ icon) or use the shortcut
Step 5: Observe the Output
- The stepper motor rotates clockwise and counterclockwise.
- Serial Monitor will display rotation direction and steps.
- Adjust delayMicroseconds() for speed tuning.
- Modify stepsPerRevolution to match your motor & microstepping settings.