Skip to content

mvalancy/motor-ui-ddsm115-220

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DDSM115/210 Motor Control GUI

A complete GUI application for controlling DDSM115 and DDSM210 servo motors with automatic motor type detection.

Motor Control Python License

πŸ“Έ Screenshots

Connection Interface

Connection Setup
Auto-detects motors and serial ports

Motor Control Interface

Motor Control
Velocity, current, and position control

About Interface

System Information
Diagnostics and system details

✨ Features

  • Dual Motor Support: Full support for both DDSM115 and DDSM210 motors
  • Automatic Detection: Automatically detects motor type and configures interface
  • Smart Control: Adaptive control based on motor capabilities
    • DDSM115: Velocity, current, and position control modes
    • DDSM210: Velocity control with heartbeat monitoring
  • Real-time Monitoring: Live status updates and graphing
  • Safety Features: Emergency stop, communication monitoring, heartbeat system
  • User-friendly Interface: Clean 3-tab interface with intuitive controls
  • Touch-friendly Design: Large buttons and sliders optimized for touch screens
  • Diagnostic Tools: Built-in motor testing and diagnostic functions

πŸ”§ Hardware Requirements

  • Motors:
    • DDSM115 Direct Drive Servo Motor (Waveshare) - Full position/velocity/current control
    • DDSM210 Direct Drive Servo Motor (Waveshare) - Velocity control only
  • Interface:
    • DDSM115: USB to RS485 adapter (typically /dev/ttyUSB*)
    • DDSM210: Direct USB connection (typically /dev/ttyACM*)
  • Power:
    • DDSM115: 12-24V DC supply (18V recommended)
    • DDSM210: 24V DC supply
  • Computer: Any computer with USB port running Python 3.8+

πŸš€ Quick Start

Simple Start (Recommended)

  1. Download all files to a folder

  2. Run the unified launcher:

    chmod +x start.sh
    ./start.sh
    • Automatically handles first-time setup
    • Creates virtual environment if needed
    • Installs dependencies automatically
    • Launches the application
  3. Connect your hardware:

    • Connect motor to 12-24V power supply
    • Connect USB-RS485 adapter between computer and motor
    • Power on the motor

Alternative Installation Methods

Manual Setup:

# Install dependencies manually
pip install pyserial matplotlib numpy
python3 src/ddsm115_gui.py

Development Setup:

# Use existing setup scripts
chmod +x scripts/setup.sh
./scripts/setup.sh

πŸ“± Using the Application

1. Connection

  • Select your USB-RS485 port (usually /dev/ttyUSB0 or /dev/ttyACM0)
  • Click Connect
  • Motors will be auto-detected and displayed

2. Control Modes

DDSM115 Control Modes:

πŸƒ Velocity Control:

  • Range: -143 to 143 RPM
  • Good for continuous rotation applications

⚑ Current Control:

  • Range: -8A to 8A
  • Direct torque control

πŸ“ Position Control:

  • Range: 0Β° to 360Β°
  • Precise positioning with holding

DDSM210 Control Modes:

πŸƒ Velocity Control Only:

  • Range: -210 to 210 RPM
  • Built-in heartbeat monitoring when idle
  • Position and current controls disabled (motor limitation)

3. Safety Features

πŸ›‘ Emergency Stop:

  • Immediately stops motor
  • Halts all motor commands
  • Switches to safe velocity mode

πŸ“Š Real-time Monitoring:

  • Adjustable scan rate (50ms - 5000ms)
  • Live position, velocity, torque display
  • Temperature monitoring

βš™οΈ Configuration

