Maestro not controlling servos properly with Arduino UNO

When I use the Arduino to control the Maestro to interface two servos, this happens:

The servos don’t move in the intended ways…

The hardware is connected like this:

Arduino Pin11 to Maestro RX
Arduino Pin10 to Maestro TX
Arduino GND to Maestro GND

The Arduino also gives power to the Maestro in the video

The code is as follows:

/* This example shows how to control a single servo on a Maestro
servo controller using the PololuMaestro library. It assumes you
have an RC hobby servo connected on channel 0 of your Maestro,
and that you have already used the Maestro Control Center
software to verify that the servo is powered correctly and moves
when you command it to from the Maestro Control Center.

Before using this example, you should go to the Serial Settings
tab in the Maestro Control Center and apply these settings:

* Serial mode: UART, fixed baud rate
* Baud rate: 9600
* CRC disabled

Be sure to click "Apply Settings" after making any changes.

This example also assumes you have connected your Arduino to your
Maestro appropriately. If you have not done so, please see
https://github.com/pololu/maestro-arduino for more details on how
to make the connection between your Arduino and your Maestro. */

#include <PololuMaestro.h>

/* On boards with a hardware serial port available for use, use
that port to communicate with the Maestro. For other boards,
create a SoftwareSerial object using pin 10 to receive (RX) and
pin 11 to transmit (TX). */
#ifdef SERIAL_PORT_HARDWARE_OPEN
  #define maestroSerial SERIAL_PORT_HARDWARE_OPEN
#else
  #include <SoftwareSerial.h>
  SoftwareSerial maestroSerial(10, 11);
#endif

/* Next, create a Maestro object using the serial port.

Uncomment one of MicroMaestro or MiniMaestro below depending
on which one you have. */
//MicroMaestro maestro(maestroSerial);
MiniMaestro maestro(maestroSerial);

void setup()
{
  // Set the serial baud rate.
  maestroSerial.begin(9600);
  maestro.setTarget(0, 7600); //sets channel 0 to 1900 us
  maestro.setTarget(1, 7600); //sets channel 1 to 1900 us
}

void loop()
{
  /* setTarget takes the channel number you want to control, and
     the target position in units of 1/4 microseconds. A typical
     RC hobby servo responds to pulses between 1 ms (4000) and 2
     ms (8000). */

  // Set the target of channel 0 and 1 to 1900 us, and wait 2 seconds.
  maestro.setTarget(0, 7600);
  maestro.setTarget(1, 7600);
  delay(2000);

  // Set the target of channel 0 and 1 to 1100 us, and wait 2 seconds.
  
  maestro.setTarget(0, 4000);
  maestro.setTarget(1, 4000);
  delay(2000);
}

When I only move one of the channels, it works like a charm
Why does this happen? And how do I fix it?

I tried Serial.print(maestroSerial.read()) and I got -1

I did this to hopefully find the type of error, but I don’t know what an error of -1 means…

Hello, did you try the setup and code given here?

It wouldn’t work with that set up as an Arduino UNO lacks the hardware Serial1

Hence why I needed the SoftwareSerial library

It could be better if you could test the maestro with the default pololu example code and a board with hardwire serial1. At least that could reveal if the motor controller is good or faulty. Anyway, let’s see if team pololu comes up with a better suggestion.

Have tried using the Adruino mega (which has Serial1) with that code, the same problem occurs ://

Hello.

That looks like it could be a power issue. You mentioned that the Arduino is powering the Maestro; are you also trying to power the servos from the Arduino?

Brandon

Will try with another power source, thanks for the help :))

Will keep you posted!!