nxtprograms.com

Fun Projects for your LEGO MINDSTORMS NXT!

Home     Projects     Help     Contacts

Race Car
Building: Expert
Program: Advanced

Building Instructions


1


2


3


4


5


6


7


8


9


10


11


12


13


14


15


16

The color sensor wire should come out of a gap under the center rear of the NXT.  Connect it to port 3 on the NXT.

The two drive motors connect to ports B and C on the NXT.  The wires should be crossed twice (once under the NXT and another time under the car), so that the B motor stays on the left side of the car and the C motor is on the right side. 

The steering motor wire should come out of a gap under the center front of the NXT.  Wind the wire a couple of times to make it store compactly (it will be hidden behind the windshield built later) and then connect it to port A on the NXT.


17


18


19


20


21


22


Race Car Programming
 
Download Single NXT Programs (help)
 
Download Bluetooth Control Programs (Two NXTs Required) (help)

Four programs are provided for the Race Car: two for single-NXT use, and two Bluetooth control programs designed for use with the 5 Button Remote Control and Steering Remote Control projects (second NXT required).

Single NXT Programs:

  • The ColorRace program demonstrates some example autonomous behavior using the color sensor to react to changes in the color of the surface.  You can create a short "course" for the car to drive and mark actions with different colored tape or strips of paper.  The color sensor can sense six different colors, and in this example program, the actions for the six color numbers are:

    1. Black: Ignored

    2. Blue: Turn left (start turning at first blue line, stop turning at second blue line)

    3. Green: Speed up to full power

    4. Yellow: Slow down to 30% power

    5. Red: Stop

    6. White: Ignored

    The car should be started with the front wheels pointed straight ahead (adjust them before starting the program by turning the knob wheel on the steering motor), and it will start out driving straight slowly.

    Note that autonomous operation is tricky, because there is limited control, and the steering has a lot of mechanical "slop" in it, which makes getting a straight start and consistent turns challenging. 

    You may also need to change the colors used in the program to adjust for the color of your floor and markers used.  To test which color the car sees over various surfaces, use the View -> Color feature in the NXT brick menu and roll the car over various surfaces.

  • The 2ButtonSteer program will control the Race Car with the two touch sensor wired remote control shown in step 22 of the building instructions above.  The car should be started with the front wheels pointed straight ahead (adjust them before starting the program by turning the knob wheel on the steering motor).  Press and hold both buttons to go drive straight, press and hold one button to turn in that direction, and release both buttons to stop.  You can also adjust the speed of the car by using the Left Arrow and Right Arrow buttons on the NXT.

Bluetooth Control Programs (Two NXTs Required):

  • The 5ButtonSteer program is a control program for the Race Car that is designed to be used along with the 5 Button Remote Control project.  See the instructions for this project.

  • The SteerBTCar program is a control program for the Race Car that is designed to be used along with the Steering Remote Control project.  See the instructions for this project.

 

Challenges
  • Some parts of the Race Car design are just for "decoration" to make it look like a car.  Try stripping it down to the essentials, and then design your own body for it to give it a different look.

  • Design a simple color-coded course for use with the ColorRace program.  You will notice that it is hard to get consistent results because of the mechanical slop in the steering and limited sensor input.  Can you think of any other strategies that you could use?  For example, you could make a "road" with different colored stripes along each side that signal the car to turn left or right to get back on the road.  If you drive slow enough, you might be able follow a simple road like this.

  • There is room on the hood of the car where you could mount the ultrasonic sensor facing forwards.  Try to add this and then write an autonomous program that uses it.

  • The 2ButtonSteer program does not have a way to make the car go in reverse.  Given only four combinations of button states (neither, left, right, both), experiment with assigning different actions to the four states to try different ways to drive.  For example, perhaps the car could go straight when both buttons are released and go in reverse when both are pressed (will be interesting driving with no brakes...)

  • As mentioned above, the steering design in this car has a lot of mechanical slop in in, much of which comes from the gears that drive the steering (tan bevel gear driving black 20-tooth gear).  This is called "gear backlash".  Can you redesign the car to turn the steering motor sideways and have it drive the steering arms directly without these two gears?  This would eliminate a lot of the backlash and make the steering more accurate.  However, some backlash will still present be from the NXT motor itself (which has internal gears with their own backlash).

 


 

Home     Projects     Help     Contacts

 

Copyright 2007-2011 by Dave Parker.  All rights reserved. 
All project designs, images, and programs are protected by copyright.  Please see the usage policy.