A comprehensive stepper motor control system featuring an ESP32-based controller with serial command interface and a professional desktop GUI application. Perfect for CNC machines, 3D printers, robotics, and automation projects.
- ESP32 Microcontroller with TB6600 stepper driver compatibility
- High Precision Control with microstepping support (up to 1/32 step)
- Flexible Configuration for steps per revolution, speed, and acceleration
- Safe Operation with emergency stop and controlled deceleration
- Cross-Platform Python/PyQt6 application (Windows, macOS, Linux)
- Real-time Monitoring with comprehensive serial monitor
- Intuitive Controls for both absolute and relative positioning
- Professional Interface with grouped controls and status display
- Absolute Positioning - Move to specific step positions
- Relative Movement - Move by revolutions with decimal precision
- Continuous Rotation - Run at constant speed in either direction
- Homing & Zeroing - Return to home position or set current position as zero
- ESP32 Development Board
- TB6600 Stepper Motor Driver
- NEMA 17 or similar stepper motor
- 12-24V Power Supply for motor
- Jumper wires and connectors
ESP32 β TB6600
GPIO13 β PUL+ (Step Pulse)
GPIO14 β DIR+ (Direction)
GND β PUL- & DIR- (Common Ground)
Motor Power:
- TB6600 VCC: 12-24V DC
- TB6600 GND: Power supply ground
- A+, A-: Stepper motor coil A
- B+, B-: Stepper motor coil B
- Install Arduino IDE with ESP32 support
- Install required libraries:
AccelStepperby Mike McCauley
- Upload
firmware.inoto your ESP32 - Open Serial Monitor at 115200 baud to verify operation
# Install required Python packages
pip install pyserial pyqt6
# Run the application
python gui.py- Connect Hardware: Wire ESP32 to TB6600 and power up
- Launch GUI: Run
gui.pyto start the control application - Establish Connection: Select COM port and click "Connect"
- Configure Motor: Set steps per revolution (default: 1600 for 1/8 microstepping)
- Start Controlling: Use movement controls to operate the motor
- Revolutions: Move by exact revolutions (supports decimals)
- Absolute Position: Move to specific step count
- Continuous Run: Constant speed operation
- Quick Buttons: Pre-set movements (1, 10 revolutions)
- βΈ STOP: Controlled stop with deceleration
- π E-STOP: Immediate emergency stop
- π Home: Return to zero position
- β Zero: Set current position as new zero
Stepper-Controller-with-TB6600-Driver/
β
βββ firmware.ino # ESP32 main controller firmware
βββ first_test.ino # Basic test and verification sketch
βββ gui.py # Python desktop control application
βββ README.md # This file
The ESP32 firmware implements a simple text-based protocol:
P<steps>- Set steps per revolutionV<speed>- Set maximum speed (steps/sec)A<accel>- Set acceleration (steps/secΒ²)
M<steps>- Move to absolute positionR<revolutions>- Move by revolutionsC<speed>- Continuous run at speed
X- Stop with decelerationE- Emergency stopG- Go home (position 0)Z- Set current position as zeroS- Show statusHor?- Show help
- Full step: 200 steps/rev
- 1/2 step: 400 steps/rev
- 1/4 step: 800 steps/rev
- 1/8 step: 1600 steps/rev (default)
- 1/16 step: 3200 steps/rev
- Max Speed: 5000-20000 steps/sec (depending on motor)
- Acceleration: 1000-5000 steps/secΒ² for smooth operation
- Microstepping: Higher values for smoother movement, lower for more torque
-
Motor not moving
- Check power supply to TB6600
- Verify DIR/PUL connections
- Confirm enable pin settings on TB6600
-
Wrong direction
- Use
stepper.setPinsInverted(false, true, false)to invert direction - Swap motor coil wires A+/- or B+/-
- Use
-
Serial connection fails
- Check COM port selection
- Verify baud rate (115200)
- Ensure no other program is using the serial port
-
Motor stalling or missing steps
- Reduce maximum speed
- Increase acceleration time
- Check power supply voltage and current
Contributions are welcome! Please feel free to submit pull requests or open issues for:
- Bug fixes
- New features
- Documentation improvements
- Performance enhancements
This project is licensed under the MIT License - see the LICENSE file for details.
- AccelStepper Library by Mike McCauley for robust stepper control
- PyQt6 Team for the excellent GUI framework
- ESP32 Community for comprehensive documentation and support
β If this project helped you, please consider giving it a star on GitHub!
For questions and support, please open an issue on the GitHub repository.