Skip to main content

ZDT stepper motor control library

Project description

Quick Start

This is a Python library for controlling the closed-loop stepper motor controller from ZDT via UART serial connection. It includes all the documented commands from the spec sheet, and handles all parameters in a type-safe manner. It can also be extended with additional functionality, CAN communication, and can be modified for other serial controller devices. Fully tested and compatible with Python 3.10 and above.

Installation

pip install zdt_stepper

Basic Example

from serial import Serial
from stepper.commands.move import Enable, Move
from stepper.stepper_core.parameters import DeviceParams, PositionParams
from stepper.stepper_core.configs import (
    Address, Direction, Speed,
    Acceleration, PulseCount, AbsoluteFlag
)

# Connect to motor
serial = Serial("COM4", 115200, timeout=0.1)
device = DeviceParams(
    serial_connection=serial,
    address=Address(0x01)
)

# Enable motor
Enable(device=device).status
# Configure movement
params = PositionParams(
    direction=Direction.CW,
    speed=Speed(500),
    acceleration=Acceleration(127),
    pulse_count=PulseCount(160),
    absolute=AbsoluteFlag.RELATIVE
)

# Move motor
Move(device=device, params=params).status

# Move to absolute position
params.absolute = AbsoluteFlag.ABSOLUTE
Move(device=device, params=params).status

Features

  • Motor control (enable/disable, move, jog, e-stop)
  • Homing and calibration
  • Real-time status monitoring
  • Configuration management
  • PID tuning
  • Error handling

Status Monitoring

from stepper.commands.get import GetSysStatus

status = GetSysStatus(device=device).raw_data.data_dict
print(status)

Configuration

from src.stepper.commands.set import SetConfig
from src.stepper.stepper_constants import Microstep, StallTime

config = GetConfig(device=device).raw_data
config.microstep = Microstep(value=32)
config.stall_time = StallTime(value=100)
SetConfig(device=device, params=config).status

Development

# Install dev dependencies
pip install zdt_stepper[dev]

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zdt_stepper-0.1.0.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zdt_stepper-0.1.0-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

Details for the file zdt_stepper-0.1.0.tar.gz.

File metadata

  • Download URL: zdt_stepper-0.1.0.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.14

File hashes

Hashes for zdt_stepper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51aedfc1a1243f622929cb15b3627eddc30a8e8954d56838f223525e1974f335
MD5 48152b03e2410bc65c78bda0d133c82f
BLAKE2b-256 55a87b8abf492bc8d816c30e09ff38e6e139294f9cdbbb4bc7d812feade40883

See more details on using hashes here.

File details

Details for the file zdt_stepper-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zdt_stepper-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.14

File hashes

Hashes for zdt_stepper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9f530e29eba333b1d606fed761db3bf920655540f75e89a6662a84775db5260
MD5 abe063e4bd660873deb50db11197ce96
BLAKE2b-256 ae866de80067cd92ce90538551b6d889aaa2f242b55b73ab0f42ee8a60889869

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page