Micro Serial Servo Controller on Linux Problem

I am driving this device (Pololu item #: 207) from a Linux system to control a standard, generic servo (also purchased from Pololu) using 8-bit Pololu mode. When I apply power to the board the servo jiggles momentarily and the yellow LED goes on. When I send a speed and position command the board/servo seems to go into one of two states:

  1. The servo moves about 90 degrees at full speed no matter what position or speed was specified and the yellow LED goes off momentarily and then back on. Sending the same commands again causes the servo to move about 90 degrees in the opposite direction. Subsequent commands have the same effect with the servo moving back and forth with each command set (speed and position). It stays in this state until power is removed from the board or the servo is unplugged.


  1. The servo moves to the commanded position at the selected speed and the yellow LED goes off. Subsequent position and speed commands work correctly and all LEDs remain off. It stays in this state until power is removed from the board.

Which state the device goes into seems to be random, with state 1 occurring about 80% of the time and state 2 about 20%. It looks like it has something to do with a random state that the board and/or servo go into when power is first applied because the state doesn’t change until power is removed and then restored. I am driving the board via a USB to serial adapter into the RS-232 pins on the board. The board is being powered from the same 5v supply that is powering the servo with the power jumper in place.

I have also tried absolute positioning (command 4) and get similar results.

Any help would be appreciated.


Here is the C program I am using:

#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <termios.h>
/* Main program. */
int main(int argc, char **argv)
  int fd;
  char data[6];
  int set_bits = 4; /* bits to set DTR=0, RTS=1 */
  int com_setspeed = 1; /* command to set servo speed */
  int com_setpos = 3; /* command to set servo position */
  int servono, pos, speed ;
  if ( argc != 5 ) {
     fprintf(stderr, "Usage: %s device servo-number position speed\n", argv[0]);
  servono = atoi(argv[2]);
 pos = atoi(argv[3]);
  speed = atoi(argv[4]);
  if ( servono < 0 || servono > 7 || pos < 20 || pos > 240 || speed > 127) {
     fprintf(stderr, "Ranges:  servo-number 0-7,  position 20-240, seed 1-127\n");
  if ((fd = open(argv[1], O_WRONLY | O_NOCTTY)) < 0) {
     fprintf(stderr, "Can't open device %s\n", argv[1]);
  ioctl(fd, TIOCMSET, &set_bits);
  data[0] = 0x80;  /* start */
  data[1] = 0x1; /* device id */
  data[2] = 0x1;
  data[3] = servono;  /* servo number */
  data[4] = speed;  /* servo speed */
  write(fd, data, 5); /* write speed command to controller */
  data[2] = 0x3; /* servo position command*/
  if( pos > 127) {
    data[4] = 1;
    data[5] = pos - 128;
    else {
    data[4] = 0;
    data[5] = pos;
  write(fd, data, 6); /* write position command to controller */


I am sorry to hear that the Maestro is not working well for you. What you are describing could potentially be a power problem, and I would like to rule that our first. Does your Maestro work properly when controlled over USB with the Control Center? What is your 5V supply, and are you sure that it has enough current available (a few amps) to power everything?



Thanks for responding so quickly. This device is not a Maestro. It’s the 8 channel serial controller, product number 207, see: pololu.com/catalog/product/207

My power supply is a 4 AA 2000 mah NiMH battery pack, fully charged. It should be able to provide plenty of power.


Oops, sorry for totally misreading your post!

Can you find a Windows computer and try your sending a few simple position commands using our Serial Transmitter? That way we can determine whether the problem is with your code or your setup.



Problem solved!

It was caused by the battery producing a voltage drop when power was first connected. Although the no load battery voltage was good, it produced a momentary drop when the servo first powered up and pulled a surge of current to move to its neutral position at high speed. Apparently if the voltage drops below a critical level the controller gets into that funny state where it only goes back and forth. The randomness, it appears, was dependent on how much current the servo pulled when first connected which was probably related to how far it had to move from it’s initial, random position to get to neutral. Once connected I was running the servo at a low speed, pulling little current, so that the voltage stayed up while it moved and the controller stayed in it’s normal operating state. That’s why it worked correctly some of the time.

This system is being used to pan a robotic camera out in the field, running on battery power. I think I’ll increase the voltage to the Pololu controller and servo from 5V to 6V to reduce the chance that the voltage drops below the critical level during power up and causing this problem.

Thanks for your suggestion that it might be a power issue.


Great, I am glad you found the problem. If you continue to have trouble you might want to consider adding some capacitance at the servo controller’s power pins or powering it with a second supply.