Skip to main content

A Python library for interfacing with the MKS Servo42C closed-loop stepper.

Project description

pyservo42c

This is a library for interfacing to the MKS Servo42C closed-loop stepper motor via UART.

See https://github.com/makerbase-mks/MKS-SERVO42C for details on the hardware.

Note the serial protocol spec claims to include a checksum at the end of response messages. This doesn't seem to be true in practice. Also the set-angle command only accepts two bytes in the "pulse number" field, not the four bytes the spec claims.

Many of the commands are implemented, but not all. Pull requests encouraged!

Modules

servo42c

This provides methods that generate and consume byte arrays for commanding the servo and interpreting results.

servo42cTCPUartBridge

This wraps servo42c and provides an interface to a UART-over-TCP bridge, used for testing.

servo42cUart

This wraps servo42c and provides a direct interface to a UART port.

Implementation notes

TCP UART

For fun, and to avoid trying to map to a windows COM port from WSL, I used an ESP32 running esphome and esphome-stream-server. This gives you a wireless UART port over wifi! Works great.

Raspberry Pi

I tested this interface on an Raspberry Pi 3, but it should work on basically anything. I used raspi-config to enable the /dev/ttyS0 UART port and used pins 6, 8 and 10 for GND, TX and RX.

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

pyservo42c-0.2.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

pyservo42c-0.2.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file pyservo42c-0.2.1.tar.gz.

File metadata

  • Download URL: pyservo42c-0.2.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pyservo42c-0.2.1.tar.gz
Algorithm Hash digest
SHA256 9162ce8dc8969c2caa993d785ce1a7e48ac948c5e1184a64b900915b9afe46e7
MD5 ea416eca02ec633928c4dbe714787547
BLAKE2b-256 a6a97a0e34992b6f4359aa5d73e38c5d44d8b49a15093d53464393b7d9f23fb3

See more details on using hashes here.

File details

Details for the file pyservo42c-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pyservo42c-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pyservo42c-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ea9ef54948398a83545803099b84741b5f340e1100c367c98478fad45f6f8e5e
MD5 0cc666c11c7211582e077d3089c2d5e4
BLAKE2b-256 447f2f0044eced774c703a7d16eef6f669970a468bd343ee012207cf66b72307

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