You can control the Maestro by issuing serial commands.
If your Maestro’s serial mode is “UART, detect baud rate”, you must first send it the baud rate indication byte 0xAA on the RX line before sending any commands. The 0xAA baud rate indication byte can be the first byte of a Pololu protocol command.
The Maestro serial command protocol is similar to that of other Pololu products. Communication is achieved by sending command packets consisting of a single command byte followed by any data bytes that command requires. Command bytes always have their most significant bits set (128–255, or 0x80–0xFF in hex) while data bytes always have their most significant bits cleared (0–127, or 0x00–0x7F in hex). This means that each data byte can only transmit seven bits of information. The only exception to this is the Mini SSC command, where the data bytes can have any value from 0 to 254.
The Maestro responds to three sub-protocols:
This is the simpler and more compact of the two protocols; it is the protocol you should use if your Maestro is the only device connected to your serial line. The Maestro compact protocol command packet is simply:
command byte (with MSB set), any necessary data bytes
For example, if we want to set the target of servo 0 to 1500 µs, we could send the following byte sequence:
in hex: 0x84, 0x00, 0x70, 0x2E
in decimal: 132, 0, 112, 46
The byte 0x84 is the Set Target command, the first data byte 0x00 is the servo number, and the last two data bytes contain the target in units of quarter-microseconds.
This protocol is compatible with the serial protocol used by our other serial motor and servo controllers. As such, you can daisy-chain a Maestro on a single serial line along with our other serial controllers (including additional Maestros) and, using this protocol, send commands specifically to the desired Maestro without confusing the other devices on the line.
To use the Pololu protocol, you transmit 0xAA (170 in decimal) as the first (command) byte, followed by a Device Number data byte. The default Device Number for the Maestro is 12, but this is a configuration parameter you can change. Any Maestro on the line whose device number matches the specified device number accepts the command that follows; all other Pololu devices ignore the command. The remaining bytes in the command packet are the same as the compact protocol command packet you would send, with one key difference: Therefore, the command packet is:
0xAA, device number byte, command byte , any necessary data bytes
For example, if we want to set the target of servo 0 to 1500 µs for a Maestro with device number 12, we could send the following byte sequence:
in hex: 0xAA, 0x0C, 0x04, 0x00, 0x70, 0x2E
in decimal: 170, 12, 4, 0, 112, 46
Note that 0x04 is the command 0x84 with its most significant bit cleared.
Mini SSC Protocol
The Maestro also responds to the protocol used by the Mini SSC servo controller. This protocol allows you to control up to 254 different servos by chaining multiple servo controllers together. It only takes three serial bytes to set the target of one servo, so this protocol is good if you need to send many commands rapidly. The Mini SSC protocol is to transmit 0xFF (255 in decimal) as the first (command) byte, followed by a servo number byte, and then the 8-bit servo target byte. Therefore, the command packet is:
0xFF, servo number byte, servo target byte
For example, if we wanted to set the target of servo 0 to its (configurable) neutral position, we could send the following byte sequence:
in hex: 0xFF, 0x00, 0x7F
in decimal: 255, 0, 127
The Maestro can be configured to respond to any contiguous block of Mini SSC servo numbers from 0 to 254.
The Maestro identifies the Pololu, Compact, and Mini-SSC protocols on the fly; you do not need to use a configuration parameter to identify which protocol you are using, and you can freely mix commands in the three protocols.