Arduino Uno + Mini Maestro 12 problems

I am completely new to Arduinos and using the maestro 12, so sorry if my problem is something stupid.

I am controlling 8 of the HS-755 HB servos with the maestro. I am using a 6V, 3000 mAh, 5 cell battery to power the servo controller. The uno is connected to the maestro through the serial pins. I am running the following simple script to move the servos to a basic position and maintaining it:

#include <PololuMaestro.h>

MicroMaestro maestro(Serial);

void setup()
{
  Serial.begin(9600);
  maestro.reset();
  delay(1000);

  maestro.setSpeed(0, 20);
  maestro.setAcceleration(0, 5);
  maestro.setSpeed(1, 20);
  maestro.setAcceleration(1, 5);
  maestro.setSpeed(3, 20);
  maestro.setAcceleration(3, 5);
  maestro.setSpeed(4, 20);
  maestro.setAcceleration(4, 5);
  maestro.setSpeed(6, 20);
  maestro.setAcceleration(6, 5);
  maestro.setSpeed(7, 20);
  maestro.setAcceleration(7, 5);
  maestro.setSpeed(9, 20);
  maestro.setAcceleration(9, 5);
  maestro.setSpeed(10, 20);
  maestro.setAcceleration(10, 5);
}

void loop()
{
  maestro.setTarget(0, 6008);
  maestro.setTarget(1, 5984);
  maestro.setTarget(3, 6184);
  maestro.setTarget(4, 6128);
  maestro.setTarget(6, 6016);
  maestro.setTarget(7, 5896);
  maestro.setTarget(9, 5684);
  maestro.setTarget(10, 6060);

delay(1000);
}

The servos will go to the desired position and jitter and try and jerk to the desired position. Sometimes they will successfully hold that position for a short time. If I remove the delay in the control loop all servos will remain relatively close to the desired position, but will jittering uncontrollably. In either case, the red LED on the maestro is on.

However, as soon as I plug my laptop into the maestro and moniter the error log while the Arduino is communicating with the maestro, the maestro works perfectly and all the servos go to the desired positions no problem - no errors listed. Do you guys have any idea what the problem is?

Thanks in advance!

Hello.

From your description, it sounds like you are powering the Maestro (board) and the 8 connected servos from that one power supply. Since you are seeing jittery movements when the Maestro is powered from the same power supply as the servos and not when the Maestro is powered separately, I suspect that the current draw of the servos is causing the voltage of the supply to dip, which might be causing the logic on the Maestro to not work properly. Can you try powering your Maestro with another external power supply, separate from your servos, to see if that fixes the issue?

- Amanda

Thanks for the reply.

That thought went through my head briefly, I don’t know why I didn’t test it at all. I just powered the Maestro with a separate power supply and now the servos are no longer jittering but I am still getting a constant red light on the Maestro. I’m farther than I was before, thanks for the help! I’ll mess around with it more and see if I can get everything ironed out.

I looked at your code briefly and noticed you are using the Arduino Uno’s hardware serial port instead of a software serial port. We do not recommend using the Uno’s hardware serial port because those pins are used by the Arduino IDE’s Serial Monitor and for programming the board. It might be helpful for you to look at the “examples” folder on the maestro-arduino library’s GitHub page to get an idea of how to define a SoftwareSerial object and use that to define the UART pins between your Maestro and Arduino Uno.

I also noticed that you call the reset function in setup, but you did not define the reset pin when creating the Maestro object. The reset pin must be defined if you want to reset the Maestro. Since you do not have that pin defined, the function does nothing. For more details, see the reset function in PololuMaestro.cpp.

By the way, since you are using a Mini Maestro, you might consider changing your Maestro object from MicroMaestro to MiniMaestro. This allows you to use functions defined in the MiniMaestro class that are specific to the Mini Maestros like setting the PWM output, which the Micro Maestros do not have. However, if you do not plan to use those extra functions (setPWM and setMultiTarget), your code should work with MicroMaestro.

- Amanda