PyTic - Python interface for Pololu Tic Stepper Motor Controllers

Posted by Kevin on 7 August 2018

Customer Daniel Castelli of the Allen Institute has released a Python package for interfacing with our Tic Stepper Motor Controllers. Currently, he only supports 64-bit Windows, but the source code is available and should be straightforward to extend to other operating systems. Here is example code using PyTic to control a stepper motor:

import pytic
from time import sleep

# - Initialization -------------------------------------------

tic = pytic.PyTic()

# Connect to first available Tic Device serial number over USB
serial_nums = tic.list_connected_device_serial_numbers()
tic.connect_to_serial_number(serial_nums[0])

# Load configuration file and apply settings
tic.settings.load_config('path\\to\\config.yml')
tic.settings.apply()                             

# - Motion Command Sequence ----------------------------------

# Zero current motor position
tic.halt_and_set_position(0)

# Energize Motor
tic.energize()
tic.exit_safe_start()

# Move to listed positions
positions = [1000, 2000, 3000, 0]
for p in positions:
  tic.set_target_position(p)
  while tic.variables.current_position != tic.variables.target_position:
    sleep(0.1)

# De-energize motor and get error status
tic.enter_safe_start()
tic.deenergize()
print(tic.variables.error_status)

The code and documentation for this package are available on GitHub.

5 comments

Thank you for sharing my work on your blog. I hope the community finds PyTic useful.

The Tic Stepper Motor Controllers are great boards and I hope this opens up the potential to use them to a new audience on future robotics projects. I plan to add Windows 32-bit support and apply some other minor updates in the future.

Cheers,
Dan
Unfortunately, while this code is source-available, it is not open source as defined by the Open Source Initiative. The added clause in the project's license file states:

"3. Redistributions for commercial purposes are not permitted without the Allen Institute's written permission.
For purposes of this license, commercial purposes is the incorporation of the Allen Institute's software into
anything for which you will charge fees or other compensation. Contact terms@alleninstitute.org for commercial
licensing opportunities."

which violates the first criteria of the open source definition.

See also: https://drewdevault.com/2018/10/30/Its-not-okay-to-pretend-youre-open-source.html
Hello, anon.

We changed the blog post's wording to address your concerns.

-Jon
Hi Jon,

Thank you, I appreciate it. I'm currently using Python to control my Tic board, possibly for commercial purposes later on. As such, I was disappointed to see that PyTic is proprietary. While my previous post may seem pedantic, these details are important.

For anyone else looking for an open source Python wrapper for the Tic stepper motor controllers, see pytic (lowercase) by Dan Tyrrell. It required some minor editing on my part to get working properly, but that took only a few minutes.
Hello.

The blog is not an appropriate place for troubleshooting code-related issues; we would be happy to help you troubleshoot on our forum:

https://forum.pololu.com

- Amanda

Post a comment

Using your Pololu account allows you to customize your avatar and manage your comments; you can also post anonymously.

Related Products

Tic T825 USB Multi-Interface Stepper Motor Controller (Connectors Soldered)
Tic T825 USB Multi-Interface Stepper Motor Controller
Tic T834 USB Multi-Interface Stepper Motor Controller (Connectors Soldered)
Tic T834 USB Multi-Interface Stepper Motor Controller
Tic T500 USB Multi-Interface Stepper Motor Controller (Connectors Soldered)
Tic T500 USB Multi-Interface Stepper Motor Controller
Tic T249 USB Multi-Interface Stepper Motor Controller (Connectors Soldered)
Tic T249 USB Multi-Interface Stepper Motor Controller

Related Categories

Tic Stepper Motor Controllers
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Menu
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors