Skip to content

ozarrai/lkmotor_driver_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LK Motor Web Control Panel

A modern, responsive web interface for testing and monitoring LK Motor drivers via RS485.

Features

  • 🎨 Modern Dark Theme - Sleek, responsive design optimized for all devices
  • 📊 Real-time Monitoring - Live metrics and charts updated every second
  • ⚙️ Complete Motion Control - All 8 motion control commands with intuitive UI
  • 📈 Live Charts - Real-time visualization of encoder, torque, speed, and angles
  • 🔧 Full Protocol Support - Implements all 27 commands from RS485 Protocol V2.35

Installation

  1. Install dependencies:
pip install -r requirements.txt

Configuration

Edit app.py to configure your motor connection:

MOTOR_CONFIG = {
    'port': 'COM20',      # Change to your serial port
    'motor_id': 1,        # Motor ID (1-32)
    'baudrate': 115200    # Baud rate
}

Usage

  1. Start the web server:
python app.py
  1. Open your browser to:
http://localhost:5000

Web Interface Layout

Header

  • Motor model and firmware version
  • Real-time connection status
  • Temperature, voltage, and error status

Left Panel - Controls

  • Basic Controls: Motor ON/OFF, Stop, Clear Error
  • Motion Control:
    • Torque Control (MF/MH/MG series)
    • Speed Control
    • Multi-loop Angle Control (with/without speed limit)
    • Single-loop Angle Control (with/without speed limit)
    • Increment Angle Control (with/without speed limit)
  • Position Controls: Clear multi-angle, Set zero position

Right Panel - Monitoring

  • Real-time Metrics: 9 live metric cards showing:

    • Temperature, Voltage, Speed
    • Torque/Power, Encoder Position, RPM
    • Motor State, Multi-loop Angle, Single-loop Angle
  • Live Charts: 5 real-time charts:

    • Encoder Value
    • Torque Current
    • Speed (dps)
    • Single-loop Angle
    • Multi-loop Angle

API Endpoints

Status

  • GET /api/status - Get current motor status
  • GET /api/telemetry - Get telemetry data for charts

Motor Control

  • POST /api/motor/on - Turn motor on
  • POST /api/motor/off - Turn motor off
  • POST /api/motor/stop - Stop motor
  • POST /api/motor/clear-error - Clear errors

Motion Control

  • POST /api/motion/torque - Torque control
  • POST /api/motion/speed - Speed control
  • POST /api/motion/multi-angle-1 - Multi-angle control 1
  • POST /api/motion/multi-angle-2 - Multi-angle control 2
  • POST /api/motion/single-angle-1 - Single-angle control 1
  • POST /api/motion/single-angle-2 - Single-angle control 2
  • POST /api/motion/increment-angle-1 - Increment angle 1
  • POST /api/motion/increment-angle-2 - Increment angle 2

Position Control

  • POST /api/position/clear-multi-angle - Clear multi-loop angle
  • POST /api/position/write-zero-ram - Set zero to RAM

Technology Stack

  • Backend: Flask (Python)
  • Frontend: HTML5, CSS3, JavaScript
  • Charts: Chart.js
  • Motor Driver: Custom RS485 driver implementation

Notes

  • All motion control commands include TX/RX logging in the server console
  • Telemetry data is stored for the last 100 data points
  • Updates occur every 500ms for optimal performance
  • The interface is fully responsive and works on desktop, tablet, and mobile

License

Proprietary - LK Motor RS485 Protocol V2.35

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published