3. RobotsRobots
• A machine that is able to interact
with and respond to its
environment in an autonomous
fashion.
• A robot is characterized by
three central capabilities: the
ability to Sense, the ability to
Plan, and the ability to Act.
Sense, Plan, Act.
4. NXTNXT BrickBrick
• The electronic component that
controls the operation of the
robot by following instructions
contained in a stored program.
Based on these instructions and
the data received from any
connected sensors, the NXT can
direct the actions of the robot to
perform a large range of tasks.
5. SensorsSensors
• A device that detects some important
physical quality or quantity about the
surrounding environment, and conveys the
information to the robot in electronic form.
A Sound Sensor, for example, will detect,
vibrations in the air, and
send an electrical signal
to the NXT indicating
how strong those vibrations
were.
7. KitKit ManagementManagement
• Store Kit in same location
• At beginning of class get kit ready
• With 3 min left start cleaning
• Do not loose or break pieces
• Follow instructions
• Keep pieces in correct bin
8. FirstFirst RobotRobot
• Build the basic taskbot with no
sensors attached located on
Page 8 of the Mindstorms
Education Book located in your
kit.
9. ProgrammingProgramming
• Once your robot has been constructed
the next step is to get it to do
something. For that we are going to
have to learn about Programming.
Programming is the act of creating
software or some other set of
instructions for a Computer/Robot.
10100100 10010100 111100101
101010110 1101010101
10. Block ProgrammingBlock Programming
• A block is the basic unit of programming
in the NXT programming software.
Generally, one block represents one
command given to the robot, although
some blocks (such as the Loop block)
are used instead to organize and control
the execution of other blocks. Blocks
perform their operations in order along
the Sequence Beam
11. CodingCoding
• Code: General term for any command or group
of commands in a program. In the NXT
Programming Software, this is one or more
blocks.
• Compiler: The compiler is a part of the NXT
Programming Software that takes the blocks in a
program and converts them into machine
language that the NXT brick can understand and
run. The compiled code is not exactly the same
as the code written in blocks on your computer;
this is why you cannot load the program back
onto the computer once it is compiled and
downloaded to the NXT.
12. Interactive Servo Motor
• The primary source of physical motion in the
Mindstorms NXT system. The Interactive Servo
Motors include both an electric motor (which
allows them to spin the orange barrel portion of
the motor on command) and a built-in rotation
sensor. The rotation sensor allows the NXT to
monitor the amount the motor has turned, and
control the motors accordingly.
13. BlocksBlocks
• Motor/Move Block: Blocks designed to
control motors on the robot. The Motor and
Move blocks can both be used to control the
movement of a robot, and have both
advantages and disadvantages in doing so.
• Loop Block: In the NXT programming
software, a programming block that repeats
sequences of code. Its default behavior is to
repeat the blocks it contains forever, but it
can be configured to repeat them for given
numbers of times, or under certain
conditions.
15. Sound & Display Blocks
Sound Block
Display Block
Use this block to display an image, write some text, or draw a
shape on the NXT’s display screen.
You can use this block to play a sound file or a single tone. To
compose a melody of tones, arrange several sound blocks in a
row with each set to play different tones.
16. The Wait BlockThe Wait Block
• This block lets your robot sense its
environment for a certain condition before
it continues. Use the slider or type in a
value to set a trigger point so that the
program continues when sensor values
are below or above it.
17. Programming Activity
• Sounds.rbt – Use the sound blocks to
make your robot make three different
sounds. They can be words or notes.
• Display.rbt – Use the display block and the
wait block to make something appear on
your screen for 3 seconds then have
another something else appear for 3
seconds. It can be either an image or text.
20. SensorsSensors
• A device that detects some important
physical quality or quantity about the
surrounding environment, and conveys the
information to the robot in electronic form.
A Sound Sensor, for example, will detect,
vibrations in the air, and
send an electrical signal
to the NXT indicating
how strong those vibrations
were.
21. ImportantImportant ConceptsConcepts
• Input: Something which is sent to the
NXT which is used in its program. An
input is typically a sensor value sent by
a sensor.
• Output: Something which NXT sends.
An output is typically power sent to a
motor.
22. The Wait BlockThe Wait Block
• This block lets your robot sense its
environment for a certain condition before
it continues. Use the slider or type in a
value to set a trigger point so that the
program continues when sensor values
are below or above it.
23. BlocksBlocks
• Switch Block: In the NXT programming
software, a Switch block chooses between
two sequences of code. For example, when
configured with a Touch Sensor, the Switch
block might run one series of blocks when
the sensor is pressed and another when it is
not pressed.
• Sound Sensor: An NXT sensor that detects
sound waves and reports the amount of
sound back to the NXT.
24. Programming Activity
• Detect Sound.rbt – a move block, a wait block and a
stop block, create a program that will cause the robot to
stop driving when you clap.
• Sound Direction.rbt – Using Loop, Switch, and move
blocks, create a program that will cause your robot to
drive forwards when it is quiet and backwards when it is
loud.
• Sound Power.rbt – Using a loop block, a move block
and a sound sensor block, create a program where your
robot will go faster or slower depending on the volume
around it. Remember to connect the data hub from the
Sound Sensor Block to the power hub on the move
block.
25. Data StuffData Stuff
• Data: Factual information, like the weight of a robot or the value
of a sensor.
• Data Flow: The process of moving data inside of a program, so
that information coming out of one block as data can be input
into another block as a control.
• Data Hub: A feature of most programming blocks which can be
accessed by clicking on the lower left edge of the block. Note
that sometimes two clicks are required to extend the Data Hub
completely. Data Hubs allow programming blocks to input
(receive) or output (send) data through Data Wires.
• Data Plug:. Each Data Hub consists of a number of Data Plugs,
which carry a specific type of data, including number data, logic
data and text data.
• Data Wire: Wires that connect output plugs from one block’s
data hub to input plugs on another block’s. To create a data wire,
click on a data plug, drag the wire that appears to another Plug,
and click again to wire the two Plugs together.
27. Ultrasonic Sensor
• Ultrasonic sensors generate high
frequency sound waves and evaluate the
echo which is received back by the
sensor. Sensors calculate the time interval
between sending the signal and receiving
the echo to determine the distance to an
object.
28. Programming Activity
• Distance Stop.rbt – Using a loop block,
switch block and 2 move blocks make
your robot drive around until something is
closer that 25cm. When it comes within
25cm of another object it should stop.
29. Programming Activity
• Distance Turn – Using a loop block, switch
block and 2 move blocks make a program
where your robot will drive around and
avoid obstacles.
30. New Blocks
• Number to Text Block -This block will take
a number (like a reading from a sensor)
and turn it into text that can be displayed
on the NXT’s screen. The input number
can be typed in or supplied dynamically by
a data wire.
31. Data StuffData Stuff
• Data: Factual information, like the weight of a robot or the value
of a sensor.
• Data Flow: The process of moving data inside of a program, so
that information coming out of one block as data can be input
into another block as a control.
• Data Hub: A feature of most programming blocks which can be
accessed by clicking on the lower left edge of the block. Note
that sometimes two clicks are required to extend the Data Hub
completely. Data Hubs allow programming blocks to input
(receive) or output (send) data through Data Wires.
• Data Plug:. Each Data Hub consists of a number of Data Plugs,
which carry a specific type of data, including number data, logic
data and text data.
• Data Wire: Wires that connect output plugs from one block’s
data hub to input plugs on another block’s. To create a data wire,
click on a data plug, drag the wire that appears to another Plug,
and click again to wire the two Plugs together.
32. Programming Activity
• Display Distance.rbt – Make a program
where your display screen will show the
distance from your ultrasonic sensor to the
objects in front of it. Use a Sensor Block,
Number to Text block and a Display Block.
33. Light Sensor
• The light sensor includes a light emitting
diode (LED) light source that can be tuned
on and off from software. This allows to
measure either the reflected LED light
shining back from an object or the ambient
light falling on the sensor.
34. ThresholdThreshold:
• A “cutoff” or dividing line between two regions.
One common use for thresholds is to divide the
hundreds of possible sensor readings from a
sensor (a Light Sensor can give a value
anywhere from 0-100, for example) into two
manageable categories.
Threshold = Value A + Value B
2
35. Programming Activity
• Stop at line.rbt – using 2 move blocks,
and a wait block– make a program that will
cause your robot to stop when it drives
over the black line.
36. Programming Activity
• Follow Line.rbt – Using a loop, switch
and 4 move blocks create a program that
will cause your robot to follow the black
line.
37. Programming Activity
• Basic sumo.rbt – create a program that
will cause your robot to drive around
inside the black sumo wrestling ring, with
out falling out. – Loop, move, wait blocks.
39. Programming Activity
• Multitask.rbt – Using your basic sumo
program, make it so if it senses an
opponent closer that 30cm it will charge
forward really fast.