Controlling Servos using Python 2.7 on Rasberry pi 3 B with Maestro servo controller (getting error)

I am attempting to control servos using the Maestro Servo Controller (, with Python run on a raspberry pi. However I am getting an error when I run the script below.

  1. Script :
import maestro
servo = maestro.Controller()
servo.setAccel(0,4)      #set servo 0 acceleration to 4
servo.setTarget(0,6000)  #set servo to move to center position
  1. Error :
 File "", line 3, in <module>
    servo = maestro.Controller()
  File "/home/pi/Maestro/", line 33, in _init_
    self.usb = serial.Serial(ttyStr)
  File "/home/pi/.local/lib/python2.7/site-packages/serial/", line 240, in _init_
  File "/home/pi/.local/lib/python2.7/site-packages/serial/", line 268, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyACM0: [Errno 2] No such file or directory: '/dev/ttyACM0'

Here are the details of my setup and what I have done
3) I have followed tutorial :
4) Using Raspberry pi 3 B
5) Micro Maestro 6-Channel USB Servo Controller
6) Python 2.7.13
7) Installed pyserial
8) I have disabled the serial login shell & the serial interface has been enabled (as is shown here :
9) I have run “dmesg | grep tty” command with the following response :

[    0.001207] console [tty1] enabled
[    1.067317] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2 

Any suggestions on a fix would be appreciated.
Let me know if any additional information is required.


Hello, Steve.

It looks like you are using this Python class for the Maestro, which is configured to control the Maestro over USB serial (/dev/ttyACM0) by default. You need to specify the correct serial port you want to use when initializing the class object like so servo = maestro.Controller('/dev/ttyAMA0').

- Amanda

1 Like

Thanks! Simple fix :slight_smile:

1 Like