Lego MINDSTORMS NXT:

The Lego MINDSTORMS NXT Robotics kit uses motors, sensors, Lego Mindstorms building parts and a small computer called the "NXT Brick" to create Robots that one can program using the MINDSTORMS NXT software.  Like Scratch, MINDSTORMS NXT uses icons or blocks that represent programming commands. 

Definition of a Robot: A Robot is a machine that can be programmed to do a task without being directly controlled by a human being.   There are two parts to a robotic system.

1. Hardware: This is the mechanical robot. The motors, gears, wheels, parts, computers that make up the machine.  This is the part you build.

2. Software:  This is the instructions for the tasks and actions the robot will do.  This is the part you write.

MINDSTORMS NXT is used to create the software that controls the actions of the robot hardware.  NXT MINDSTORMS software is a visual/icon system of assembling instructions.  The flow of direction usually moves from left to right.  This software is an example of a compiled program.  Programs you write in NXT must be compiled and downloaded to the NXT Brick before the Robot will perform the program.  (Scratch and Python are "Interpreted Languages.")

Sample Robot Projects

Example 1: Overview of MINDSTORMS NXT User Interface


Example 2:  Movement Blocks

Movement Blocks direct motors A, B, or C to rotate clockwise or counterclockwise.  The motors have sensors inside them that can measure how much they rotate.  Motors C and B usually are used for the drive wheels on a vehicle Robot.   You may change the following variables on a motor on the details window.


This icon creates a new movement block.



This icon represents the movement block inside the program.


This is the detail window for the selected block.  You may change the following variables:
  • Which motors are controlled by the block (A, B, or C) (B and C are usually the drive motors in vehicle robots.)
  • Direction
  • Steering (B and C working together)
  • Power (Speed)
  • Duration (How Long - How Far)
  • Next Action (Brake or Coast)

Example 3: Loop Blocks

Loop Blocks are like the "Repeat" or "Forever" functions in Scratch.  You may define how many times an action or set of actions is to repeat.  You may also use this like a conditional statement and have the loop work when a sensor or variable presents a certain value.


Loop Icon

Example 4: Switch Block

This is another use of the for conditional statements.  (Like the "If" Block in Scratch)  The Switch Block can use sensors or values to switch between differenct actions.



Example 5: Light Sensor

The Light Sensor senses differences in light intensity (brightness).  This value can be used to sense the light around the robot or differences in reflected light off of surfaces like the floor. 

Example 6: Motion/Ultrasonic Sensor

The Motion/Ultrasonic Sensor uses high frequency sound waves and echos to detect the distance between the sensor and other objects. 

Example 7: Touch Senson

This button can sense in three modes, pressed, released, and pressed and released.  This enables the robot to sense when it is touching or bumping another object.

Sending (Uploading) the program to the NXT Brick. 

In the lower right hand corner of the NXT user interface allows for communication between the computer and the NXT Brick that controls the robot. 



Robot Project 1a: Drive in a Rectangle

Objectives:
Select Movement Block parameters for motors selection, direction, distance, power, and turning.
Use Swing turns to change direction.
Use loop blocks to repeat commands.

Project:
Write an NXT-G program that will drive your robot in a rectangle. 
Use rotations to measure distance.
Use a loop block to keep the program short.
Download and run your program to the robot.

Process:


1.  Open the Mindstorms NXT-G software.  (Double click the orange square icon.)



2.  Name your program "RectangleLastname" and Click "GO."

3.  Drag a Motor Block to the Program Area.



4.  Set the Motor Block Parameters to:
    a. Steering Straight Ahead
    b. Power = 50
    c. Duration = 4 Rotations



5.  Drag a 2nd Motor Block to the Program Area.



6.  Set 2nd Motor Block Parameters to:
    a. Steering All the Way Left
    b. Power = 50
    c. Duration = .55 Rotations



7. Drag a 3rd Motor Block to the Program Area



8.  Set 3rd Motor Block Parameters to:
    a. Steering Straight Ahead
    b. Power = 50
    c. Duration = 2.5 Rotations



9.  Drag a 4th Motor Block to the Program Area



10.  Set 4th Motor Block Parameters to:
    a. Steering all the Way Left
    b. Power = 50
    c. Duration = .55 Rotations



11.  Drag a Loop Block before the 4 Motor Blocks.



12.  Put the 4 Motor Blocks inside the Loop Block



13.  Set Loop Count to "2,"



14.  Plug Robot into USB port in computer. 

15.  Click the Download Button in the Lower Right Corner



16.  After Robot beeps twice, unplug from computer and try on rectangle course.

17.  Select "Software" on the Robot.

18.  Scroll across until you see your program "RectangleLastname."

19.  Put the robot on the table and press the Orange button to start and turn your program.  Press the Grey Rectangle to stop the robot.

20.  Make adjustments to your program as needed to make a square.