LEGO Mindstorms Class:  Lesson 2

Build A Mindstorms Vehicle - 5 Minute Bot:
 (Copied from

We will build a 3-wheeled robot vehicle with two motorized wheels, and an extra wheel that can pivot, called a "caster".  It is possible to build a robot with 4 or 6 wheels, or with treads, like a tank, but the 3-wheeled robot is the easiest to program, so that's what we'll use.  A robot with a caster generally runs best on very smooth, flat surfaces, so that the caster can glide easily.  For rougher surfaces, 4 wheels or treads may work better.  Follow the steps below to build the robot vehicle.

Step 1:  Attaching Wheels to the Motors

Step 2:  Attaching Angled Beams to the Motors

Step 3:  Adding Wheels and Motors to the Bot

Step 4:  The Attachment Bar

Step 5:  The Caster



Step 6 - The Wiring:        Use two medium length (35 cm) wires to connect the motors to ports B and C on the NXT.  Make sure that the motor on each side is connected to the port on that side.

That's it!  You made a robotic vehicle!

Making the Robot Move:

Move Block vs. Motor Block

To make the motors turn, we can either use the Move  Block or the Motor Block.

There are several differences between the two blocks, but the biggest is that the Move block can control one, two, or three motors at one time, while the Motor block can only control one motor at a time.  The Motor block allows you to control the motor in more detail, but for driving, you usually want to have at least two motors running two wheels at the same time.   This is why we'll stick with the Move block to drive our robot.

The Move Block

  The Move block controls one, two or three motors simultaneously.    

Look at the settings for the move block.   Let's figure out what each one does:

Moving in a Straight Line

Let's figure out how far the car will go when we input certain data to the Move Block.  Create a simple program in NXT-G, consisting of a single Move Block.  Save it in your folder on the S drive with the name "Move Test".  Use this program to answer some of the questions below.  You may need a calculator:


The robot will always turn when its wheels spin at different rates.   In most cases, it's hard to predict where it will go when both wheels are turning at different rates, so we'll focus on two kinds of turns that we can predict:  Pivoting in Place, and Turning with One Motor.  You can control which kind of turn you make with the steering setting.  The following steering values give you the following different kinds of turns:

Steering Value

Steering Results


Pivot in place to the right


Turn to the right using one motor


Go straight


Turn to the left using one motor


Pivot in place to the left

Pivoting in Place

If you turn both motorized wheels in opposite directions at the same power (speed), the vehicle will pivot around a point halfway between the two powered wheels, as shown in the picture below.  The wheels travel around a circle whose diameter is the length of the axle.  

The tricky part is to figure out how many rotations the wheels need to complete a single turn.  Let's do the calculation, and then compare it to real life by programming our vehicle.  You will probably need a calculator:

Let's program our Move Block to test our answer.  Slide the Steering slider all the way to the right to specify a right turn about the center of the vehicle. Put the number of rotations from answer 3 above into the Duration setting to specify how far around the vehicle will turn.


Turning with One Motor

If you give power to only one motorized wheel, while holding the other one still, the vehicle will pivot around the unpowered wheel.  Let's do a calculation like we did above.  Remember, in this case, the diameter of the circle the car makes is two times the length of the axle.

Let's program our Move Block to test our answer.  Slide the Steering slider to value 50 to specify a turn to the right using one motor. Put the number of rotations from answer 6 above into the Duration setting to specify how far around the vehicle will turn.

Commenting your program:

Now that you know how to go straight and turn, you can combine a series of move blocks in a row to make your robot follow a certain path.   When you have a lot of Move blocks in a row that look similar, it is a good idea to place comments near each move block so that you know what it's doing.  That way if you have to make any changes, it's easy to find the right place.  You can add comments to your program using the comment tool  at the top of the NXT window.   An example of a commented program is below:

Challenges for You

(1)  Can you write a program to make the Robot travel in a 12 inch square, using only 2 move blocks?

(2)  Your instructor has set up a maze lined by blocks.  Can you program your robot to navigate the maze without knocking over any blocks?  Note:  Before you start programming, measure the distances in the maze to predict where you want your robot to go.  You will probably have to adjust your program afterwards, but you will have a good starting point.

(3)  Your instructor has set up a "parking garage" made of blocks.  Can you drive  your vehicle from the starting point to park in the garage, without knocking over any of the blocks?