LEGO Robotics resources
I enjoy teaching students the engineering process, building, and programming using the LEGO Mindstorms kits. I currently am running an exploratory course for middle school students and have developed the following sequence of challenges for them to follow as they learn basic programming. I have used variations of this sequence to train students (and their coaches) to solve FIRST LEGO League related challenges. The files were written in LEGO Mindstorms Software v2.0.
Challenge Set 1: Basic Motor control
- Students must use a single motor block to move exactly the length of their work table without falling off.
- Students must do a perfect 90 degree turn.
- The robot must drive straight along one edge of a rectangular table, turn left (or right), make a sound, and then drive along another edge. Can you make your robot go all the way around the table without falling off?
- With a light sensor attached and pointing down, the robot must drive forward to the edge of the desk or table and stop when it no longer “sees” the table surface.
- Make the robot drive straight until it passes over a light colored piece of paper, then back up for a second or so.
- Make the robot repeat the behavior in the previous step, but using one of the other sensors in the basic kit.
- (depending on interest) Students should again make the robot stop when it gets to the edge of the table, but this time the robot should make a slight turn in one direction or another. Place all of these blocks in an infinite loop, and the robot should stay on the table or desk indefinitely!
- Download the loop program to your robot and watch what happens. Modify the program to make it repeat that behavior four times instead of two. Make the robot say something instead of make a tone.
- Change it so that your robot drives straight for 2 seconds, turns 90 degrees, and then repeats this behavior four times. What shape has your robot made?
- Delete the loop. Make the robot drive straight for an unlimited amount of time with a motor block. Then use a wait block that waits until the light sensor senses dark. Then make the robot back up for 1 second. Then put these three blocks inside of a loop and watch what happens.
- Set up a copy paper box and a robot with motors on B and C. Use an ultrasonic sensor (on port 1) that points toward the left side of the robot. Run the program and observe what happens. The robot <strong>should</strong> move around the box and maintain its distance until it runs into something.
- Adjust the robot and the program so that it goes clockwise around the object instead of counter-clockwise as originally programmed.
- Replace the ultrasonic sensor with a light sensor pointed at the ground. Modify the program so that the robot follows the edge of the table using the value of the light sensor to guide it. Hint: The structure of the
program will be the same, so you don’t need to add or subtract any blocks.
Challenge Set 5: Making Decisions with a Switch (decision making with a switch.rbt)
In this challenge, students learn to use a device called a switch. This is how a robot can decide to do one thing or another based on a sensor value, time, or other condition.
In the program, you can see that the switch has two branches. The top one will be followed if the touch sensor is pressed. The bottom one will be followed when the touch sensor is NOT pressed.
- Without downloading the program to your robot, see if you can predict what will happen when you run the program, and then download and run the program to see if you were correct. If not, try to figure out why.
- Modify the program to move your robot forward when a touch sensor is pressed, and backward when it is not pressed.
- Create a program that uses two touch sensor to control your robot. When the left touch sensor is pressed, the left motor should run forward. The right motor should run forward when the right touch sensor is pressed. This will learn you to learn one other trick, but there is a pretty big hint hidden in the program. BIG HINT: what might you do with that branch of the program running upward? (You can make a branch of your own like this by hitting shift with your mouse pointer over the LEGO beam for the program.)
- Find another interesting use of the switch and use it to do something cool with your robot.
- Modify the program to drive your robot past THREE objects and stop.
- Make your robot drive past the length of your LEGO box and then stop. This does NOT require changing the motor blocks at all!
- Make your robot drive forward past two objects, then backward past the two objects, and then play a song or sound before stopping.
- Change the program to use the light sensor to count lines of white tape on the floor. Your robot should stop after the fourth line of tape.
I am a huge fan and supporter of FIRST (For Inspiration And Recognition of Science and Technology) programs. I currently am involved in both and at the Hangzhou International School. I also have a habit of keeping in contact with a number of teams during the build season.