LESSON 2: So What’s in the Tubs?
Activities/ Challenges
Teamwork Activity:
“Lego Builders Greet around the World” is an activity for members to learn new handshakes for greeting other Lego Builders in other places and then come back to those handshake partners to discuss a topic. You can find the “Lego Builders Greet the World” Activity in the The resource sheet for this activity can be found in the Team Building Activities folder. No supplies needed.
So What’s in the Tubs Activity:
Getting a chance to open the tubs and see what is in them is a fun way to start the process of learning. So let’s open the kits and get your hands on probably the most important pieces in each of the kits to use when building.
A great resource piece for you to have available as you are going through the kits is from Carnegie Mellon Robotics Academy and can be downloaded from http://www.getsetsite.org/nxt/LEGO%209797%20Part%20Names.pdf
This is a wonderful resource for adults but used sparingly by youth as they just look at the robot building instructions and build not caring what the name of something is or they may already be familiar from past building with the pieces. It is good to mention the names of some of the pieces as you go through to remind them as engineers, they will need to know names of many elements of construction when they have to ask for some part from others or need to refer to a part in their building instructions and may not always be able to refer to the visual pictures of parts.
CARDINAL RULE WHILE WORKING WITH THE TUBS: When you remove a tray, the tray must be set flat on a sturdy surface to insure that it won’t get knocked off or spilled.
|
NXT Brick. It is a mini computer and will be where you download your robot programs to make them run the robot. It has two sets of ports: on top, you have ports A,B, and C which will be used for the motors and on the bottom, ports 1, 2, 3, and 4 which will be used for connecting the sensors to the brick.
For more info on the NXT Brick: https://cs4hsrobots.appspot.com/unit?unit=24
|
|
3 Motors which will connect to the B and C ports for the drive motors and the Motor Port A for an attachment or grabbing mechanism motor.
|
|
Touch Sensor. There will be two of these. The sensor is activated most commonly by the front button being pushed when it bumps into an obstacle or object.
|
|
Ultrasonic Sensor. It sends a signal out one side and receives that signal back in the other socket which will tell it how far away (distance in inches or centimeters) it is from the object that reflected the signal.
|
|
Light Senor. When activated, a red colored light is emitted and the amount of light that a surface reflects will indicate how light or dark that surface is. Light colored surfaces reflect more light and dark surfaces absorb more of the light.
|
|
Sound Sensor. Probably the least used sensor with the NXT Robot because the amount of sound in a room of students working is quite loud. You can take it out in the hallway and make the robot start or stop on a clap or loud command.
|
|
Motor and sensor cables. You should have seven in your kit, one for each motor and one for each sensor if all are connected. They plug in like a telephone cord.
|
|
USB Computer cord. This will connect your computer to the top of the NXT Brick. It is a basic USB Printer cord in case you ever have to replace it.
|
Some other pieces you will need from the tubs are Wheels
|
|
|
Tires. You will find five different types and sizes of tires in the tubs and a set of tracks.
|
A couple other pieces you will need to know about
|
|
|
Beams. These beams are referred to in the building instructions by the number of holes in the beam ranging from 2 to 15 holes.
|
|
Axles. You will also find a lot of axles which are measured by the number of holes on a beam that they cover up. A #5 axle when set over a beam will cover up five of the holes on the beam. This is very important in building when they ask for a #8 axle, you just find a long beam and lay the axle along the beam to find one that covers 8 holes.
|
|
90 Degree Bent Beams. You will also find 90 degree bent beams which will be referred to by the number of holes…a 3 x 5 has three holes on the bottom and five going up
|
|
Angled Bent Beams. There are also bent beams of different angles which you probably will just recognize by the picture in the building instructions
|
Joining pins are probably the last important pieces to be able to identify
|
|
|
Short Pins. Short pins are black. These will join two pieces connecting them together. There are 120 of these in your kits so you will use these a lot.
|
|
Long Pins. The second most common pin is the long pin which is blue—but may appear in building instructions sometimes as black as older kits had black long pins. This can be confusing to tell if the pin was short or long since they changed the color to blue. These will join three pieces together.
|
|
Axle Pins. Axle pins can fit into a round hole on a beam or hanger and a cross hatched hole that you will find on some bent beams and other pieces.
|
|
Gears. There is a whole assortment of gears that you can use to make a robot or motor go faster or slower or cause a claw to open or close. We will spend a lesson on learning how gears work for speed or torque.
|
Most of the other pieeces you will match up with the pictures on the building instructions to find and use them.
|
See Full Inventory in MindstormNXTInventorySheetCombined979797 & 979695.pdf or LEGO 9797 Part Names.pdf found in the Robotics Resources
|
Those are probably the most important pieces to recognize.
REPEATED--CARDINAL RULE WHILE WORKING WITH THE TUBS: When you remove a tray, the tray must be set flat on a sturdy surface to insure that it won’t get knocked off or spilled.
-
Some Very Important Building Notes--
-
The Long Pin is actually blue but may appear as black in many of your building instructions. The first NXT kits started with a black short pin—a connector that can connect two pieces—and a black long pin—a connector that can connect up to three pieces together. They changed the Long pin color to blue so that it could easily be distinguished in building instructions from the short pin. You will find many of the building instructions posted on the Internet were published during the black long pin era, so you will need to look carefully to see the long pins if not listed in the parts list for the building model and use the blue long pins, which most likely your kit will have, in the black long pins place.
-
When the building instructions have a number next to them, the number with the x is the number of those pieces that will be needed and a number next to a beam or next to an axle is the length of the piece. When the instructions list a #12 axle, lay the axle over a beam and count the holes that the axle covers to tell what size axle it is. Find one that covers 12 holes on a 13 or 15 beam.
The way to find the correct size beam piece is to count the number of holes in a beam and that will the size of the beam so if it calls for a #15 beam, look for one with 15 holes—
A Great Piece on Building Tips and Tricks for NXT Robot Building is at LEGO engineering:
http://www.legoengineering.com/wp-content/uploads/2013/06/NXT-Building-Tips.pdf
-
Some Defaults are very important in connecting your motors and sensors to the NXT Brick
-
When you hook up the cords to the two drive motors, ALWAYS connect them in the B and C ports on the top end of the brick. Use the A Port connection for an attachment motor that may operate a pinching mechanism or lifting arm. The reason is that when you go to program your robot, a move block in building a program to move the robot, forward or back will always list the default motor ports of B and C for the drive motors. If you choose to use other ports than the B and C ports, like A and B or A and C, you will have to remember to change the move block EVERY TIME YOU PROGRAM using a move block, which I can guarantee will be a problem when you forget to change the move block to your A and B ports, your robot will not move correctly. So don’t fight it. Just plug your drive motors into motor ports B and C in the top of the brick.
-
When hooking up your sensors to the brick on the bottom of the brick (sensor ports 1, 2, 3, and 4), always use the default port to hook up the cords from the sensor to the brick. When you bring out a Touch Sensor program block in programming your robot, it will automatically figure that the touch sensor is plugged into the Port 1. So unless you want to change the programming block in the software each time you move a sensor programming block into your program, always use the sensor’s default port which are—WRITE THESE DOWN AND HAVE THEM HANDY when adding sensors to your robot build:
PORT 1 – Touch Sensor
PORT 2 -- Sound Sensor
PORT 3 -- Light Sensor
PORT 4 -- Ultrasonic Sensor
A great resource explaining the NXT Sensors and their use is at LEGO engineering:
http://www.legoengineering.com/nxt-sensors/
You have many choices when it comes to building your first robot, just remember the simpler the building plans, the quicker you will have a robot to begin programming. Sometimes building a simpler robot as your first robot is preferred so you can get programming. A more complicated robot will take an hour or two to build before you can start programming it.
Included here are several plans for building robots from several sources:
Domabot –fastest robot to build in 20 minutes so you can get to programming quicker. Domabot building plans can be viewed or downloaded at: http://www.damienkee.com/storage/domabot_build.pdf or adapted complete instructions, “Domabot Full Robot Build with all Sensors” can be found in the Robotics Resource Pieces folder.
-
Five Minute Bot—probably the quickest and easiest robot to build, but it has a fixed back wheel which will run fine on a smooth floor, tile or vinyl flooring, but will have difficulty turning on carpet with the fixed wheel in the back: http://www.nxtprograms.com/five_minute_bot/steps.html
The Domabot or Five Minute Bot can both be adapted to have a ball back wheel which makes for easier turning on all surfaces as the ball just rolls. The back wheel building instructions can be viewed or found in the Robotics Resource Pieces folder.
-
The LEGO Mindstorm Tri-bot building instructions are found in the booklet included with your LEGO Mindstorm NXT Kit or can be downloaded or viewed at: http://www.getsetsite.org/robokids/downloads/NXT/BI%20Driving%20Base.pdf
-
Many other NXT Vehicle plans can be found on the Internet by just searching on “NXT Building Instructions.”
Some vehicles that we have been successful in building and programming are:
-
Several vehicle building instructions can be found at NXT Programs.com: http://www.nxtprograms.com/projects1.html and choose “Cars and Vehicles.”
Those which we have successfully built and programmed: (Just click on the Building instructions under the picture of the robot when you get to the webpage)
-
Castor Bot: http://www.nxtprograms.com/castor_bot/index.html (This is the base robot for most of the vehicles at this site and you can add other attachments to make other vehicles using sensors as seen in the next two robots)
-
Bumper Car: http://www.nxtprograms.com/bumper_car/index.html (The Castor Bot with a front touch sensor attachment)
-
Mini Sumo Bot: http://www.nxtprograms.com/mini_sumo/index.html (The Castor Bot with a light sensor attachment and an inclined plow)
-
Multi Bot. Just click on the Vehicle Building Instructions or Vehicle Variations Building instructions to see how to modify the original construction for variations like the tracked Multi Bot or SUMO Pusher which adds a plow to the tracked vehicle variation. Just click on the building instructions after building the original vehicle: http://www.nxtprograms.com/NXT2/multi-bot/vehicle/steps.html
-
Three Motor Chassis is another sturdy base robot build from nxtprograms.com. It features a third motor sticking out in front of the robot to use for lifting or attaching an arm: http://www.nxtprograms.com/NXT2/3-motor_chassis/
-
The Catt Bot building instructions from Carnegie Mellon Robotics Academy: http://www.education.rec.ri.cmu.edu/content/lego/building/build_shows/cattbot.pdf
When you have built a couple of vehicles and the team is looking for a build challenge, you can check out some very challenging builds in the Robotics Resource Pieces folder.
-
One challenging but sturdy build is for the Grand Four Belt Rover at LEGO Education. It will take several days to build, but uses gears and is a very sturdy robot.
LESSON 3: Let’s Get the Robot Moving
Once you have a robot built, it is time to begin using the LEGO NXT Mindstorm 2.1 software to have your robot move.
PROGAMMING the LEGO Mindstorm NXT
There are several good online sources for your first NXT Software experience, opening the software and using the Programming Blocks along with saving and downloading the program to the NXT Brick.
If your team is not familiar with the NXT Brick buttons, controls, and screens, an excellent video of introduction is the Educational Robots for Absolute Beginners Lesson 3.1: https://cs4hsrobots.appspot.com/unit?unit=24&lesson=31
-
NXT Tutorial—Oregon Robotics STEMcentric, Move Block—Writing your first NXT Program: http://www.nxt-tutorial.stemcentric.com/Move.html
-
Educational Robots for Absolute Beginners—3.2. Writing your first Program! This is actually a lesson to program your robot to say “Good Morning,” but it is a good tour of programming your first program and what tools are available on the programming window: https://cs4hsrobots.appspot.com/unit?unit=24&lesson=32
After running this video tutorial, then go to the 3.8 Dancing Robot lesson to get your robot moving: https://cs4hsrobots.appspot.com/unit?unit=24&lesson=38
-
Another NXT Programming Mentor Resource would be to find out if you have any FLL members or alumni who would have worked with the Mindstorms NXT 2.1 software in participating in FLL over the last few years and would be very familiar with the software. This might also be a position of leadership if you have any youth in your group already familiar with the software along with those who are new to the software program. They may know the software, but may need your assistance in figuring out how to share their knowledge with your group.
If your team is familiar with the NXT Programming software, you can move on to your first Robot Programming Challenges.
Basic NXT Mindstorm Programming Lesson
-
Once you have your ROBOT Built, it is time to program your robot.
-
Open the NXT 2.1 Program. It is the icon on your desktop that looks like a little box within a box.
-
-
When the program opens up it will look like this
-
-
Give your first Program a name Forward Back
-
Then click on Go.
-
So let’s look at the screen and see what tools you will use to program your robot.
-
We will be programming with the “Common” Pallet, so check your Tools and make sure they look like this.
-
You can change it by clicking on the bottom icons. The common pallet is accessed by clicking on the green circle icon on the bottom of the tools palette.
-
The way to build a program is to click on the Move Block, the one with the two gears and drag it over on to the Program Beam.
-
Any time you bring a programming block onto the Programming Beam, it opens up a control box down below that requires you to give the program block some directions.
-
For a “Move” Block, you will get these lines for giving the programming block instructions:
-
Port: When you bring a move block onto your Program, it will always default to having Motors B and C checked. This will run both motors for the robot to move forward or backward in moving your robot. You will find times when you want the robot to turn and you will need to click only Motor B or click only Motor C to control just that one motor for doing a point or swing turn. You will choose only one motor, Port A, when you want an attachment motor controlling some attachment to operate in opening or closing and lowering some attachment.
-
Direction: this is where you will set the robot to drive forward, Back or Stop.
-
Steering: By moving the arrow to one side or the other, it will cause the robot to turn in that direction. You can try using this to turn to one side or the other, but you will find that this process of turning your robot is not real precise so we use a programming method to turn the robot more precisely which you will learn in the Turns Lesson.
-
Power: This is where you will set how fast you want the motors to run. It will always start at 75% and you can speed it up or slow it down. When you are going straight forward or back, you can go at 100%. If you are turning, you will need to slow it down. Why do you think you need to slow it down to make turns? You may use the example of riding bike at full speed and trying to make a sharp turn.
-
Duration: The most common setting you will use is Rotations. This tells the robot how many times for the wheel to turn with this move block. A rotation is one complete turn of the wheel. Other settings on the Duration are Unlimited which is used when you use a sensor. Degrees is another setting where you can set the wheel to turn by degrees (360 degrees is one turn of the wheel). The last setting is seconds which sets the number of seconds that the motor runs. You will use the Rotation setting most of the time. In the rotation setting, you may find that five rotations is not enough and six rotations is too much, so you will need to use a decimal point in your turn instructions. In the previous example you might try 5.5 or 5.6 to move the robot more than five but less than six.
-
Next Action: This will tell the robot to brake or coast when done with the move block. It will start on Brake and you will leave this setting on brake most of the time. So, if you want the robot to go forward and then back, you will use two move blocks—one to go forward and one to go reverse.
-
Let’s finish talking about the Programming Screen. On the top of the programming window are a row of small icons that are shortcuts to opening, saving, doing a save as which you can probably just figure out by the icon shape or if you hover your mouse over top of the icon, the name of that icon will pop up for reference. This provides the same function as clicking on the File Menu and then clicking on the action for the file.
-
Save Icon or File Save As
-
New Program Icon
-
Open File Icon
-
MOST IMPORTANT. Once you have a program and you need to get it to your robot, do the following:
-
You must connect the USB cord to your computer and to the top of your Robot Brick
-
Your robot must be turned on
-
Then click on the DOWN Arrow on the square at the bottom left hand side of the screen to download the program to the brick.
Now it is time to program your robot to move forward and to move back. If you did not create the Forward Back program when you opened the software, then click on New File and Save As and type the name into the save window and save the program. Using the common programming pallet, bring a move block (two gears) out onto the programming beam. Now set this block to go at 100% speed forward 5 Rotations. Now bring a second Move Block onto the Programming beam next to the first and set this move block to go at 100% in reverse for 5 Rotations. Now download this program onto your brick. Once you have your robot moving forward and then back you are ready for your first set of Robot Challenges.
ROBOT PROGRAMMING CHALLENGES
Adult Leader Setup: For this first series of Challenges, you will need to use 1 inch Blue Painters tape. Place a strip of tape (3-5 foot long depending on the number of robots that will be doing the challenge) down on the floor as your starting line for all of the challenges. Then place another strip of tape equal in length down parallel to that line about 6 feet from the starting line. Then place another piece of tape equal in length down parallel 4 feet further along from the second line
-
Challenge 1: Start behind starting line. Go past the second line and back behind the starting line.
-
Challenge 2: Start behind starting line, go past the last line and end up back behind the starting line.
-
Challenge 3: Do both. Start behind starting line. Go past the first line and back behind the starting line AND Start behind starting line, go past the last line and end up back behind the starting line.
-
FINAL CHALLENGE>>>>> The most accurate Drag Race. Start at starting line, go past the second line and end up as the first robot back BUT THE ROBOT MUST end with a wheel touching the start line. The first one back that has a wheel touching the starting line wins. So first one back, but without a wheel touching the line, will not win.
LESSON 4: Let’s Turn the Robot
Activity
A Quick Engineering Break:
Supplies needed: a ruler for each team working with a robot
You have learned to move your robot forward and back, but now it is time to add a little calibration to your engineering skills.
-
How far does your robot travel in one rotation? Record this value for using later.
-
How many rotations does it take to move your robot one foot? Record this value for using later.
-
Now how could you use this information for estimating the number of rotations to travel a measured distance?
-
TAKE THE SIX TILE CHALLENGE to use this new rotation calibration measurement.
-
Measure out six tiles and put tape at the beginning and end of the six tiles. Using only your calibration skills write a program to go that exact distance. You will get one attempt and no practice runs, so be as accurate as you can in your rotations or degrees setting for your move block. Then take the challenge. How did your calibration measurement of rotations or degrees help?
Besides your robot driving straight, the other most used driving program instructions will be to turn your robot. There are basically 3 ways you can turn your robot.
So let’s begin by explaining what a point turn and a swing turn are:
-
A Point turn is where the robot powers one wheel forward and one wheel backward and the robot will appear to turn on a point as if it were pinned to the ground.
-
A Swing turn is where the robot moves one motor forward and the other motor is stopped. The robot with one wheel turning swings around the stopped tire.
-
A third type of point turn is to use the steering mechanism on the move block and pull it to the right or left almost to the end to make a right or left turn. These turns are not as precise as programming a swing turn or point turn. Using the steering mechanism on the move block can be experimented with, but in many years of doing workshops, we have found that programming a point turn or swing turn is more accurate in turning.
SPECIAL NOTE #1 on Turning: Whether you're trying to do a point turn (pivot in place) or a swing turn (one wheel is stationary while the other turns), you need to understand that entering "degrees" in the move or motor blocks is not the same as telling the robot how far to turn. Entering degrees in duration field tells the motor(s) how long to rotate the hub. 90 degrees moves the motor hub one quarter turn. 360 degrees turns the hub one full rotation.
SPECIAL NOTE #2 on Turning: When you are learning to program your robot to make a 90, 180 or other degree turns using either the point turn or swing turn, you will need to adjust the duration of the motor or motors turning to make a precise turn to the left or right or turning around. This will take some time. When you save the precise 90 degree turn, you may open this file at any time to copy the turn and paste it into another program whenever you need a precise 90 degree turn. This is the cool part of programming. You can copy any precise move to another program when you need a precise turn or if you remember how you programmed that turn, you can recreate those blocks in another program.
To understand the two basic programming turns, the point turn and the swing turn, there are two good sources for teaching this and programming for these turns. The basics of the turns are described below. For more help on the turns, go to online resources:
-
This set of YouTube Videos by Robotics Tutorial is probably the best description and programming instructions on the point and swing turns with the NXT.
-
https://www.youtube.com/watch?v=o3hFuVPax-k Description and visual of the robot turns
-
https://www.youtube.com/watch?v=p2qzWnUivDw Programming a Swing Turn, one motor forward, one motor braked. You will need to adjust your rotations on the moving motor to make a more precise 90 degree turn.
-
https://www.youtube.com/watch?v=tqNYrNt2tl0 A right turn or left turn using the steering mechanism of the Move Block.
-
https://www.youtube.com/watch?v=XJr-RDlgKCg Point Turn using a rotation sensor block. Pretty simple and it works.
-
Your Program for using the Motor Sensor Block is:
-
Place two move blocks on your program beam. On the first one, uncheck Port C and set the duration to unlimited going forward. 0n the second move block, uncheck B and set the duration to unlimited.
-
Move Block 1…Motor B Forward Unlimited
-
Move Block 2….Motor C Reverse Unlimited
-
Then bring a wait Control Sensor block on to the program Beam and change it to Sensor and choose rotation sensor and set it to Port B Forward and Wait until Forward arrow checked and > and set to rotations and try 1.75 to start with. You will adjust this rotation setting duration to make a good square 90 degree turn.
ANOTHER POINT TURN INSTRUCTIONS USING TWO MOTOR BLOCKS: There were no videos on how to program a simple Point turn with two motor blocks, so please use the following instructions for programming a simple point turn where both motors are running at the same time, one forward and one backward.
In Point Turn Programming, you will need to use a motor block which is found in the Complete Pallet tool set. You can select it by clicking on theThree colored boxes at the bottom of the pallet window.
You will find the motor block in the Action tools by clicking on the 2nd box down on the complete palette on the lime green box and click on the single gear graphic and drag onto the programming beam. It will default to motor A when first placed on the programming beam, so you will need to change it to B or C for programming the point turn.
Motor Block shows single gear
Drag two of them out onto the Programming beam and set the Motor Block 1 to:
B Motor
Forward
Action Constant with Power 75%
Duration 1 rotation for now until you fine tune the turn.
Leave motor power unchecked AND most importantly unclick “Wait for Completion” so both motors will turn at the same time—one going forward and one going backward
Motor Block 1—symbol single gear
Motor Block 2-- symbol single gear
Set the second motor block 2 to:
C Motor Reverse Action Constant at 75%
Duration 1 rotation for now until you fine tune the turn
And leave Wait for Completion checked and Next Action Brake
Once you fine tune this turn to 90 degrees, you can now copy and paste this set of two motor blocks in any program where you need to turn 90 degrees and your robot will execute a nice 90 degree turn for the program.
ROBOT PROGRAMMING CHALLENGES
90 Degree turn
Place two pieces of tape on the floor creating lines perfectly perpendicular to each other to run your robots to test if they are turning exactly 90 degrees.
Follow the Maze Challenge
Your Challenge—have your robot complete this simple maze.
Tape off the floor in the dimensions of the Maze. Robot must enter from behind the start line and stay within the maze borders and exit on the other end.
The maze should be three feet wide and proceed as follows:
--Straight for 3 feet
--Turn 90 degrees right
--Straight for 10 feet
--Turn 90 degree left
--Drive straight out over the finish line
The Square Challenge
Now that you can drive your robot forward and you can make 90 degree turns, it is time to tape off a perfect square with 3 foot lines of tape and the Robotic Challenge is to program your robot to travel around the square starting and stopping on the same corner. This will require figuring out how long a duration for their robot to travel along one side of the square and then copy and paste their 90 degree turn and then repeat the process three more times so that the robot travels around the square.
An Advanced Programming Challenge: Create a “My Block” programming block for your 90 degree turn
When you need to use a 90 degree turn in another program, you can copy and paste the move or motor programming blocks from your 90 degree turn program or create the blocks each time. Or a third option that can be very useful is to create a “MY BLOCK” for your 90 degree turn blocks. What this will do is save the move or motor blocks that make up the 90 degree turn and save it as a single “90 degree turn” MY BLOCK. To learn the simple process of how to create and save a MY BLOCK go to the NXT Tutorial lessons and click on “My Blocks” in the Advanced section. It will take you step by step through creating a “MY BLOCK,” naming it and giving it an icon. You will now find your My Block as a stored programming instruction block in the Custom Tools Pallet
Let’s Get Looping
What if you need to “drive forward and make a 90 degree turn” and “drive forward and make a 90 degree turn” and “drive forward and make a 90 degree turn” and “drive forward and make a 90 degree turn.” These are the programming instructions you developed for your robot to go around the square. There must be an easier method and you would be correct. A loop will allow you to repeat programming blocks for a set number or a set period of time.
To learn how to use loops in the NXT Programming software, review the NXT Tutorial at:
http://www.nxt-tutorial.stemcentric.com/Loops.html
Or on the common palette, select the loop block and drag it on to your programming beam. The loops icon is on the common palette. Click and drag it onto the programming beam just ahead of your program move and turn blocks; then select your program blocks for driving ahead and turning by drawing a box around them with your mouse or click the first block and then while holding down the shift key click on the other programming blocks to select all of them to go inside the loop. Then click and drag the selected set inside the loop.
Then click on one of the end blocks of the loop to open the Loop setting box.
Click on the control to select count and then set the count to 4 for driving around the square. If you want it to display the number of times the loop is repeated on the screen, click on Show Counter.
ROBOT PROGRAMMING CHALLENGES
Drive the Square using loop programming
Repeat the square challenge using the loop to program the driving forward and turning around the square. When you programmed the square previously, you did it the long way in programming a forward Move block, 90 Degree turn, forward move block, 90 degree turn, forward move block, 90 degree turn and forward move block and 90 degree turn. Save your drive around the square program with a “Save As” and rename the program as Square Loop. See if you can get the robot to go around the square using one of your forward move blocks and 90 degree turns and a loop.
LESSON 5: Avoidance using Sensors
Starting to Work with Sensors: Touch Sensor and Ultrasonic Sensor
In this lesson you will learn to use two sensors to tell when you have bumped into the wall or obstacle or are within a specific distance from the wall or obstacle. You will need to mount the Touch Sensor on the front of your robot and your Ultrasonic Sensor on top of the brick. You may need to go back to your original robot building plans for instructions on how to mount these sensors on your robot. You can also free build attach them.
Special note on attaching the Ultrasonic Sensor: Be careful not to end up with any cords or attachments directly in front of the ultrasonic sensor in your attaching it to the brick. It uses the two round “eye looking” circles on the front of the sensor to send out a signal that bounces off the wall or other obstacle that is in front of the robot and the time it takes for that signal to reflect back gives it the data that tells it how far away it is from whatever reflected the signal back to the sensor.
Also remember, when you program the ultrasonic sensor, the sensor will measure the distance from the actual position of the sensor on the robot to the wall, and not from the front of the robot, so consider the distance from the wall or from an object that you want the sensor to detect. You may have 6-8 inches of robot out in front of the Ultrasonic sensor with the touch sensor mounted on the front of your robot so you will need to figure this extra distance from the wall when you want the robot to stop and turn in programming your robot with the Ultrasonic sensor.
Special note on attaching the Touch Sensor: When you mount the touch sensor in front of the robot, you might want to mount a small axle (4 or 5) and a small gear or a small brick to bump into the wall or other object it comes in contact with.
TWO VERY IMPORTANT PROGRAMMING NOTES FOR WORKING WITH SENSORS:
-
You will always want to program your move block before the sensor to be UNLIMITED so that you can start your robot in the middle of the floor or across the room and the motor will continue to run until the sensor provides feedback that it has pressed against the wall for a touch sensor or detected that it is <10 inches away from the wall for the Ultrasonic. Whenever using a wait sensor block, start with the move block set to “unlimited” so that the motor will just run until the sensor returns information that will then have it move on to the rest of your program.
-
ALWAYS use the Wait sensor blocks that are identified in the sensor programming block with an Hour Glass symbol in the upper right hand part of the sensor block. This is very important as the robot will drive with the move block set to unlimited…WAITING for the sensor block to sense that the touch sensor has been touched or the Ultrasonic sensor detects that it is less than the programmed distance to an obstacle and then the motor will stop and move on to the next programming blocks in the program.
How do you program your robot to stop when it touches the wall?
You can access instructions for programming the touch sensor to detect the wall in the GEAR-TECH-21 NXT Lesson on Avoidance Advance to the Touch Sensor lesson and click on “Touch Sensor Program.” :
Make sure your touch sensor is mounted out front of your robot to be the first thing to touch the wall or object you will bump into.
Create a new program and go to your File Menu to Save as and name it “Touch Wall.”
Then bring out a Move block and set the move block to Unlimited.
Next bring a Wait Touch Sensor Block on to the Programming Beam and leave it set at the default settings of Port 1 and Pressed.
Then bring a Move block onto the Program beam and set it to Stop. Last add another move block set to reverse 4 rotations so your robot can start from anywhere on the floor, drive forward until it bumps into the wall and then it will stop and drive backwards 4 rotations.
ROBOT PROGRAMMING CHALLENGES
Touch Sensor Challenge
-
Touch Sensor Challenge: So that wasn’t very challenging to have the robot stop at the wall and drive backward a little bit. Your next challenge is to bump into the wall, then back up a short distance, turn 90 degrees and drive parallel to the wall for 12 rotations.
-
Touch Sensor Challenge: See if you can program your robot to bump into an obstacle, backup and turn and then go forward until it bumps into something again. So the response of the robot when it runs into an obstacle is to back up and turn. (Hint: You will need to use a loop to repeat the process over and over as it runs into obstacles, backs up, turns and then runs into another obstacle, backs up and turns and so on).
How do you program your robot to stop when it nears the wall?
The quickest way to do this part of the lesson would be to go to your touch Sensor Program, do a “Save As” and rename the program to Ultrasonic Stop and then hit save. Then go in to this program and replace the touch sensor with a Wait Ultrasonic block, and set the ultrasonic sensor to less than 10 inches. Then have your robot stop when the ultrasonic sensors detects it is less than 10 inches away from the wall and back up 4 rotations.
If you want to view the screen lessons on programming with the Ultrasonic sensor similar to the Touch Sensor From the GEAR-TECH-21 NXT Lesson on Avoidance Click on this link GEAR-TECH-21 NXT Lesson on Avoidance to go to that lesson and Click on the “Next” button to advance to the Ultrasonic lesson and click on “Ultrasonic Sensor Program” button on the screen.”
Or to learn some different skills, I challenge your group to go to Lesson 4.7 in the Educational Robots for Absolute Beginners curriculum and go through this lesson on programming using the ultrasonic sensor with some music files to help you understand how the Ultrasonic sensor works This is a very good lesson on programming using the ultrasonic sensor teaching new programming skills that your youth will use. To go to this Lesson 4.7 on the web Navigate to:
Educational Robots for Absolute Beginners Using the Ultrasonic Sensor Lesson: https://cs4hsrobots.appspot.com/unit?unit=25&lesson=55
Ultrasonic Sensor Challenge
-
Ultrasonic Sensor Challenge: So that wasn’t real challenging to have the robot stop near the wall and just back up. Your next challenge is to program your robot to stop 10 inches from the wall, then turn 90 degrees and drive parallel to the wall for 12 rotations.
-
Ultrasonic Sensor Challenge: See if you can program your robot to stop 8 inches away from an obstacle, backup and turn and then go forward until it detects another obstacle and continues to do this around the room. The response of the robot when it detects it is 8 inches away is to back up and turn. (Hint: You will need to use a loop to repeat the process over and over as it detects 8 inches away from obstacles, backs up, turns and then detects 8 inches away from another obstacle, backs up and turns and so on).
LESSON 6: What Kinds of Jobs do robots do? And Switching on the Light Sensor
Part 1
Activity
What Kinds of jobs are robots designed to do for humans?
These jobs usually fall into one of four categories of tasks for humans and you will find this well documented as you work with robots in the real working world:
-
Dirty jobs—able to work in dirty, smelly places that humans might not be able to live and work in
-
Dull jobs—able to do repetitive jobs that might pose a physical risk to humans in performing over and over
-
Dangerous jobs—military and disaster applications that might not be safe for humans to work in and around
-
Delicate jobs—medical and micro environments where magnification or working accurately in small spaces is important
Instructions for team:
Take a piece of notebook paper and divide it into four parts. Write one of the robot job categories in each of the four parts. Now brainstorm in small groups jobs that you think would fit into each of these categories. Share your ideas popcorn style in the group. Asou focus on one of the robot job types, have each group share one of their ideas and then keep going around the group with each sharing another job until they have all been shared and recorded for that job category on the whiteboard or on a sheet of newsprint. Then choose the next job category and have groups share one idea from their list until all groups have shared all of their jobs. Continue with the same process of sharing until all four job categories have been covered.
Next share a couple of the following YouTube Videos to help understand the Dirty, Dull, Dangerous and Delicate jobs that robots are being designed to do for us.
Dirty Robot Jobs 1-5 https://www.youtube.com/watch?v=foGLkRP4jmY
Dirty Robot Jobs 6-10 https://www.youtube.com/watch?v=QsqkPVSI99M
Robots do jobs that are Dull, Difficult or Dangerous: https://www.youtube.com/watch?v=qdUlQ4p_5fs
Newport Nursery Uses Robots for Time Consuming, Dull Job https://www.youtube.com/watch?v=AjmzSCKGTog
Warehouse Robots at Work: https://www.youtube.com/watch?v=lWsMdN7HMuA
Robot Farming at Work: https://www.youtube.com/watch?v=HIpelnM1NBE
Military Robots: https://www.youtube.com/watch?v=00NlrY3tHE4
Military Robots Carrying Heavy Equipment following Soldiers: https://www.youtube.com/watch?v=Yj7DgklsZDk
US Military tests Iron Man like Exoskeleton: https://www.youtube.com/watch?v=p2W23ysgWKI
Snake Robot Search and Rescue: https://www.youtube.com/watch?v=A9OdUPY3OyE
Medical Robotics: https://www.youtube.com/watch?v=jbfW_DjktK4
Robot Surgeons: https://www.youtube.com/watch?v=vb79-_hGLkc
Part 2
Turning on the Light Sensor
In this lesson, you will learn how to program the robot to start and stop on a line. You will learn how to calculate a light threshold which you must have to set your light sensor block in a program. You will use a new tool in your programming, the SWITCH, which will allow your robot to test conditions and run one set of programming blocks if the robot detects the dark line and another set of instructions if the robot detects the light surface.
MOUNT THE LIGHT SENSOR ON THE ROBOT: Go back to your original building plans for your robot to see if they have instructions on mounting the light sensor. If not, the light sensor should be mounted in front of the robot facing down. It will need to be mounted just slightly off the floor surface as it detects reflected light. It needs to be mounted no more than ¼ inch or 2 pennies width from the surface that it is sitting on.
For lessons on working with the Light Sensor, learn to use the WAIT Light sensor block by following these instructions:
Once you have learned to drive and stop using a sensor, you will program the robot in the same way that you programmed for the touch and ultrasonic sensors stopping at or near the wall.
To do the Stop on a Dark Line Challenge, you must put down a dark line on a light surface. If your floor is dark, put a light colored line on the dark floor, either white or yellow duct tape on a dark surface floor.
CALIBRATING A LIGHT THRESHOLD:
In order to understand and build your program to use the light sensor, you need to learn how to calibrate a light threshold. There are basically two ways you can do this.
-
You will need to start a new program and do a Save As and name the program Stop on Dark or Stop on Light. Your first programming block will be a move block set to unlimited on your Program beam. Then add a WAIT Light Sensor, then download this part of the program to your robot. Click on the light sensor block and as you do you will notice that the bottom left hand corner of your dialog box on the computer programming screen will serve to give you readings that you will use in calibrating the light threshold which you will use in programming the robot to use the light sensor. While the robot is still hooked up to the computer, hold the light sensor over the light surface of the floor and record that % of light reflected value that you will see in the lower Left corner of the light sensor settings box. Then set the robot light sensor over the dark line you are have placed on the floor for the robot to stop on and record the reflected light percentage in the lower left hand corner of the light settings box.
This is the measurement for the light surface floor = 72 % reflected light
This is the measurement for Black duct tape line on floor= 36%
-
The second way and maybe the easier way to check the % reflected light on the dark surface and the light surface is to use the NXT Brick “VIEW” function. You can access this tool by turning on your robot and using the gray right or left keys on the brick to click over to the View tool. Next, click the orange enter button to start this tool, then use the gray arrow keys to click over to the Reflected light. Select the reflected light and then switch the port by clicking the gray buttons to choose port 3, the light sensor default port and then your light sensor light will come on. Set the light sensor over the light surface and record that value of reflected light percentage. Then set the light sensor over the dark line and record that value of reflected light percentage.
Your last step in calculating the light sensor threshold value:
Once you have recorded the value of reflected light from both the light surface and dark surface from one of the above steps, it’s time to calculate the light threshold. Add the % reflected light from the light surface and the % reflected light from the dark surface and divide by 2. For example, if the light surface value was 65 and the dark surface value was 27, then the light sensor calculated threshold would be 65+27 = 92 and then divide this sum by 2, 92/2 = 46. 46 is now the light sensor threshold that you will use in programming with the light sensor.
A Note on Reflected Light Values:
Light colored surfaces will have a higher percentage of reflected light because they reflect more light back to the sensor. Darker surfaces like your stopping line on the floor, usually dark tape or black electrical tape, will have a lower percentage of reflected light value, because darker colors absorb more of the light and reflect less back to the sensor.
Your stop on a dark line program would look like this with an unlimited move block, a light sensor block and a move block set to stop:
The light sensor would be set with
the threshold value and < 46 (less than 46) for stopping on dark. You would set it opposite > 46 (greater than the threshold) if driving on a dark surface and stopping on a light line.
Light Sensor
ROBOT PROGRAMMING CHALLENGES:
-
Stop on a dark line— Did you get the robot to stop on a dark line when driving across a light floor?
-
Stop on a light line— Can you find a dark surface colored floor and place a light colored duct tape or light colored paper strip taped to the floor and program your robot to stop when it comes to the light line?
LESSON 7: Programming a Switch for your Robot to follow a line
In this lesson you will program the robot to follow a dark line on a light surface or light line on a dark surface. You will use your light sensor calibration skills and a new programming tool—the switch—which will allow your robot to test conditions and run one set of programming blocks if the robot detects the dark line and another set of instructions if the robot detects the light surface.
Start by taking some dark tape (black duct tape or black electrical tape) and place a long strip of it on a light floor. Now using the view method, find the reflected light percentage values of the light floor surface and the dark line and calculate the threshold for the light sensor.
Watch this short video to see what it is you are creating in programming a line follower robot. Video resource for programming the Follow the Line program on YouTube: https://www.youtube.com/watch?v=BO-uFcClRTA
Now it is time to build your line following program.
If you want to view the screen lessons on programming the “line following program” from the GEAR-TECH-21 NXT Lesson “On Cue”, advance to the Line Follower Screen and click on “Line Follower” to go screen by screen through building your program.
A little bit longer version of building the program video can be found at: Educational Robots for Absolute Beginners, Robot Educator example: Line Following
Start by putting a loop out on your programming beam and we want it set to forever. Then add a switch inside your loop and set it to Light Sensor and in the compare section, set it to less than your calculated threshold value figured above.
So, to explain what a switch does, if the light sensor reading is less than the threshold or over the dark line, the switch will run the bottom set of programming blocks. If the light sensor reading is above the threshold, over the light floor, the program will run the top set of programming blocks.
On the top programming beam of the switch, you will need to put two move blocks with the first block set to motor B set and unlimited duration and the second move block to motor C and stop.
On the bottom programming beam of the switch, you will need to put two move blocks with the first set to motor B to stop and the second move block to motor C set to unlimited duration.
Now Download your program and place the robot over the line so the light sensor is in the middle of the dark line on the floor and start your program. The robot should jog back and forth along the line until it reaches the end of the line.
ROBOT PROGRAMMING CHALLENGES
Using the Line Follower Program
-
Program your robot to follow a line along the floor
-
Create a rectangle or square shape on the floor with tape and see if your robot will follow completely around the shape outline
LESSON 8: Learning to work with GEARs
In this lesson, you will be introduced to gear ratios, some building helps to implement gears on your robot, and the uses of gears to create more power or speed to the motors and the limitations and adjustments in using the NXT gears. You may want to view this great video lesson to introduce using Gears: https://www.youtube.com/watch?v=bWJdVjNgLWw
The primary function of using gears is to gear up and create more speed, or to gear down and create more power or torque. This is really the time to build and experiment by building with beams, gears and axles to actually gear up the driver axle or to gear down the driver axle creating more power.
Some gear assemblies to try can be found at: http://www.teamhassenplug.org/NXT/Gears/
Remember the rule that when putting gears together in a series of two or more, an odd number of gears always rotates in the same direction so if you are planning on driving two wheels with one motor such as in a 4 Wheel drive robot, you must always use an odd number of gears 3, 5, or 7, so that both wheels will drive in the same direction. An even number of gears, 2, 4, or 6 will turn the wheels in opposite directions—one driving forward and the other backward which will not drive the robot. You can use 2 or 4 with one wheel, but remember it will drive opposite of the direction the motor is driving.
Remember that there is a trade-off to speeding up the robot as it may move faster but not have as much power if you are doing any work with it or engaging another SUMO bot. If you gear down and create greater push or pull power with your robot, you give up some speed, so you may not get to the other robot quick enough before they have engaged your robot and pushed you off the SUMO board.
To add gears to your Domabot or simple robot build, view this video: Dr Graeme’s Challenge 30 –Climb the Highest Mountain and scroll down past the challenge to 30.7-30.7.10 to see a basic build for adding gears to make your robot a 4 wheel drive robot. You can adjust the gears added to change the speed or torque of your robot. You may have to adjust by using a longer beam for larger gears.
http://www.drgraeme.net/DrGraeme-free-NXT-G-tutorials/Ch30/Ch30V1BCG/default.htm
To find other ways to add gears to your robot chassis, search the internet. There are many robots that have gears, but you may have to modify or rebuild your robot to accommodate the gears.
NXT 4 Wheeled ATV Robot
A Dragster Robot Build is at: http://nxtprograms.com/dragster/index.html if you would like to build a fast car for fun, geared up and using all three motors. Just scroll down the page and click on the Building Instructions for how to build the robot.
After playing with gearing up and gearing down, it is now time to put this knowledge to some use.
ROBOT PROGRAMMING CHALLENGES
Using the Knowledge you have of GEARS:
-
Gear up your robot for a drag race. Set out two lines of tape on the floor at least 10 feet apart. Run your robot as fast as you can as it is built to cover the distance between your two lines on the floor. Record the amount of time it took to cover the distance. Now experiment gearing up your robot to see how fast you can get your robot to drive the distance between the lines.
-
Clipboard Tractor Pull Challenge— Hook up a clipboard to your robot so that is sits flat on the floor behind the robot. Be creative in hooking up the clipboard with LEGO pieces or other tethering to be able to pull evenly on the robot for a balanced pull. Place objects like pop cans or water bottles to add weight to the clipboard. Challenge the team to pull the clipboard while you add one and then additional cans or bottles to the clipboard to see what their original build could pull and then adapting it using gears to increase the amount of weight that it can move. The robot must pull the weight at least two rotations with the weight attached.
-
Dr. Graeme’s Challenge 30 – Climb the highest Mountain (used with permission) You can find this challenge in the Robotics Resource Pieces folder. This challenge is great for learning to gear down your robot for power. The basics of this challenge is that you will need a big stack of books and a 4-6 foot long board about 12 inches wide. You will start with the board stacked on top of just a few books and with your robot set to a simple forward block of about 5 rotations, see if your robot can climb the board. Keep adding books to see at what count of books, the incline becomes too steep for your regular robot to climb. When does it just start spinning out and stop climbing? Record this number of books. Then modify your robot to the four-wheel drive model shown in 30.7-30.7.10 of the online challenge. Now start the Mountain Climb Challenge again with your modified 4-wheel drive robot and see how many books you can stack before it stops climbing the board.
Other Gear Resources:
A nice moving illustration of gear concepts http://education.lego.com/en-us/preschool-and-school/upper-primary/8plus-machines-and-mechanisms/constructopedia
Appendixes
Appendix 1: Preparing your team to work with Robot Challenges
Working through Robot Challenges is an important process of figuring out what you need your robot to do and then modifying, building attachments and programming the robot to accomplish the challenge. This really just takes practice with challenges that will help the team figure out who is really good at building, programming, understanding the challenge goal, and communicating that challenge which are all needed for your robot to be successful in meeting the challenge.
There are many challenges throughout this curriculum that should help you in preparing for live challenges and your team roles or specialties.
It really is pretty easy to come up with challenges and you can even have the youth come up with a challenge to share that you would challenge other teams to successfully complete. Just send your challenge to HyperStream and we will post to the Robot Challenges and send a note out to coaches to share with other teams.
A great video to get you started with your challenges is the Introduction to the Engineering Process from the Carnegie Mellon Robotics Academy:
http://www.education.rec.ri.cmu.edu/previews/nxt_products/robotics_eng_vol_2/preview/content/process.html
Some additional Challenges are:
-
The Moon Challenge: To create this challenge you will need to build a multi-branched free-standing tree about 10 inches tall to serve as a portal. This is your first building challenge to build the tree. (See Robotics Resource Pieces Folder for photo of tree.) Then mark out four 6 inch lines to serve as starting points about 30 inches away from the tree on each of four sides. Then explain that this tree serves as a portal to ship your 3 prized possessions of each team member to the moon ahead of you as astronauts that will be traveling to the moon shortly. You will need to build some type of container to carry these prized possessions and place it under the tree portal without moving the tree from its starting position or tipping the tree over. Each team member will need to share what their three most prized possessions are that they are sending to the moon ahead of them. The Challenge is successfully completed when the team has placed the container with the team’s prized possessions behind one of the start lines, the tree was not moved, and the robot is safely back behind the original starting line.
-
THE FOREST CHALLENGE: Using the same tree constructed as the transport portal for the Moon Challenge, and same starting lines, the team’s task is now to start behind one of the start lines, approach the tree, cut it down and drag it out of the forest back to behind the original starting line. This will require the team to build some type of attachment using the third motor which will be able to grasp the tree and remove it from the forest back over the start line.
-
CONTROL BY REMOTE: Download an NXT Remote app for a smart phone (Android) and control the robot by blue tooth using the remote control interface with the remote app. Drive the robot through an obstacle course using your NXT Remote App from Google Play. In most cases, we would like the robot to run without need for human control, so now to finish your challenge, you must come up with a commercial use for a remote control with a robot. Does the remote control make it easier to control the robot, or would you prefer the robot be pre-programmed to use sensors?
-
NXT Snail Car Challenge: In this activity, design and construct an NXT car or snail which is capable of traveling extremely slowly. The cars compete in a snail race with the last car to cross the finish line crowned as the winner.
-
CROSS THE PIT NXT CHALLENGE From LEGO engineering: Design and construct a car that can cross from one side of a 1 foot distance between tables without falling. For Ideas or help building, go to the LEGO engineering challenge page by clicking on CROSS THE PIT.
-
Clap on Clap Off! Robot Challenge from LEGO Engineering: Design and program a robot that moves forward when you clap softly and stops when you clap loudly. Check out this Clap On Clap Off! challenge at LEGO Engineering.
-
FREE NXT LEGO Mindstorm NXT-G Challenges from DrGraeme website:
10>
Share with your friends: |