Controlling Tic T249 stepper motor controller with MATLAB

Hi i am trying to develop a MATLAB code for controlling Tic T249 stepper motor controller, to rotate the stepper motor for every 1 degree rotation. Is it possible to control tic with MATLAB. To communicate to TIC via MATLAB do i have to install some additional drivers.

Hi.

The Tic stepper motor controller can accept commands through USB, TTL serial, I2C, RC servo pulses, analog voltage, and quadrature encoder. Direct USB communication might be the most straight forward way to control the Tic with MATLAB, though I expect MATLAB to be able to communicate via serial or I2C, but maybe with additional hardware and drivers. The “Setting up the controller” section of the Tic user’s guide has more detail about each method of control. The “Writing PC software to control the Tic” section might also be useful.

-Claire

I am sorry but i am unable to get the com port number of T249 to control T249 in MATLAB

I am also trying to control it python and below is the program I am using. i am confused about the tic.interface_name. In my tic control centre I could see the serial number of tic as 00418312. So do I have to use this serial number.

import ticpy

# Connect to the Tic T249 controller using the serial interface.
tic = ticpy.TicI2C()

# Set the serial port of your Tic T249.
tic.interface_name = '/dev/ttyUSB0'  # Replace with your actual serial port

# Open the connection to the Tic controller.
tic.open()

# Set the acceleration and speed limits to appropriate values.
tic.set_max_accel(10000)  # Set the maximum acceleration (adjust as needed)
tic.set_max_speed(10000)  # Set the maximum speed (adjust as needed)

# Calculate the number of steps required for a 360-degree rotation with 1-degree steps.
steps_per_degree = 1
degrees_to_rotate = 360
total_steps = int(degrees_to_rotate * steps_per_degree)

# Rotate the Tic controller.
tic.reset_command_timeout()  # Reset the command timeout
tic.set_target_position(total_steps)  # Rotate the motor by the specified number of steps

# Wait until the motor reaches the target position.
while not tic.check_movement_done():
    pass

# Close the connection to the Tic controller.
tic.close()

Hello. It looks like you might be using ticlib, a project developed by customer Julien Phalip. You should look at the I²C section of that project’s README to see examples of how to initialize the TicI2C object. If you need more help, please tell me what type of computer you are running this code on, what operating system you are using, and all the connections you have made between the computer and the Tic.

–David

Hi David,.
Thanks for responding to my mail. I am trying to run this code in Windows 11. But I would like to ask you if I can control this stepper motor controller using MATLAB. Because the main issue in MATLAB is it asks for com port and for this pololu device I can only see serial number, there is no information on port. For eg COM2 or COM3 something like that. Please help me in this matter.

The Tic itself does not have a virtual serial port interface, so Windows will not assign a COM port to it when you plug it into your computer via USB.

If you decide to communicate with the Tic using its serial interface (the RX and TX pins), you would need to connect the Tic to your computer via a separate piece of hardware called a USB-to-serial adapter. That adapter would have a COM port you can connect to with serial communication libraries.

However, I do not recommend adding extra hardware like that unless you really need to. I think you should communicate with the Tic using its USB interface. The simplest way to do that is probably to execute the Tic command-line utility, which is named ticcmd. You might try some Internet searches for things like “matlab run command-line program” to see how to do that in MATLAB.

–David