Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Control Micro Maestro 6 Servo Controller using MATLAB


#1

Hi,
I would like to know whether i can control my Micro Maestro 6-Channel USB Servo Controller using MATLAB software. Please let me know the start up codes to do that in MATLAB.

advance thanks

sreekanth


#2

Hello, sreekanth.

The Maestro has virtual COM ports that can be used just like any other serial port, so if you figure out how to send bytes to a serial port in Matlab you can use the Maestro.

The first step is to set the Maestro’s serial mode to USB Dual Port and determine the COM port number of the Maestro’s Command Port by looking in the Device Manager (assuming you are using Windows).

I have never used Matlab, but this code will probably work for you. It was adapted from a post by sc920505. It sets the target of channel 0 to 6000 (1500 microseconds). It uses the Set Target serial command which is documented in the “Serial Servo Commands” section of the Maestro User’s Guide. You’ll probably want to improve it by making a function that takes a channel number and a target and calculates the serial bytes for you.

s2 = serial('COM9',...
'Baudrate',9600, ...
'DataBits',8, ...
'Parity','none', ...
'InputBufferSize',16384)

fopen(s2)
fwrite(s2,[132,0,112,46],'uint8')
fclose(s2)

–David


Getting started - Maestro Micro 6 Servo Controller in Matlab
Mini Maestro 12-Channel USB Servo Controller use to matlab
Micro Maestro With Matlab
Controlling a Servo via Matlab
#3

I’m trying, but does not work
I’m not a good matlab user
can not send data
I’m doing wrong or Another need the extra code


#4

Hello, faitharc.

Please see my response in your thread:

–David


#5

A post was split to a new topic: Reading analog input from Maestro channel to MATLAB


Reading analog input from Maestro channel to MATLAB