Serial Settings

  • Baudrate: 115200 (default, don't change)
  • Timeout: 200ms
  • Protocol: Custom 10-byte with CRC8

Motor Settings

  • DDSM115: Motors use IDs 1-10 (auto-detected), multiple motors supported
  • DDSM210: Fixed motor ID 1 (motor ID selection disabled)
  • Automatic motor type detection and interface adaptation

πŸ” Troubleshooting

Connection Issues

❌ No serial ports found
β†’ Check USB-RS485 adapter is connected
β†’ Check driver installation

❌ Connection failed
β†’ Try different port (/dev/ttyUSB0, /dev/ttyACM0)
β†’ Check motor power supply
β†’ Verify RS485 wiring

Motor Not Responding

❌ No motors detected
β†’ Check motor power (12-24V)
β†’ Verify RS485 connections (A+, B-, GND)
β†’ Try manual ID scan in Connection tab

❌ Motor doesn't move
β†’ Check emergency stop isn't active
β†’ Verify motor is enabled
β†’ Check error codes in monitoring tab

Performance Issues

❌ Slow updates
β†’ Reduce monitoring interval to 100-200ms
β†’ Disable unnecessary logging

❌ Commands not working
β†’ Check motor is in correct mode
β†’ Use emergency stop and try again
β†’ Check communication status in Connection tab

πŸ“‹ System Requirements

Minimum Requirements

  • OS: Windows 10, macOS 10.14, or Linux (Ubuntu 18.04+)
  • Python: 3.8 or higher
  • RAM: 100MB
  • Disk: 50MB

Dependencies

  • pyserial>=3.5 (for RS485 communication)
  • Standard Python libraries (tkinter, threading, etc.)

Tested Platforms

  • βœ… Ubuntu 20.04/22.04 (x64)
  • βœ… Windows 10/11 (x64)
  • βœ… macOS 11+ (Intel/Apple Silicon)
  • βœ… Raspberry Pi OS (ARM)

πŸ” Safety Notes

⚠️ Important Safety Information:

  • Always use emergency stop if motor behaves unexpectedly
  • Ensure adequate power supply (minimum 2A at 18V)
  • Check connections before powering on
  • Motor can generate significant torque - secure mounting
  • Use appropriate fusing/protection in power circuit

πŸ“ Project Structure

ddsm115-motor-control/
β”œβ”€β”€ start.sh              # Unified launcher (handles setup & launch)
β”œβ”€β”€ requirements.txt      # Python dependencies
β”œβ”€β”€ README.md            # This documentation
β”œβ”€β”€ .gitignore           # Git ignore rules
β”œβ”€β”€ src/                 # Source code
β”‚   β”œβ”€β”€ ddsm115.py           # DDSM115 motor control library
β”‚   β”œβ”€β”€ ddsm210.py           # DDSM210 motor control library
β”‚   β”œβ”€β”€ ddsm115_gui.py       # GUI application (supports both motors)
β”‚   β”œβ”€β”€ example_cli.py       # Command-line example
β”‚   β”œβ”€β”€ motor_diagnostic.py  # Diagnostic tools
β”‚   β”œβ”€β”€ motor_command_queue.py # Command queue system with auto-detection
β”‚   └── gui_diagnostic.py    # GUI diagnostic tools
β”œβ”€β”€ tests/               # Test suite
β”‚   β”œβ”€β”€ test_*.py            # Unit tests
β”‚   └── stress_test_gui.py   # Stress testing
β”œβ”€β”€ scripts/             # Development scripts
β”‚   β”œβ”€β”€ setup.sh             # Development setup
β”‚   β”œβ”€β”€ install.sh           # Installation script
β”‚   β”œβ”€β”€ run.sh              # Run script
β”‚   └── setup.py            # Python setup
β”œβ”€β”€ docs/                # Documentation
└── ddsm115-portable/    # Generated portable installation

πŸ”§ Library Usage (Without GUI)

Basic Example (DDSM115)

from src.ddsm115 import DDSM115

# Create motor controller
motor = DDSM115(port="/dev/ttyUSB0")

# Connect
if motor.connect():
    # Find motors
    motors = motor.scan_motors()
    
    # Control motor
    motor_id = motors[0]
    motor.set_velocity(motor_id, 100)  # 100 RPM
    
    # Get feedback
    feedback = motor.request_feedback(motor_id)
    print(f"Position: {feedback.position}Β°")
    
    # Stop and disconnect
    motor.emergency_stop(motor_id)
    motor.disconnect()

Basic Example (DDSM210)

from src.ddsm210 import DDSM210

# Create motor controller
motor = DDSM210(port="/dev/ttyACM0")

# Connect
if motor.connect():
    # DDSM210 always uses motor ID 1
    motor.set_velocity(1, 150)  # 150 RPM
    
    # Get feedback (includes heartbeat when idle)
    feedback = motor.request_feedback(1)
    print(f"Velocity: {feedback.velocity} RPM")
    
    # Stop and disconnect
    motor.set_velocity(1, 0)
    motor.disconnect()

Auto-Detection Example (Recommended)

from src.motor_command_queue import MotorCommandQueue

# Auto-detect motor type
motor_queue = MotorCommandQueue(port="auto")  # Will detect port and motor type

if motor_queue.connect():
    motor_type = motor_queue.get_motor_type()
    print(f"Detected: {motor_type.upper()}")
    
    # Control works regardless of motor type
    motor_queue.set_velocity(1, 100)
    motor_queue.disconnect()

Advanced Example with Callbacks

from src.ddsm115 import DDSM115, MotorFeedback

def on_feedback(motor_id: int, feedback: MotorFeedback):
    print(f"Motor {motor_id}: {feedback.position:.1f}Β°")

motor = DDSM115()
motor.on_feedback = on_feedback
motor.connect()

# Start automatic monitoring
motor.start_monitoring([1, 2, 3], interval=0.1)

🀝 Support

Getting Help

  1. Check the troubleshooting section above
  2. Run the debug script: python3 debug_modes.py
  3. Check the connection log in the GUI
  4. Verify hardware connections

Common Solutions

  • Port permission issues (Linux): sudo usermod -a -G dialout $USER
  • Driver issues (Windows): Install CH340/FTDI drivers
  • Python/tkinter missing: Install python3-tk package

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

The MIT License is a permissive free software license that allows you to:

  • βœ… Use the software for any purpose
  • βœ… Modify and distribute the software
  • βœ… Include it in proprietary software
  • βœ… Sell copies of the software

The only requirement is including the copyright notice and license text in copies.

πŸ”— Related Documentation


Quick Start Summary:

  1. Install Python 3.8+
  2. Run: chmod +x start.sh && ./start.sh
  3. Connect motor hardware
  4. Click "Connect" in the GUI and start controlling!

About

A touch-friendly GUI application for controlling DDSM115 & DDSM210 servo motors with real-time monitoring, automated command queuing, and rich documentation viewers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors