Simple Motor Controller 18v15

Hi,

Merry x-mas to you all!

I have 2 SMC’s 18v15 for left and right that are connected to TTL. I send pololu commands to it. I operate the controller in the following steps:

  1. Send forward command to left and right with a certain speed
  2. Send forward command to left and right with a certain speed. In this case the right speed is higher and left is the same speed as with 1, to go left.
  3. Send stopcommand to both controllers to stop both motors.

Weird is that I should send another command because with the first command only left will stop. When I send the second command right will stop also. I was expecting that when I send a stopcommand all motors will stop.

Maybe my way of working is not ok and what I was expecting was not right. Please let me know that also.

Roel

Hello.

It’s certainly possible to stop both motors with a single command. Can you post the exact command bytes you are sending?

- Ben

Hi Ben,

You’re hunch was right, problem with the byte array.

Roel

Hmmm, looks like I still have a problem. Take a look at commands below. In this scenario not all motors are stopped at once.

Command 1

p_deviceIDLeft = 10
p_deviceIDRight = 13
p_motorSpeedLeft = 750
p_motorSpeedRight = 750

                    command = new byte[10];

                    command[0] = 0xAA;
                    command[1] = p_deviceIDLeft;
                    command[2] = 0x05;
                    command[3] = Convert.ToByte(p_motorSpeedLeft & 0x1F);
                    command[4] = Convert.ToByte(p_motorSpeedLeft >> 5);
                    command[5] = 0xAA;
                    command[6] = p_deviceIDRight;
                    command[7] = 0x05;
                    command[8] = Convert.ToByte(p_motorSpeedRight & 0x1F);
                    command[9] = Convert.ToByte(p_motorSpeedRight >> 5);

Command 2

p_deviceIDLeft = 10
p_deviceIDRight = 13
p_motorSpeedLeft = 1000
p_motorSpeedRight = 750

                    command = new byte[10];

                    command[0] = 0xAA;
                    command[1] = p_deviceIDLeft;
                    command[2] = 0x05;
                    command[3] = Convert.ToByte(p_motorSpeedLeft & 0x1F);
                    command[4] = Convert.ToByte(p_motorSpeedLeft >> 5);
                    command[5] = 0xAA;
                    command[6] = p_deviceIDRight;
                    command[7] = 0x05;
                    command[8] = Convert.ToByte(p_motorSpeedRight & 0x1F);
                    command[9] = Convert.ToByte(p_motorSpeedRight >> 5);

Command 3

p_deviceIDLeft = 10
p_deviceIDRight = 13

                    command = new byte[6];

                    command[1] = 0xAA;
                    command[2] = p_deviceIDLeft;
                    command[3] = 0x60;
                    command[4] = 0xAA;
                    command[5] = p_deviceIDRight;
                    command[6] = 0x60;

What do you mean, exactly, when you say that both motors don’t stop “at once”? Your command bytes look correct, but it’s hard to give you much feedback beyond that without knowing what you’re doing with those byte arrays and without understanding what you’re physically observing. What baud rate are you using? Are the two motors the same? Are both motors configured to brake the same amount when speed is zero?

If you want to send the same command to both motors and you don’t have any other devices on the serial line, you can just use the compact protocol. If you send the command byte 0xE0, both motor controllers will receive and respond to the “stop motor” command. However, if you are using two sequential commands, one for each motor controller, and you see a noticeable lag between the response of the two controllers, there is likely a problem somewhere in your code.

Also, the Stop Motor command is a special command that puts the controller into safe-start mode. In a typical application, you will probably want to stop the motors by issuing a brake command or setting the motor speed to zero.

- Ben