Arduino code example for micro meastro


I’ve build a Panorama Robot 3 years ago with the older 8 channel servo controller from Pololu and had some stability issues.
I was advised to use the Micro Maestro 6 channel as a replacement.
It appears to be that it is not a direct swap between the two controllers and that the maestro needs other commands to work properly.

I’m able to control the maestro using the minissc control mode, but this way I only have 254 steps to control the servo. What I want is
a panning over 360 degrees max in steps of at least 1 degree. Better is it to have more steps to be able to better fine-tune the start and end-point
of the servo rotation.

Fine-tuning was done in the old 8 channel control with adjusting the minimum and maximum servo-pulse in 5 millisecond steps (in the the Pololu control mode).

When I use this mode with the Micro Maestro the servo is al over the place. Steps of 5 milliseconds results in big 10 to 15 degree servo movements and continuing to add
extra 5 millisecond steps will result in movements to the complete opposite direction, I could not find any pattern in movements.

Does anybody have a working arduino to Micro Maestro example in Pololu-mode which for example turns a servo from 0 to 180 degrees in 5 degree steps ?




Just to let you know, I found a working example, see below …

[code]// Arduino to Micro Meastro test
// 6 Serial Servo Controller
// SSC RX pin to Arduino TX pin Pin01
// SSC TX pin to Arduino RX pin Pin02

// LIBRARIES---------------// Included libraries
// SoftwareSerial
#include <SoftwareSerial.h>
// ---------------------//

// DEFINE------------------// Define constants
// Serial pins
#define txPin 1
#define rxPin 2
// ^^^---------------------//

// INITUALIZE--------------// initalizing pins and bytes etc
// ?
SoftwareSerial mySerial(rxPin, txPin);
// ^^^---------------------//

// SETUP-------------------// setup before we go
void setup() // run once, when the sketch starts
// Send a Set Target command to the Maestro.
// Target is in units of quarter microseconds
// so the normal range is 4000 to 8000.
void set_target(unsigned char servo, unsigned int target)
mySerial.write(0xAA); //start byte
mySerial.write(0x0C); //device id
mySerial.write(0x04); //command number
mySerial.write(servo); //servo number
mySerial.write(target & 0x7F);
mySerial.write((target >> 7) & 0x7F);
// ^^^---------------------//

// LOOP--------------------// The base for the program
void loop()
set_target(1, 8000);
set_target(1, 7200);
set_target(1, 6400);
set_target(1, 5600);
set_target(1, 4800);
set_target(1, 4000);
// ^^^---------------------//

Hello, Arjan.

I was going to ask you to post your nonworking code, but it looks like you might have found what you were looking for. Do you have any further questions?

  • Grant