Crate raestro[][src]

An interface for the Pololu Micro Maestro 6-Channel Servo Controller Board.

raestro provides an easy-to-use interface to communicate with the 6-Channel Maestro.


Before continuing, please take note of the following points:

  • This library is developed specifically for the Raspberry Pi. Builds on different architectures will not be guaranteed to work.
  • Please take caution in wiring the Pololu Micro Maestro to the Raspberry Pi. Incorrect wiring may lead to permanent hardware damage.

Getting Started

Below are the hardware and software setup processes that must be followed before successfully interacting with the Maestro, as well as trouble-shooting tips.

Hardware Setup

  1. Connect the power + ground lines from the Raspberry Pi to the Maestro. 2. Connect the Raspberry Pi’s TX and RX pins to the Maestro’s RX and TX pins, respectively. Please note the order in which the pins need to be connected (Raspberry Pi’s TX connected to Maestro’s RX; Raspberry Pi’s RX connected to Maestro’s TX).
  2. Connect the power lines for the servos (holding the board such that the pins are facing you and are on the right side of the board, these are the 2 pins on the top right). The left one of the pair is the power; the right one is ground. 4. Connect up to 6 servos on one of the pin-triples available (the backside of the board has more info on each pin-type).

Software Setup

The Rust crate rppal provides user-level APIs for protocols such as PWM, I2C, and UART. In order to configure UART for the Raspberry Pi, do the following:

  1. Remove console=serial0,11520 from /boot/cmdline.txt 2. Disable the Bluetooth by:
    • Adding dtoverlay=pi3-disable-bt to /boot/config.txt
      • For the Raspberry Pi 4 models, add dtoverlay=disable-bt instead
      • Once this is done, reboot the Raspberry Pi (by powering it off and then on again)
    • Running the command sudo systemctl disable hciuart


If permission denied errors are being observed, please inspect your user’s permissions. More specifically, your user must be added to group dialout. If cargo build or cargo test do not work because of the rppal dependency, check the rppal documentations on how to set up UART. The link is here.

Example Usage

Below are included some simple examples on how to instantiate and start a [‘maestro’] instance, as well as how to send some commands to the Micro Maestro 6-Channel Servo Board.

use std::{
use raestro::prelude::*;

let mut m: Maestro = Maestro::new();

let channel: Channels = Channels::C_0;

let target_min = 3968u16;
let target_max = 8000u16;

let sleep_time = Duration::from_millis(1000u64);

// just swivel back and forth 10 times
for _ in 0u8..10u8 {
    m.set_target(channel, target_min).unwrap();

    m.set_target(channel, target_max).unwrap();



All constants defined and used by the Maestro for UART communication through the Pololu-Protocol.


Public convenience exports.



The main wrapper around the Maestro communications interface.



The custom raestro error type.

Type Definitions


Public result type.