Raspberry PI Stepper Driver for CL57T
This is a library to drive a stepper motor with a CL57T stepper driver and a Raspberry Pi.
This code is still experimental, so use it on your own risk.
This library is programmed in pure Python. The performance of Python is not good enough to drive the motor with high speed. So if you move the motor with high speed and this library the motor will lose steps.
This library is a fork of cl57t-raspberry-pi-stepper-drive. Please check out this repo for more context.
the Documentation of the CL57T can be found here:
CL57T - Datsheet
The code is also available on PyPI.
Installation
Installation with PIP
pip3 install cl57t-raspberry-pi-stepper-drive
Wiring
| Pin CL57T | connect to | Function |
|---|---|---|
| COM,ENA-, DIR-, PUL- | GND of Raspberry Pi | GND for VDD and Signals |
| ALM | GPIO 26 (pin 37) | receive an error signal from stepper driver |
| ENA | GPIO 19 (pin 35) | enable the motor output |
| DIR | GPIO 13 (pin 33) | set the direction of the motor |
| PUL/STEP | GPIO 6 (pin 31) | moves the motor one step per pulse |
| HOMING_SENSOR | GPIO 5 (pin 29) | optional, used for homing the stepper |
The GPIO pins can be specific when initiating the class.
Sample Code
#pylint: disable=wildcard-import
#pylint: disable=unused-wildcard-import
#pylint: disable=unused-import
#pylint: disable=duplicate-code
"""
test file for testing basic movement
"""
from cl57t_raspberry_pi_stepper_drive.CL57TStepperDriver import *
print("---")
print("SCRIPT START")
print("---")
# Pinout
# GPIO 26 (pin 37): ALM
# GPIO 19 (pin 35): ENA
# GPIO 13 (pin 33): DIR
# GPIO 6 (pin 31): PUL/STEP
# GPIO 5 (pin 29): HOMING_SENSOR
#-----------------------------------------------------------------------
# initiate the CL57T class
# use your pins for pin_en, pin_step, pin_dir here
#-----------------------------------------------------------------------
stepper = CL57TStepperDriver(
pin_en=19, # GPIO 19 (pin 35): ENA
pin_step=6, # GPIO 6 (pin 31): PUL/STEP
pin_dir=13, # GPIO 13 (pin 33): DIR
pin_homing_sensor=5, # GPIO 2 (pin 29): HOMING_SENSOR
microstepping_resolution=1600,
gearwheel_diameter_mm=56, # HTD 36 5M 09
loglevel=Loglevel.DEBUG,
)
#-----------------------------------------------------------------------
# set the loglevel of the libary (currently only printed)
# set whether the movement should be relative or absolute
# both optional
#-----------------------------------------------------------------------
stepper.cl57t_logger.set_loglevel(Loglevel.DEBUG)
stepper.set_movement_abs_rel(MovementAbsRel.ABSOLUTE)
print("---\n---")
#-----------------------------------------------------------------------
# activate the motor current output
#-----------------------------------------------------------------------
stepper.set_motor_enabled(True)
stepper.set_acceleration(800)
stepper.set_max_speed(800)
stepper.do_homing()
stepper.set_acceleration(1600 * 10)
stepper.set_max_speed(10000)
stepper.set_homing_position_mm(400)
stepper.run_to_position_mm(1000)
stepper.run_to_position_mm(400)
#-----------------------------------------------------------------------
# move the motor 1 revolution
#-----------------------------------------------------------------------
# stepper.run_to_position_steps(9) #move to position 400
# stepper.run_to_position_steps(0) #move to position 0
#
#
# stepper.run_to_position_steps(400, MovementAbsRel.RELATIVE) #move 400 steps forward
# stepper.run_to_position_steps(-400, MovementAbsRel.RELATIVE) #move 400 steps backward
#
#
# stepper.run_to_position_steps(400) #move to position 400
# stepper.run_to_position_steps(0) #move to position 0
#-----------------------------------------------------------------------
# deactivate the motor current output
#-----------------------------------------------------------------------
stepper.set_motor_enabled(False)
print("---\n---")
#-----------------------------------------------------------------------
# deinitiate the CL57T class
#-----------------------------------------------------------------------
del stepper
print("---")
print("SCRIPT FINISHED")
print("---")
Acknowledgements
This library is a fork of TMC2209_Raspberry_Pi .
The code to run the stepper motor is based on the code of the AccelStepper Library from Mike McCauley.
The main focus for this are Test setups, as Python is not fast enough for high motor speeds.
Feedback/Contributing
If you encounter any problem, feel free to open an issue on the Github issue page. Feedback will keep this project growing and I encourage all suggestions. Feel free to submit a pull request on the dev branch.
Metadata
Release files for cl57t-raspberry-pi-stepper-drive 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cl57t_raspberry_pi_stepper_drive-0.5.0.tar.gz | 25.0 kB | Without provenance | Details for cl57t_raspberry_pi_stepper_drive-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cl57t_raspberry_pi_stepper_drive-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for cl57t_raspberry_pi_stepper_drive-0.5.0-py3-none-any.whl |
Total release size: 50.3 kB
Release files / cl57t_raspberry_pi_stepper_drive-0.5.0.tar.gz
| Download URL | cl57t_raspberry_pi_stepper_drive-0.5.0.tar.gz |
|---|---|
| Size | 25.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cded5c2718a3d79d61b6bb1301491e30b0aacfc12f1b9f31ae18d0fad848b83
|
|
BLAKE2b-256 checksum How to use checksums |
519982ce6abe012d10f442dadac38f8a95fc6279a5422cbd316bd51bef261202
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / cl57t_raspberry_pi_stepper_drive-0.5.0-py3-none-any.whl
| Download URL | cl57t_raspberry_pi_stepper_drive-0.5.0-py3-none-any.whl |
|---|---|
| Size | 25.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d151484e2450a834f46c69fb147a2a7d46b295bf9b3b4520a79cdfaf9f93e2ca
|
|
BLAKE2b-256 checksum How to use checksums |
1f64b226dda2b8e94348ecc97a7470edfc59e7f03cd1964a8a8d5b6ad542e660
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Security for cl57t-raspberry-pi-stepper-drive 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.