Code Monkey home page Code Monkey logo

pytic2's Introduction

PyTic2

Raspberry Pi Python

pololu tic

Getting started

PyTic2 is a Python wrapper for the Pololu Tic Stepper Motor Controller series. It is similar and inspired by the PyTic driver developed by the Allen Institute. The PyTic2 driver is intended to be used on a Raspberry PI and uses the I2C interface for the communication with the Pololu Tic Stepper Motor Controllers. The API consists of the commands defined in the Tic Stepper Motor Controller User’s Guide

The wrapper has been tested with Tic T825 and T500 motor controllers.

Prerequisites

The communication with Pololu Stepper driver is done over the I2C interface and the smbus2 driver is required. The smbus2 driver can be pip installed.

pip install smbus2

Please refer to the Section 15.8 in the Pololu documentation for more detailed information

Installation

You can pip install the wrapper directly from github with the command if the setuptools package is installed:

pip install git+https://github.com/SRievers/pytic2

The wrapper library can otherwize be git cloned with the command:

git clone https://github.com/SRievers/pytic2

Usage

Before the use of the wrapper, the Motor Controller control mode has to be set to Serial/I2C/USB and assigned an unique device number. This can be done with the Pololu Control Center that can be downloaded from the Pololu website.

The pytic2 object can be instantiated after having imported the pytic2 module. The Motor Controller commands are thereafter available as the object methods.

Python script example

from smbus2 import SMBus
from pytic2 import pytic2

DEVICE_NUMBER = 20

bus = SMBus(3)
tic = pytic2(bus, DEVICE_NUMBER)

tic.setStepMode(3)            # = 2^-3 = 1/8
tic.setCurrentLimit(8)        # = 8*32 mA = 256 mA
tic.setMaxSpeed(4000000)
tic.setMaxAccel(40000)
tic.setMaxDecel(40000)

tic.haltAndSetPosition(0)
tic.energize()
tic.exitSafeStart()
tic.setTargetPosition(500)
tic.setTargetPosition(-500)

License

Licence

pytic2's People

Contributors

srievers avatar

Watchers

 avatar

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.