Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Lego mindstorms intro

954 views

Published on

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

Lego mindstorms intro

  1. 1. What is a Robot?
  2. 2. 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.
  3. 3. 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.
  4. 4. 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.
  5. 5. TheThe KitKit
  6. 6. 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
  7. 7. FirstFirst RobotRobot • Build the basic taskbot with no sensors attached located on Page 8 of the Mindstorms Education Book located in your kit.
  8. 8. 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
  9. 9. 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
  10. 10. 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.
  11. 11. 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.
  12. 12. 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.
  13. 13. Programming Activities • Move Forward: • Move_motor_multi.rbt • Move_motor_same_line.rbt • Move_motorblock.rbt • Square Move: • Squaremove_no_loop.rbt • Squaremove_loop.rbt • Circle • Circle_1_moveblock.rbt • Figure 8 • Figure 8_loop.rbt
  14. 14. 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.
  15. 15. 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.
  16. 16. 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.
  17. 17. Lesson 3Lesson 3
  18. 18. Today’s Programs • Detect Sound • Sound Direction • Sound Power
  19. 19. 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.
  20. 20. 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.
  21. 21. 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.
  22. 22. 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.
  23. 23. 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.
  24. 24. 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.
  25. 25. Data Hub Demonstration • The Random Block and a Move block
  26. 26. 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.
  27. 27. 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.
  28. 28. 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.
  29. 29. 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.
  30. 30. 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.
  31. 31. 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.
  32. 32. 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.
  33. 33. 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
  34. 34. 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.
  35. 35. 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.
  36. 36. 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.
  37. 37. Multitasking
  38. 38. 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.

×