"simultaneous" Maestro & Tic on same serial line

I can provide more information if needed, such as wiring diagram (though the wiring may be a bit messier than ideal), but first I just thought I would just ask if there was any reason that you knew of that the Maestro and Tic couldn’t both function on a single/common serial line
communicating with an Arduino in a program?

I was working on making a remote control toy tractor using an Arduino
and both a Pololu Tic and Maestro. I’m using a USB Host shield to
connect to a PS4 controller, but have excluded that in the most
reduced code I was testing, but it is the reason why I assigned ports
in the code below to use as RX and TX port.

Distinct ID’s were assigned to the Tic (14) and to the Maestro (12 -
device default I think), and referenced in the code creating the
instance below.
*MicroMaestro maestro(maestroTicSerial, 12);
*TicSerial tic(maestroTicSerial, 14);

I have a code-assigned Arduino TX port, assigned using code:
*SoftwareSerial maestroTicSerial(3, 5); (RX and TX are both assigned here)
running to the RX of each of Maestro and Tic.

I am only using the TX of the Tic (to potentially get information on
position), but am not using the TX on the Maestro (it is not connected
to anything). The Tx of the Tic runs to the code-assigned Arduino RX
port (shown in line of code above).

The Tic works when I comment out the Maestro code. The Maestro works
when the code is present for both (or just the Maestro), but it causes
an error for the Tic (I think Serial error, but can double check if
useful) when the command below is executed:
*maestro.setTarget(wheelTurnPositionChNbr, wheelTurnPosition);

I think I have the ground of both running at least indirectly to the
Arduino, but maybe it’s something as simple as needing a direct common
ground, or a resistor, or such (though I don’t know why a direct
common ground would matter, but I don’t have a lot of background in
this). Mainly, do you know if there is a reason why both the Tic and Maestro
wouldn’t both work on the same serial line (if things are wired
correctly)?

The full code is hopefully uploaded with this (but if I need to copy it in instead just let me know). Two functions at the bottom of the program, ‘ck_errs’ and ‘ck_errs2’, for error checking on TIC using standard function ‘tic.getErrorsOccurred()’ were used in the code I ran, but can likely be ignored here.

Thanks

trctr_cntrl_and_loader_w_ps4_5_14_2022_cmbnd_no_maestro2_rdc5.ino (12.2 KB)

Hello.

It should be fine to use the Maestro and Tic together on the same serial line like you described, as long as they are using different device numbers and you use the Pololu protocol. By default, our Arduino libraries only use the Pololu protocol when you specify a device number in the constructor.

I noticed in the constructor for the Maestro, you are only using two arguments, but the device number for the Maestro constructor is specified by the third argument (the second one is the reset pin). So, the Tic is probably throwing an error since it is receiving a compact protocol command that it does not recognize. You can find more information about the MicroMaestro constructor in the library documentation. Could you try adding a “Maestro::noResetPin” argument between your serial object and the device number and see if that fixes the problem? For example:

MicroMaestro maestro(maestroTicSerial, Maestro::noResetPin, 12);

By the way, you did not mention which specific Arduino board you are using, but if you are using a Mega, Mega 2560, Leonardo, or Micro, you should make sure that the pin you are using for RX supports pin-change interrupts, otherwise it is not compatible with the software serial library. The documentation page for the SoftwareSerial Library has a list of compatible pins if you are using one of those boards.

Brandon

Thank you! That seems to have fixed it. Before this I was really running out of ideas on what it could be, or how to check. Thanks again.

1 Like