How to connect a VEX motor to the Arduino
|
VEX motor types
We have already established that we will be using a continuous rotation servo, labelled by vex as a 'motor module'. However, VEX has recently introduced new motor types that change the way they work - this is important to understand.
The old VEX motor module is a 'Three-wire motor' - so called because its cable has three wires - a signal wire, a power wire, and a ground wire. It is controlled with PWM like any other hobby servo, and is easy to use for our purposes as we already know that the Arduino can supply a PWM output.
The new VEX motors are 'Two-wire motors' - they have only two wires. These are simple DC motors with no internal mechanism for speed control. To properly control these motors via PWM with the Arduino, we will need to use the VEX 'Motor controller 29' which accepts the same inputs as the three wire motor, and converts it to steady voltage for the 2-wire motor using an electrical device called an H-bridge.
Practically, this means that if you are using a Three-wire motor you need to make no adjustments however if you are using a Two-wire motor, you will need to use the VEX motor controller 29. If you use this, you can issue the same commands, and get the same results.
Wiring the Connection with a Breadboard
The base Arduino without a shield does not have any servo/motor inputs, which means we will have to wire the connections manually. Don't panic! It's not hard.
The only extra electrical parts we will need are some jumper cables and wires.
First, take a look at the schematic for the connections.
As you can see, both motors need to have their black wires connected to ground and their red wires connected to 5V. The white signal wires each connect to a different Arduino pin. We will connect the left motor to digital pin 11, and the right motor to digital pin 10. This is because we want to be able to control the motors independently.
NOTE: The motor wires in the image are yellow for visibility reasons. The actual color of the signal wire on the VEX motors is white.
First, we will connect the cables to the breadboard.
Now, we can connect signal wires.
Next we can connect power wires.
Finally, we will connect up the ground wires.