Giter Club home page Giter Club logo

steppyr's Introduction

steppyr

A stepper motor library in Python

Installation

Installing WiringPi/GPIO for TMC4361

If you are using the TMC4361 and want to use the Raspberry Pi to provide the external clock signal, you will need to use the gpio program included with wiringPi in order to activate the clock pin. This is mainly due to the fact that the RPi.GPIO library does not support setting the clock pin.

git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
gpio readall

Usage

TMC4361 motion controller

If you are using the TMC4361 and want to use the Raspberry Pi to provide the external clock signal, you will need to manually set the clock pin (BCM 4).

gpio mode 7 clock
gpio clock 7 1600000

TMC26x driver

For a TMC26X driver, first make sure you have spidev installed:

pip install spidev

TMC26X example code:

# Create the stepper driver
stepper = AccelStepper(
  profile=RectangleProfile(),
  activator=TMC26XDriver(
    spi=SPI(bus=0, device=0),
    dir_pin=pinout.dir_pin,
    step_pin=pinout.step_pin
  )
)
stepper.set_target_speed(1000) # steps per second
# stepper.set_target_acceleration(40000) # steps per second per second
# stepper.set_pulse_width(2) # microseconds

TMC4361 example code:

spi = SPI(bus=0, device=1)
tmc4361 = TMC4361(
  spi=spi,
  reset_pin=26
)
driver = StepperController(
  activator=tmc4361,
  profile=tmc4361
)

For all other STEP/DIR drivers.

driver = StepperController( profile=AccelProfile(), activator=A4988Driver( dir_pin=1, step_pin=2, enable_pin=3, ms1_pin=4, ms2_pin=5, ms3_pin=6 ) )

Testing

source test/env python3 -m unittest discover

Wiring

TMC4361/TMC4361-Eval to TMC2660

TMC4361 TMC4361-Eval TMC2660


STPOUT_PWMA DIO6 (#17) STEP
DIRPOUT_PWMB DIO7 (#18) DIR
MP1 DIO14 (#36) SG_TST
NSCSDRV_SDO SPI2_CSN0 (#24) CSN
SDODRV_SCLK SPI2_SDO (#28) SDI
SCKDRV_NSDO SPI_SCK (#27) SCK
SDIDRV_NSCLK SPI2_SDI (#29) SDO

Trinamic Support

TMC 260/261/262/2660 Stepper library for Python

Based on the Arduino TMC26X Stepper Motor Controller Library https://github.com/trinamic/TMC26XStepper

References

Arduino library for A4988, DRV8825, DRV8834 and generic two-pin (DIR/STEP) stepper motor drivers https://github.com/laurb9/StepperDriver

TMC260 / TMC260A & TMC261 DATASHEET http://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC261_datasheet.pdf

TMC262 DATASHEET http://www.microsemi.com/document-portal/doc_view/130727-trinamic-tmc262-stepper-motor-driver-datasheet

TMC4210+TMC2660 EVALUATION BOARD MANUAL http://www.trinamic.com/fileadmin/assets/Products/Eval_Documents/TMC4210_TMC2660_Eval_Manual.pdf

Arduino TMC26X Stepper Motor Controller Library https://github.com/trinamic/TMC26XStepper

steppyr's People

Contributors

alangibson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

steppyr's Issues

AttributeError: 'int' object has no attribute 'compute_new_speed'

from RaspberryPiStepperDriver import spi, tmc26x
spi_dev = spi.SPI(bus=0, device=0)
driver = tmc26x.TMC26XStepper(spi_dev, 200, 23, 18, 300)
driver.start()

Traceback (most recent call last):
File "test.py", line 11, in
driver.start()
File "/home/pi/RaspberryPiStepperDriver/src/RaspberryPiStepperDriver/tmc26x.py", line 177, in start
self.set_microsteps(self.microsteps)
File "/home/pi/RaspberryPiStepperDriver/src/RaspberryPiStepperDriver/tmc26x.py", line 408, in set_microsteps
self._profile.compute_new_speed()
AttributeError: 'int' object has no attribute 'compute_new_speed'

A4988 and DRV8255 driver mode pins

In a4988.py (lines 34-36) .self is missing in front of ms#_pin.
Also there is no logic to handle the default values for ms1_pin, ms2_pin & ms3_pin. Default values of None cause the activate method to fail.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.