Reversing motors electrically?

is it possible to have a single motor got both forward and reverse without manually reversing wires to terminal?? this question is in relation to having 4 mecanum wheels and having a single motor on the front right and back left to achieve “staffing” and ideas???

Yes, all motors can be put into reverse through the PWM value sent to them

0 is full backward*
127 is stopped
255 is full forward*

*these might be flipped depending on the orientation of your motors, and how your robot is geared.

if it’s a smaller motor like a globe motor or similar, you can use a relay.

ex on relay 1"

relay1_fwd=1;
relay1_rev=0;

this makes the motor go forward.

this makes the motor go backwards:

relay1_fwd=0;
relay1_rev=1;

thanks that helped now in relation to the ifi dash board what exactly do you do with that, is that where you put in those values or in robot c?

In your robot code you relate the input from the joysticks to your pwm values and use pwmxx=relationship in your code loop to send the calculated signals to your speed controlers.

As Joe has pointed out, the Victor speed controllers actually make the polarity change for you. The basis of their design is an “H” bridge motor controller. In addition to speed and direction control, the “H” bridge also allows a shorting function which will dynamically brake the motor by using it as a genrator. This function is selected on a jumper on the controller. It is marked BC and is next to the PWM connector. This can be wired to a digital output on the RC and that would allow software control of the braking function for different conditions.
If you use the default code and find that one or more motors are running in a direction opposite of what you need, then it is acceptable to the reverse the motor leads at the output side only of the speed controller. Wire color code is meaningless for the wires between the motor and the Victor since the polarity changes.
The dashboard port on the OI is a method of looking at the data sent between the OI and the RC. There are various programs available for interpreting the data but the dashboard port is not needed for normal operation. Most teams will never connect anything to it.

Here’s how the “H” in H-bridge gets its name (see thumbnail) - there are actually 4 switches, two used for forward and the other two for reverse, which make an “H” configuration with the load (in this case the motor) in the middle. Normally when the motor is off, all four switches are open, but if the braking function is used then the top two switches are open and the bottom two are closed, providing the short (please correct me if I’m wrong here, Al).

Steve





No, it’s a perfect explanation, Steve.
To take this descussion a step further, the switches in the Victor are capable of switching on and off at about 120HZ and with varying pulse width to accomplish the speed control. The Spike uses the exact same configuration except with relays. A Spike cannot control speed but it can turn on any switch which can allow both outputs to be connected to the positive voltage or the negative voltage which is handy when controlling some solenoid valves.

One thing that I don’t think anyone mentioned is that if you have two CIM motors attached to one gear box, you cannot have one running one way while the other runs the opposite. The gears work together unfortunately.

Be careful. That is absolutely not a universal truth. The need for the all motors to turn in the same or different directions is entirely dependent upon the design of the gear train that combines the motor outputs. We have had many cases in the past where the multi-motor setups we have designed have required counter-rotating motors. This may be caused by physical limitations on the available space which force the use of smaller gears, resulting in an extra idler in the system, or many other reasons.

In some cases, this is actually a very desirable design option. Most here are familiar with the concept of motor bias, in which the motor will perform better when turning in one direction that the other. Consider a typical set up with paired motors on each side of the robot providing mechanical input to the robot mobility system. When the robot is driving, one side is always running “backwards” and against the bias. When attempting to drive full speed straight forward, it is under-running the other side, which is favored by the bias. We usually deal with that by adding software to curtail the input voltage of the “stronger” side, effectively limiting the performance until it matches the “weaker” side. This is a simple and effective solution, but not necessarily an optimum one.

A nice alternative is to throw an extra idler in the gear train coupling the pair of motors on each side. Then when the robot is running “flat out” each side has one motor that is running full speed with the bias, and one motor running full speed against the bias. The net result is that each side has the same speed/torque output, and one side is not out running the other. So the robot runs straight, and doesn’t drive in big arcs when both joysticks are full forward (assuming a dual-joystick OI setup) without any special software.

-dave