Maestro Controller (6 Servos) with Raspberry Pi and Matlab

So I am trying to utilize the UART communication from the Raspberry PI to the Maestro via MATLAB. My problem is I cant seem to send any signals to the Maestro. I have hooked up my Maestro to my computer VIA USB successfully and ensured that UART , 9600 was selected. Also Serial console is disabled on my Pi.

I execute the following commands:
myPI = raspi(); ** establish connection with Pi
MaestroControl = serialdev(myPi, ‘/dev/ttyAMA0’, 9600); ** This sets up the link between the Pi and the serial device.

A = [132,0,112,46];

write(MaestroControl , A); I assume this would send the data to set a target but nothing happens.

Read commands do not work either.

Any ideas?


I moved your post to our “Servo controllers and servos” subforum, which seems more appropriate.

Which version of the Raspberry Pi are you using? Can you post pictures clearly showing the connections between all of your devices in your setup, including how the Raspberry Pi is connected to your computer?

Can you verify that you are able to interface with the Raspberry Pi from your MatLab program? Have you ever gotten the Raspberry Pi to work with just the Maestro before without using MatLab? Are you using a logic level shifter between the Raspberry Pi and Maestro? The Maestro is a 5V device and is not guaranteed to recognize the 3.3V signals from the Raspberry Pi. Also, connecting 5V directly to the GPIO pins on the Raspberry Pi could damage them, so you should use a logic level shifter before continuing.

- Amanda

Thank you for your response!

  1. Raspberry Pi 3b+

  2. Raspberry Pi is connected to the CPU via SSH wireless connection using MATLAB.

  3. I have not used the PI and Maestro alone… I am thinking about trying that with Python.

  4. I am using a logic level shifter.

I have no problem accessing the camera board using matlab and raspberry pi… but i do not think the signals being sent the maestro are in the right format. When i send the command to write(MaestroControl,A);, i get no errors but nothing happens.

The maestro is also holding the servos in place so it is applying power to them. I just get no response from them via the write or read commands.

Does the Maestro’s red LED turn on after you try sending the command packet from your MatLab program? Can you post pictures showing how everything is connected in your setup?

I recommend you try getting the Raspberry Pi to work with the Maestro first before adding MatLab into your setup. If you have trouble getting your code to work, you can post the complete code here, and I would be happy to take a look.

By the way, in case you do not already know, there is a known issue with the Raspberry Pi 3 where the mini UART is dependent on the core clock frequency, so any changes to the core clock will affect the baud rate. You might try using this workaround to resolve the problem.

- Amanda