How to use an RC controller on Pololu 12 Channel Controller

Hi, I am completely new to using the Pololu servo controller and I need this for a competition, Basically I am building a robot for a search and rescue operation and I have two problems the most important one is finding the easiset way to control the 12-channel servo controller from a long distance assuming that some sort of RC method would be the easiest, the least important being getting two servo controllers to communicate with each other in a master slave configuration. any help will be very much appreciated

Hello.

The Maestro Servo Controllers have no way of measuring the RC pulses from your receiver. To control the Maestro from RC you would have to use some other piece of hardware to actually read the RC pulses and convert to something that the Maestro can use. One option would be the Pololu RC Switch with Digital Output.

Why do you want two 12-channel servo controllers in a master-slave configuration? You can accomplish that by writing an internal script on the master Maestro and using the serial_send_byte command to send commands to the other Maestro, but it might be easier to use one Mini Maestro 24-Channel USB Servo Controller.

–David

Correction, its two 18 channel controllers designed to control 28 servos and sensors, the design is rather complicated and ambitious, but if anything it’s a learning experience. The Idea behind the master slave configuration was that I could use one servo which would have the Sensors, RC receiver. I want the robot to be able to make use of that information as well as respond to remote control signals. Controller 1 would then send the relevant information to control the specified servos on controller 2, that is possible right ? I have literally. had little say in the design process otherwise I would not be struggling so much getting to grips with this equipment.

Yes, that should be possible.

–David

Hi David I was wondering if you could elaborate on the serial_send_byte command, I we have designed a custom controller using a long range am transmitter with an encoder, and a receiver with a decoder on the other end, If I send an input signal and want to move want to activate a servo on channel 8 of the slave device how would I do this and is it possible to test this command from the maestro control centre ?

To achieve that, you’ll have to learn about the Maestro scripting language and then you’ll need to figure out two things and combine them:

  1. You’ll need to figure out how to get your Maestro script to respond to commands from the RC system. Since you will be converting the RC signals to digital outputs, the example scripts in the user’s guide having to do with switches and buttons will be relevant to you. To the Maestro, a digital output from an RC switch is indistinguishable from the output of a button.

  2. You’ll need to figure out how to send a serial command from the master Maestro to the other one. This can be done on the master Maestro’s script using the serial_send_byte command. Here’s a simple example that sends a command to move servo 8 to a particular position:

0xFF serial_send_byte
8 serial_send_byte
140 serial_send_byte

The serial protocol of the Maestro is documented in the user’s guide.

You can easily test parts #1 or #2 from the Maestro control center by writing a simple script, and running it on the Maestro to see if it works.

Does this make sense?

–David

Yes, thanks it clears up a lot. I have managed to work it out now and I should be o.k for a while :slight_smile:

We need a bit more help in this case I have been given a partner to program the pololu and whilst playing around with one of the controllers it was put into bootloader mode and I don’t know how to recover it and I have tried to find firmware to overwrite what was there in the first place, is there a way to remove the controller from bootloader mode that I haven’t discerned?

Hello. You can get the Maestro out of bootloader mode by power cycling it, or driving the RST line low temporarily. Please do NOT attempt to do a firmware upgrade, because there are no firmware upgrades available for you device. --David

I’m having a new problem now. Every time I try to run the send serial byte script, I get a serial protocol error with error code “0x0010”, the servos also twitch rather than move to the required position. Initially i thought it was my software causing the problem but it doesn’t seem to be.

I used the following example code and the same problem persisted.

100 delay # initial delay to make sure that the other maestro has time to initialize
 
begin
  127 0 mini_ssc # set servo 0 to position 127, using the mini-SSC command
  254 0 mini_ssc # set servo 0 to position 254
repeat
 
sub mini_ssc
  0xFF serial_send_byte serial_send_byte serial_send_byte
  return

Could you help me understand what is going on. The robot 70% complete and it all comes down to the Controllers.

