Host library for Grafito CANStepper boards (GCSP v1): multi-node CAN stepper control with encoders, homing, groups and coordinated motion
Project description
Grafito CANStepper
Closed-loop stepper motor control over CAN. Each board carries an ESP32-C3, a TMC2209 driver, an MT6701 14-bit magnetic encoder and a CAN transceiver; up to 31 boards daisy-chain on one 1 Mbps bus and are driven from Python through the USB port of any board on the chain.
can_stepper/
├── firmware/GrafitoCANStepper_C3/ # node firmware (GCSP v1)
├── canstepper/ # Python package (grafito-canstepper)
├── examples/ # runnable examples + machine.toml
├── tests/ # pytest suite (runs on a software sim)
└── docs/
├── PRD.md # product requirements
├── protocol.md # GCSP v1 wire protocol reference
└── quickstart.md # unboxing -> moving motor
Highlights
- Layered Python API — raw frames →
StepperNode→NodeGroup→Axis(mm units viarotation_distance) →DualMotorAxis/CoreXY/MotionGroup→ declarativemachine.toml. - Safety scopes —
node.estop(),group.estop(),bus.estop_all()(single broadcast frame); e-stop is latched until re-enabled. - Homing — physical endstop on IO8, sensorless (StallGuard), or set-zero; configurable current, backoff and timeout.
- Closed loop — firmware ≥1.2 plans a rest-to-rest trapezoidal trajectory with velocity feedforward and a light tracking PID on the MT6701 encoder (settle + stall watchdog). All motion limits are configurable defaults, never hard clamps.
- On-bus leader/follower — dual-motor gantries stay coupled with no host in the loop.
- Simulator included —
canstepper.sim.SimNetworkimplements the whole protocol in software; the test suite and the examples run without hardware.
Install & first spin
The package is grafito-canstepper on the index; you import canstepper.
# Works today (GitHub monorepo subdirectory — not yet on PyPI):
pip install "git+https://github.com/Grafito-Innovations/Grafito-Edge-Services.git#subdirectory=can_stepper"
# Development (from this directory):
pip install -U pip setuptools && pip install -e ".[dev]"
# After publishing to PyPI:
# pip install grafito-canstepper
Docs: https://docs.grafito.in
from canstepper import CANStepperBus
with CANStepperBus.serial("/dev/ttyACM0") as bus:
print(bus.discover())
node = bus.node(1)
node.set_run_current(40).enable()
node.move_to(360.0, blocking=True)
Continue with:
- docs/quickstart.md — first motion
- docs/closed_loop_tuning.md — trapezoid + v_ff, hardware matrix + 10 min soak on PR42HS40-1204AF-02 (NEMA 17 1.2 A)
- docs/protocol.md — GCSP v1 wire protocol
Development
cd can_stepper
python3 -m pytest # simulator suite
python3 tools/cl_speed_validate.py /dev/ttyACM0 1 70 8 # hardware OL vs CL
Firmware builds with Arduino IDE or arduino-cli (ESP32C3 Dev Module, USB
CDC On Boot = Enabled; libraries: FastAccelStepper, TMC2209 janelia-arduino):
arduino-cli compile --fqbn esp32:esp32:esp32c3:CDCOnBoot=cdc \
firmware/GrafitoCANStepper_C3
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:esp32c3:CDCOnBoot=cdc \
firmware/GrafitoCANStepper_C3
Legacy note
CANStepperNode_C3/ and canbus.py are the earlier bring-up firmware and
host script based on a third-party protocol. They are superseded by the
clean-room GCSP v1 stack above and kept only for reference during migration.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grafito_canstepper-0.1.0.tar.gz.
File metadata
- Download URL: grafito_canstepper-0.1.0.tar.gz
- Upload date:
- Size: 38.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f8bf6462272c24c0463bccab02003fbde1d936f3322b4c5bd5baaf202176692
|
|
| MD5 |
76cbb149279c0f86ec066c145166e885
|
|
| BLAKE2b-256 |
f71399b48df478b93265eea230db0266d749c270772ee0814e5b1b7b0651e739
|
File details
Details for the file grafito_canstepper-0.1.0-py3-none-any.whl.
File metadata
- Download URL: grafito_canstepper-0.1.0-py3-none-any.whl
- Upload date:
- Size: 38.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd1e5babb85ac038221c47222b0d4555c59a2eb60236b543815cafe2f739b824
|
|
| MD5 |
f634fd1fef6cef93e528a87e4c9f0922
|
|
| BLAKE2b-256 |
9d21f8382a7d587ca1dd2b0c368804df799a64bcbb2ad5167e63ec2c48cbbbb4
|