ZJAllen / ShushEngine

Python stepper motor driver for TMC5160
GNU General Public License v3.0
15 stars 9 forks source link

Using more than one TMC5160 #1

Closed ib101 closed 4 years ago

ib101 commented 4 years ago

Dear ZJAllen,

We would love to talk to you about some implementation using more stepper drivers, please shoot me an email; ibrahim@davincikitchen.de

ZJAllen commented 4 years ago

Hi there, I'm building this library to be able to use up to 6 TMC5160 drivers with a Raspberry Pi. For example, you can create a script like this:

import shush

m0 = shush.Motor(0)
m1 = shush.Motor(1)
m2 = shush.Motor(2)
m3 = shush.Motor(3)
m4 = shush.Motor(4)
m5 = shush.Motor(5)

m0.enable_motor()
m1.enable_motor()
m2.enable_motor()
m3.enable_motor()
m4.enable_motor()
m5.enable_motor()

m0.go_to(5000)
m1.go_to(10000)
m2.go_to(8456)
m3.go_to(4013)
m4.go_to(428)
m5.go_to(93244)

All of the go_to() commands will execute simultaneously. Currently, I don't have functionality in the library to synchronize the go_to() commands for multiple motors.

This is very much a work in progress, so please stay tuned for improved functionality.

ib101 commented 4 years ago

Thanks for the reply, do you have a schematic of how to connect 6 TMC5160's? Do you for instance need a separate Chip Select line for each driver?

ZJAllen commented 4 years ago

Yes, all 6 will need a separate chip select. If you dive into shush/boards/shush_mk1.py, it lists the Chip Select and Enable pins for 6 motors. All 6 would share the same MISO, MOSI, and SCLK. Feel free to change thee CS and Enable as it suits you.