I’m running a Maestro 24 channel Servo controller from an Arduino (not a PC), but would like to add another 12 channels. (FYI, I’m using this to control turnouts on a model railroad, and always gotta add more tracks…)
Looking at the Servo Controller Manual, I believe the Hardware is as simple as connecting the new Maestro to the same Rx wire the first one is on. The addressing to get the right board/channel to respond is where I have a question.
I cheated in that I used the prebuilt PololuMaestro.h Arduino program to connect my first board. This was really slick as it was just connect 3 wires and call the above program in my control program.
I can write code to “do stuff” just fine, but when it gets to adding/changing serial address bytes my head starts hurting.
Would anyone have some advise, or point me to what is needed? I assume I will need to modify the PololuMaestro,h program to address multiple boards?? Or is there a setting you can do thru the Command port?
Any help would be appreciated.
You can connect the TX pin from your Arduino to the RX pin on each of the Maestro controllers. If you need to read data back from the Maestros, since you’re using Mini Maestros you can connect the TX pin from one Maestro the to TXIN pin on the other, then the TX pin from that Maestro back to the Arduino’s RX pin (the TXIN input removes the need for an external AND gate). You can find more information about daisy chaining multiple Maestro controllers, including a wiring diagram, in the “Daisy Chaining” section of the Maestro user’s guide.
To distinguish between the two boards, you will need to configure one to have a different device number from the default (12). You can do this by connecting the Maestro to a computer running our Maestro Control Center software and modifying the device number under the “Serial Settings” tab. If you are using our Maestro Servo Controller library for Arduino, you can use a separate constructor for each Maestro and specify the device number as an argument, which will tell the library to use the Pololu protocol, which would look something like this:
#define maestroSerial SERIAL_PORT_HARDWARE_OPEN
SoftwareSerial maestroSerial(10, 11);
static const uint8_t noResetPin = 255; //tells the library you aren't using the reset pin
MiniMaestro maestro1(maestroSerial, noResetPin, 12); //constructor for Maestro with device number 12
MiniMaestro maestro2(maestroSerial, noResetPin, 13); //constructor for Maestro with device number 13
You can find more information about the constructor in the Maestro library’s documentation.
Thank you, that seems straightforward enough!
Then to address a command to the different Maestros would be something like this?
maestro1.setTarget (0, 6000); // sets channel 0 of Maestro 1 to 6000 (1500ms)
maestro2.setTarget (0, 5000); // sets channel 0 of Maestro 2 to 5000 (1250ms)
It would be great to add the info of how to address the different units to the “Daisy Chain on Serial input” section of the documentation - or make a Example program available.
I really appreciate the help.
Yes, that looks correct.
Thank you for the suggestion about the documentation; I will pass it on.