lego nxt motor connections

lego nxt motor connections

lego nxt kit ebay

Lego Nxt Motor Connections

CLICK HERE TO CONTINUE




We're sorry, but we could not fulfill your request for /pages/2008/09/05/lego-nxt-motor-wiring/ on this server. An invalid request was received from your browser. This may be caused by a malfunctioning proxy server or browser privacy software. Your technical support key is: 36b3-d090-1756-6707 You can use this key to fix this problem yourself. and be sure to provide the technical support key shown above. This is a guide to using the motors and sensors from the LEGO NXT set with a Parallax Basic Stamp II or BS2.  However, rather than just providing schematics and sample code for the BS2, I'll be providing some theory on how the sensors work as well.  This way, someone using an arduino or other microcontroller should find this guide at least somewhat helpful. //2012/07/hacking-lego-nxt-part-1.html -The latter is a decent guide if you're using an arduino.  But take note that his schematics often show pins 2 and 3 connected to +5V instead of ground.  Pins 2 and 3 are ground for all of the sensors except the button which is just a switch.




Is something difficult to understand, incorrect, or missing?  Leave a comment and I'll see what I can do.  I would like this instructables to be a comprehensive guide on using the BS2 with the NXT set.  If you're using a different microcontroller and you're stuck, I may or may not be able to help but it doesn't hurt to ask. I hope to get an arduino soon, and if this guide does well I will post a complimentary guide for using the arduino with sample codes for that.  Let me know if you'd like that. Step 1: NXT CablesShow All Items First and foremost, we need to connect our NXT hardware to our microcontroller.  There are a few ways of going about this.I split up the wires, stripped them, soldered short lengths of solid-core wiring onto each, heatshrunk each solder joint, and heatshrunk the whole bundle of wires, creating a connector. -In hindsight, you can buy one long wire and make two spliced wires out of it by cutting it in the middle. -Also, make sure you keep your wires in order.  




The NXT wires are color-coded but the mindsensors wires are not. -Some people have made modified RJ-12 cables and others have just worked with the originals. Another option is to buy a female jack from mindsensors which requires little to no messing around with a soldering iron and looks a lot cleaner. Wires are numbered from the latch side right-to-left, so the wire nearest the latch is 1 and the wire farthest from the latch is 6. LEGO color codes them as follows: (See image for reference)« PreviousNext »View All Steps DownloadLike most of my projects, I like to re-use parts I have laying around.  This project is no different.  I found some Lego NXT motors that I decided to control via Arduino and what better way to use motors than to build a robot that wanders around and avoids obstacles?This project isn't super difficult, just a little time consuming.The first task that needed to be done was to see how the Lego NXT motor worked.  The nice thing is, Lego actually provides schematics of the NXT products!  




I downloaded the ZIp file and looked at the schematic for the controller and discovered the following for the motor connector:PIN       Color       Name1           White       MA02           Black       MA13           Red         GND4           Green      4.3V (from NXT Control Unit)5           Yellow     Tach01  (rotary Encoder)6           Blue        Tach02 (rotary encoder)This 9V Lego motor is pretty sophisticated as it has a rotational rotary encoder with 1 degree of resolution and is connected to the Yellow and Blue wires.  I will keep this in mind for a future project!    Also, for this project I will only be using pins 1 and 2 (white and black wires) connected to Adafruit motor breakout board using 5V.To connect the motor to the motor breakout you will need the Lego wire connectors.  They have a special RJ12 connector with the tab being offset.  Since I didn't have any of the connectors and I am too lazy to order any I just cut the end off of one side, stripped the wires back and tinned the stranded wire.  




You can also buy NXT motor breakout boards and connectors.  .Sonar is used to determine the distance of an obstacle.  According to the datasheet it has a range of 2cm to 400cm and has a effectual angle of 15 degrees.To get a distance, the Trig of the sensor gets a pulse of at least 10uS which transmits a 8 cycle 40kHz ultrasonic burst then waits for the response.  When the sensor detects the ultrasonic burst on the receiver, the SR04 Echo pin will go high and delay for a time which is proportional to the distance.  So to get the distance we measure the width of the Echo pin. And in the code you will see that we get a distance in centimeters by taking the width * .035 / 2.The method to do all of this is pretty simple as you can see in the readSensor function of the code.Connect the sensor as follows:Mount sensor to the pan/tilt mechanism and mount the pan/tilt to you chassis.  I mounted the sensor upside down on the pan/tilt kit so it was easier to connect the wires.Step 3 - Motor BreakoutI am utilizing the Adafruit DC/Stepper Motor driver.  




it utilizes the TB6612 driver IC.  This IC can control two DC motors or 1 stepper motor and supply up to 1.2A.Connect the sensor as follows:I am using a inexpensive micro servo that came with the pan/tilt kit.Connect the pan servo as follows:Upload the code to the Arduino.  The code sets up the sensors and motors then starts using the sensor to detect obstacles.  If an obstacle is detected the sensor scans right and left to determine which direction has more room and turns the robot in that direction.There are a few variables that you can modify to help make the robot detect and avoid obstacles better. checkDist - This is the distance used before the robot scans left and right.  If the distance is less than or equal to this variable, start scanning.rightAngle - This is the right position the servo will set once a obstacle is detected.leftAngle - This is the left position the servo will set once a obstacle is detected.centerAngle - This is center point the servo will set after scanning left and right.mtrSpeed - Regular forward speedturnSpeed - used to turn the robot by making one motor turn faster than the other.  

Report Page