I’m not sure why you are getting the serial protocol error, but it’s probably just something odd that happens on startup and shouldn’t cause any real problems. If you clear the error from the Maestro Control Center while your program is running does it come back?

The real problem is that you are not giving the servo any time to reach its target position; you are just changing the target between two different points hundreds of times per second. The servo can’t move that fast so it just twitches instead.

–David

It appears now and again and I think the problem is likely a loose connection between the respective Rx and Tx lines because it only happens when the line is disturbed.

I also have two servo twitch. when tested with one everything was fine. in the “Maestro Control Center” is the same … trying to work immediately with two servos, they immediately go out of their degrees with a crunch of gears, but no error 0x0010. Error 0x0010 when you work out with two servos from Java program.
how to get around?

Hello again, CMYK.

An error code of 0x0010 means that a Serial protocol error occurred. The most common reason for this is that the program sending serial commands to the Maestro sent an invalid sequence of bytes. I recommend checking your java program to make sure you are sending the right bytes. If you cannot find the problem, please simplify the program to the simplest possible thing that causes the error and post it here.

–David

Hello David)

import gnu.io.CommPort;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import java.io.IOException;
import java.io.OutputStream;

public class PololuSerialExample {

      public PololuSerialExample() {
      }

      static void listPorts() {
            java.util.Enumeration<CommPortIdentifier> portEnum = CommPortIdentifier.getPortIdentifiers();
      }

      static String getPortTypeName(int portType) {
            switch (portType) {
                  case CommPortIdentifier.PORT_I2C:
                        return "I2C";
                  case CommPortIdentifier.PORT_PARALLEL:
                        return "Parallel";
                  case CommPortIdentifier.PORT_RAW:
                        return "Raw";
                  case CommPortIdentifier.PORT_RS485:
                        return "RS485";
                  case CommPortIdentifier.PORT_SERIAL:
                        return "Serial";
                  default:
                        return "unknown type";
            }
      }

      public static void main(String[] args) {

            String portName = "COM5";

            try {

                  listPorts();

                  CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
                  if (portIdentifier.isCurrentlyOwned()) {
                        System.out.println("Error: Port is currently in use");
                  } else {
                        CommPort commPort = portIdentifier.open("Owner", 2000);
                        if (commPort instanceof SerialPort) {

                              // we create a output stream for serial port:
                              SerialPort serialPort = (SerialPort) commPort;

                              serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
                                      SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);

                              byte command = (byte) 0x84;
                              int servo = 0;
                              int target1 = 10;
                              int target2 = 10;

                              byte[] bytes = new byte[]{command,
                                    (byte) servo, (byte) target1, (byte) target2};

                              byte command1 = (byte) 0x84;
                              int servo1 = 1;
                              int target11 = 10;
                              int target21 = 10;

                              byte[] bytes1 = new byte[]{command1,
                                    (byte) servo1, (byte) target11, (byte) target21};

                              process(serialPort, bytes);
                              Thread.sleep(3000);
                              process(serialPort, bytes1);

                              commPort.close();
                        }
                  }
            } catch (Exception e) {
                  e.printStackTrace();
            }
      }

      public static void process(SerialPort serialPort, byte[] bytes) throws IOException {
            OutputStream serialStream = serialPort.getOutputStream();
            serialStream.flush();
            serialStream.write(bytes);
            serialStream.close();
      }
}

same thing happens and the Maestro control center if the servo to move the two. Only maesto not write - error against the wrong moves with a crunch of both. even if you move the slider one of the servo

One actuator can I manage.

Your code looks OK to me, but I have a hard time understanding your description of the problem. Is there a problem when you just control the servos through the Maestro control center? If so, we should focus on that problem and not worry about the java for now.

How are you powering your servos?

–David

Yes there are problems with the management servo of Maestro control center.
powering servo so 5v 320mA

A 320mA power supply will probably not be sufficient for multiple servos. We usually recommend that you have 1 A of capacity per servo. For example, if you have two servos try to find a power supply that can deliver 2 A or more.

–David

Thank you David. It worked. I’m not careful, read about three times the power.