All Projects → pootle → tripipy

pootle / tripipy

Licence: Unlicense License
Simple python driver for Trinamic tmc5130 connected to Raspberry Pi

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to tripipy

SimpleStepper
A bare minimum but really fast and simple stepper library for Arduino.
Stars: ✭ 21 (-25%)
Mutual labels:  stepper-motor, stepper-motor-driver
CameraSlider
3D printed and smartphone controlled camera slider
Stars: ✭ 16 (-42.86%)
Mutual labels:  stepper-motor
pololu-tic-software
Software and drivers for the Pololu Tic Stepper Motor Controller.
Stars: ✭ 16 (-42.86%)
Mutual labels:  stepper-motor
Easy Driver
The EasyDriver is a simple to use stepper motor driver, compatible with anything that can output a digital 0 to 5V pulse (or 0 to 3.3V pulse if you solder SJ2 closed on the EasyDriver).
Stars: ✭ 27 (-3.57%)
Mutual labels:  stepper-motor
motor-hat
Node Module to control Adafruits MotorHAT for the RaspberryPi
Stars: ✭ 28 (+0%)
Mutual labels:  stepper-motor
FlexyStepper
Stepper motor control library for Arduino supporting in motion changes
Stars: ✭ 41 (+46.43%)
Mutual labels:  stepper-motor
beagleg
G-code interpreter and stepmotor controller for crazy fast coordinated moves of up to 8 steppers. Uses the Programmable Realtime Unit (PRU) of the Beaglebone.
Stars: ✭ 107 (+282.14%)
Mutual labels:  stepper-motor
SmartSpin2k
Transform your spin bike into a Smart Trainer!
Stars: ✭ 88 (+214.29%)
Mutual labels:  stepper-motor

tripipy

Python driver for Trinamic tmc5130 connected to Raspberry Pi

The Trinamic stepper control chips (like the tmc5130 and tmc5160) are FAR more sophisticated than the older stepper chips like the A4988. They are more expensive (around £15 mounted on a breakput board), but the added functionality dramtically reduces the compexity of the software needed to control the stepper, with goto and ramping available.

I have used the SPI interface to control the chip as this enables control of at least a couple of motors with minimal effort - 2 tmc5130s can be mounted on an adafruit prototyping hat making a nice compact controller.

This driver is far easier to install and run than the example code on the trinamic website. Their example code requres installation of both bcm2835 drivers and wiringpi, neither of which are standard on raspbian lite, and require local compilation.

I've run this with 2 motors on the base Raspiberry Pi SPI interface

Software Dependencies

This package is Python3, and requires pigpio to be running, it also uses guizero to provide a simple testing interface. The testing interface requires raspbian or raspbian-full.

sudo apt-get install python3-pigpio

sudo pip3 install guizero

Hardware dependencies

The driver uses 1 SPI channel per motor control chip, and 3 gpio pins: You should use the Raspberry pi gpio harware clock (GPIO 4) This can be shared if you have more than 1 motor controller. The other 2 pins (output stage enable and vcc-io / reset) can potentially be any ordinary gpio pin. The gpio pins and SPI settings are settable on the contructor interface for trinamicDriver.TrinamicDriver.

You will need a stepper motor and a suitable power supply.

Overview

There are 5 python files:

  • TrinamicDriver.py: (480 lines) This sets up and drives the SPI interface as well as the 3 straight gpio pins required by the tmc5130. I have tested this on the primary SPI interface using both available channels. It may not work on the Aux SPI interface as this may not support mode 3 SPI. It provides methods to read and write the chip's registers as well as chip reset and enabling the output stage.
  • tmc5130regs.py: (170 lines) This contains mappings for all the register names and some of the bit flag registers defined as IntFlags to make usage more readable. Each of the chip's registers is defined as an instance of a register class.
  • chipdrive.py: (250 lines) This contains a class tmc5130, each instance can control a single motor. There is a sample app (motors3.py) that can drive the motor displaying live status as the motor runs
  • treedict.py: a utility class that provides simple access to the chip register classes
  • motor2.py: a sample app, built using guizero to provide a simple gui to control the chip / motor.

Installation

  • git clone this repository or download the zip file and unzip it.

  • install python3-pigpio

  • install guizero

demo use

cd to the directory containing the 3 python files.

start the pigpio daemon if it is not already running I use sudo gpiod -c 256

At the moment the gpio pins have defaults defined in the trinamicDriver module around line 36. These can be changed in the chipdrive module when it instantiates the class around line 133.

run the app:

python3 motor2.py

Select the mode to use:

goto target the chip drives the motor to reach the target - set a target posn before ppressing ACTION!

run forward the chip drives the motor at constant speed forwards

run reverse the chip drives the motor at constant speed in reverse

select the speed to use:

max rpm Runs at the maximum speed defined for the motor

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].