Switch M1/M2 wires for correct rotation


#1

Newbie question here… what is the best way to swap the black and white cables for the M1 connector?

Is there a way to push the terminals back? Should I re-solder the terminals at the motors?


#2

don’t change the polarity of each connector, just put the left motor into the other motor port and the right one in the one the had the left.


#3

M1 is spinning in the correct direction.
M2 is spinning in the reverse direction.

If I simply swap M1 for M2 one of the wheels will continue to have the wrong rotation.


#4

I have the same issue. Switching the wires simply transfers the issue to the other motor. The only current solution is to use negative steps for the other wheel.


#5

Note that this is only in the upgraded firmware, the default program for use with the remote responds perfectly so far.


#6

I thought about using negative values, but then I would lose the ability to use the pre-made block of “Run forward at speed 100” or "Turn right at speed 100"
I’m showing my 7 year old how to use this, to explain why the motor needs to be negative will not be easy.

I also thought of making a custom block, my_move_forward(step), that would send the appropriate values.

But if there is a way to swap the black and white wires, I think it would be best.


#7

The connectors should have the white on the right and the black on the left. If the motor still runs the wrong way and the colors are right you can try switching them without unsoldering. Get a small screwdriver and you can gently push the metal tab for each wire that you can see on the top of the connector. if you first push the wire in, then push the tab down then pull the wire out you can swap them easily.
Let me know if this makes sense. I can try to take some pictures to show you if it doesn’t.


#8

Thanks!


#9

looking at the original source for the default program it has this for the directional code:

void Forward()
{
  MotorL.run(-moveSpeed);
  MotorR.run(moveSpeed);
}
void Backward()
{
  MotorL.run(moveSpeed); 
  MotorR.run(-moveSpeed);
}

Looks like it is supposed to have one running in reverse to go straight. Makes sense since the motors are mounted on opposite sides. I’m fairly sure kids would get this idea if explained properly.


mBot: Program for remote movement doesn't work properly
#10

I’m not clear on why that would make sense. I will take a look at my mbot later and see.

Both my motors on one mbot move in the same direction - backwards. I think I’m going to have to swap the wires on both of the motors.

Update: Thanks for sending that link to the source. I took a look and am even more confused. The code for forward and backwards are the same, just smaller increments for the turning wheel. That makes sense for the turn, I’m used to seeing one wheel backwards and one forwards for a turn but for forward?

Either there’s something wrong with this code or, and this is the more likely scenario, I’m missing something. I’ll investigate when I have more time. Here’s the rest of the code snippet:

void Forward()
{
MotorL.run(-moveSpeed);
MotorR.run(moveSpeed);
}
void Backward()
{
MotorL.run(moveSpeed);
MotorR.run(-moveSpeed);
}
void TurnLeft()
{
MotorL.run(-moveSpeed/10);
MotorR.run(moveSpeed);
}
void TurnRight()
{
MotorL.run(-moveSpeed);
MotorR.run(moveSpeed/10);
}


#11

Beautiful Danjger.
Thanks for researching. It does make sense to have all of the motors manufactured the same way and controlled via software to make them do what you need them to do. Otherwise, they would need to keep inventory of 2 different parts (left motor and right motor), make sure that one of each is packaged in each kit, etc.


#12

And after further inspection… The code makes sense, I was just not understanding it at first.

I also switched the cables on my motors and they are both running the right direction now.


#13