Connecting a Lego NXT motor to the Arduino

From ROBOTC API Guide
< Tutorials‎ | Arduino Projects/Mobile Robotics/Lego
Revision as of 18:45, 7 August 2012 by Pgp90 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
ArduinoArduino Tutorials and Guided ProjectsLego + Arduino mobile robotics platform → Connecting a Lego NXT motor to the Arduino

Connecting the Motor

Now that we know what a motor is, we want to connect it to the Arduino board so that the Arduino can give commands to the motors. There's just one problem: Neither the Arduino Uno nor the DFRobots Motor Shield have a connector that can accept the LEGO Motor jack. So we need to get a special part, a little chip with a NXT jack attached it and six connectors that go into the breadboard. This component is called an "Breadboard Connector Kit for NXT" and can be purchased at Mindsensors.com

The NXT jack with NXT connector wire
The NXT jack to wiring converter

Now that we have a way to get from the motor jack to individual wires, we can connect to the blue motor ports on the DFRobot Motor Shield. For this, we will only be using the two rightmost pins on the converter piece, the ones labeled AN IN and GRND. AN IN should be connected to the slot labeled M1+ for the left motor or M2+ for the right motor, and GRND should be connected either to M1- (again for the left) or M2- (for the right).

The breadboard setup
The virtual breadboard setup
The virtual breadboard setup
The motor shield
The motor shield with wires
The connection jacks
Full virtual setup

Notepad.gif NOTE: The screws in the motor connectors on the DFRobot Motor Shield may need to be loosened or tightened so that your wires fit in securely

The Importance of the DFRobot Motor Shield

The DFRobot Motor Shield is a necessity for the operation of the LEGO robot because of the motor configuration of the NXT motor. Unlike many other servos, the NXT motor only has two wires, an input and a ground. Thus the pin providing input to the motor must also provide power to it, which the standard digital or analog ports do not. So, the specialized Motor Shield ports (see the pictures above) are necessary, as they provide both functions. The DFRobot Motor Shield can be purchased from robotshop.com