Control 2 motors with Mini Maestro through dual motor driver

I have the Dual MC33926 Motor Driver Carrier and the Mini Maestro 18 channel. I see after ordering that there is only one PWM output. I assumed (did not read clear enough) that all channels would be capable of this. Any ideas on how I can make these two units work so that I can have PWM control over two motors?

Are the output ports fast enough to switch / create my own PWM? Can I run the motor driver off of a single PWM signal by switching back and forth in code?

Any other ideas? I really want to get this thing done and not have to buy more motor controllers. (I am still planning on using some of the other channels for servo, so the servo controller is important).

Thank you for your help,

Mac

Hello,

The Mini Maestros are mainly intended for servos and just have that single PWM output as a bonus feature. There is no way to do anything close to a reasonable PWM on any of the other lines of the Maestro. The only thing I can think of is that you might be able to continuously flood the TX output with serial data at a high baud rate to get a crude PWM with 10 possible duty cycle levels, from 10-100%.

For example, sending continuous 0xFE characters would product a signal that would be low for two cycles and high for 8, for an 80% duty cycle. If that is not good enough for you, you will need to get some kind of a general-purpose microcontroller and program this output yourself, or use one of our motor controllers. Which one you would use might depend on what kind of controller you are using (do you want USB?), but the Jrk 21v3 is based on the MC33926 and the TReX Jr is based on the older MC33887.

-Paul

Thank you for your reply. I went ahead and ordered the TREX so now I have the Maestro and the TREX. My plan is now to control the TREX from the virtual serial port that is available on the Maestro.

Do I just connect the GRD, TX and RX on the Maestro to the LOGIC LEVEL GRD, TX, RX on the TREX? Then send my serial commands to the Maestro? Is it that simple?

Or do I need to use the RS-323 lines on the TREX?

Hello,

It is almost that simple - you need to make sure to connect TX to RX and RX to TX so that each one can receive data that the other is sending. Also, do not forget to configure your Maestro for dual-port mode, identify the correct COM port, and put your TReX into serial mode. The RS-232 lines should not be used.

-Paul

Ok, your advice was perfect. Wiring exactly like you said worked without issue.

I set the Maestro to be in Dual Mode. Then it was just a matter of opening the COM port with c#

My initial test code if someone finds it useful…


SerialPort _serialPort;
        
        
        public Control(string COMMPort)
        {
            _serialPort = new SerialPort(COMMPort, 19200, Parity.None, 8, StopBits.One);
            _serialPort.DataReceived += new SerialDataReceivedEventHandler(_serialPort_DataReceived);
            _serialPort.Handshake = Handshake.None;
            
            _serialPort.Open(); 
            
            //test.

            // Makes sure serial port is open before trying to write

            try
            {

                if (_serialPort.IsOpen)
                {
                    _serialPort.Write(new byte[] { 81 }, 0, 1);
                }
            }

            catch (Exception ex)
            {

                System.Diagnostics.Debug.WriteLine("Error opening/writing to serial port :: " + ex.Message, "Error!");

            } 

            
        }

        void _serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(_serialPort.ReadByte().ToString());

        }

        public void LeftTred(float speed)
        {
            byte direction = 0; 
            Int16 speedTranslated = 0;

            if (speed < 0)
            {
                //reverse //CA
                speedTranslated = Convert.ToInt16( Math.Abs(speed) );
                direction = 206;
            }
            else
            {
                //forward //C9
                speedTranslated = Convert.ToInt16(speed);
                direction = 205; //CA
            }

            byte acceleration = Convert.ToByte(speedTranslated);

            _serialPort.Write(new byte[] { direction, acceleration }, 0, 2);
        }

        public void RightTred(float speed)
        {
            byte direction = 0;
            Int16 speedTranslated = 0;

            if (speed < 0)
            {
                //reverse 
                speedTranslated = Convert.ToInt16(Math.Abs(speed));
                direction = 198;
            }
            else
            {
                //forward 
                speedTranslated = Convert.ToInt16(speed);
                direction = 197; 
            }

            byte acceleration = Convert.ToByte(speedTranslated);

            _serialPort.Write(new byte[] { direction, acceleration }, 0, 2);
        }


        public void Destroy()
        {
            _serialPort.Close();
        }

That is great to hear, and thanks for posting the code!

-Paul