How to connect a VEX motor to the Arduino

From ROBOTC API Guide
< Tutorials‎ | Arduino Projects/Mobile Robotics/VEX
Revision as of 14:07, 27 July 2012 by Dwest (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
ArduinoArduino Tutorials and Guided ProjectsVEX + Arduino, Mobile Robotics Platform → 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.

Parts needed

First, take a look at the schematic for the connections.

Servo connection schematic

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.

Notepad.gif 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.

Placing the servo connectors

Now, we can connect signal wires.

Connecting the power and ground

Next we can connect power wires.

Connecting the signal pins to the Arduino pins

Finally, we will connect up the ground wires.

Servos connected to the breadboard circuit


Servos connected to the breadboard

Notepad.gif NOTE: Many of the following lessons and series of lessons will require the motors connected. Thus, you should leave them connected unless told specifically to remove them.