Wall Follower

ACTIVITY HEADER

 

 

 

Name of Activity Wall Follower
Author Jay Clark
Keywords NXTs, car, wall, distance, loops, conditional loops, sensor, threshold
Subject NXTs
Grade Level 4, 5, 6, 7, 8, 9+
Time 1 Hour Total
Brief Description Students will program their NXT cars to follow the outer edge of the classroom by driving along the wall at a set distance away.
Lesson Objectives: Programming using loops and conditional loops
Determining and Implementing sensor thresholds
Materials Needed: Prebuilt NXT car with a sound sensor
Clear wall space
Computers with NXT Mindstorms software
Preparation and Set Up: Find a section of the room that has the most dynamic wall. -Maybe the wall juts out for a closet and back in again afterwards-

Clear this space for cars to run next to.

For any inside turns (turning to the right if the wall is on your left), place a strip of black tape a foot or so away from the wall for the extensions.

Necessary Background A wall follower activity is very similar to the line follower programmatically. Start close to the wall. Turn away from the wall until the distance sensor reads that you are too far, then drive back towards the wall until the distance sensor reads that you are too close. Loop.

There is a challenge in trying to get the car to make an outside turn. This involves playing with the distance away from the wall you set your car to follow, and how dramatically you have the car steer.

Inside turns cannot be made using the loop. Some other sensor must tell the car that an inside turn is approaching, and then the car must react by turning. Students may use a touch sensor, a light sensor, a sound sensor, or even another distance sensor (if they have one)

Vocabulary: Threshold – The sensor value that when breached, will trigger a wait for block or a conditional loop. (Some students have had a better time understanding it as a “benchmark”)

Procedure Introduction – 10 minutes Introduce/ Review loops with the students and why they are useful in programs.

  • Loops allow us to repeat a set of commands that would otherwise be tedious to program over and over.

Introduce the activity, and ask the students if they have an idea of what the program should look like. Activity – 40 minutes Allow students to make the mistake of not including any turns in their program. They will understand their mistake when trying to make the first outside turn. Clean up/ Wrap up – 10 minutes

  • What was easiest? What was hardest?
  •  What would you have done differently?
  •  What were some good ideas you saw that other groups came up with?
Extensions: In order to make inside turns, students will have to use a conditional loop and another sensor to warn them of the upcoming turn.
Reference 1 http://sites.tufts.edu/stompactivitydatabase/files/formidable/c1.jpg
Reference 2 http://sites.tufts.edu/stompactivitydatabase/files/formidable/d.png

NXT Trolly

ACTIVITY HEADER

 

 

 

Name of Activity NXT Trolly
Author Jay Clark
Keywords NXTs, cars, car, trolly, trollies, light sensor, loop, proximity sensor, sound sensor, threshold, switch
Subject NXTs
Grade Level 4, 5, 6, 7, 8, 9+
Time 2 Hours Total
Brief Description Students program their NXT cars to be trollies. The activity has three tasks.

(1) Using a light sensor, the trolly must follow the black tape loop that runs through the “town”

(2) Using a proximity sensor, the trolly must detect stations and stop for boarding.

(3) Using a sound sensor, the trolly must stop for townspeople whistling for the trolly.

Lesson Objectives: Programming with conditional loops and switches.
Determining and implementing multiple sensor thresholds.
Materials Needed: Pre-built NXT car and complete NXT kit.
Computers with Mindstorms NXT software.
Black tape for trolly track.
Boxes/Books/etc for trolly stations.
Extra LEGO people.
Preparation and Set Up: Set up a the trolly track with black tape in the classroom.
Place the trolly stations either all inside or all outside of the loop. (This is so the proximity sensor can be pointed to the right or left).
Necessary Background In order to follow a line, students will have to program their cars to repeatedly jump off and back on the line. In fact, they aren’t following the black line, but rather the line formed by the edge of the black tape and white floor. Students programs should consist of four blocks:
- Turn Right.
- Wait for Darker.
- Turn Left.
- Wait for Lighter.

Students will need to use a conditional loop or a switch to stop following the line at the station. A conditional loop will keep performing the line following functions until the distance threshold is breached. It will then move on to the next bit of code. A switch will make a decision about the program flow based on a sensor value.

Vocabulary:
Threshold – The sensor value that when breached, will trigger a wait for block or a conditional loop. (Some students have had a better time understanding it as a “benchmark”)

Switch – A program structure that makes a decision about which line of code to run next based on some criterion (time, sensor value, logic etc)

Procedure Introduction 10 minutes Review loops with the students and why they are useful in programs.

  • Loops allow us to repeat a set of commands that would otherwise be tedious to program over and over.

Sometimes loops should go on forever. Ask the students for examples they’ve done where loops go on forever. In more sophisticated programs, they should not. Ask if they can think of a situation in which you don’t want a program to go on forever. A conditional loop is a great way to end a loop exactly when you want it to end and move on to another task. Our brains use conditional loops all the time!

  •  When crossing the street, we look both ways. If its not safe, we do it again. We keep doing it until its safe, and then we cross the street.

Activity – 40 minutes If students haven’t done a line follower before, introduce the concepts using the line follower activity on the activities database. For the second task, students will have to use a conditional loop to look for the stations. After the loop, they should stop the car for 5 seconds. It’s important to note that you must drive past the station before you start looking for a new station. Therefore, there should be a loop with a counter on it, or another conditional loop to follow the line past the station before looking for the next one. For the third task, the students will have to use switches. First look at one of the sensors, say the sound sensor. If it detects a whistle, stop for five seconds, if not, look at the proximity sensor. If it detects a station, stop for five seconds. If not, continue following the line. Clean up/ Wrap up – 10 minutes

  • What was easiest? What was hardest?
  •  What would you have done differently?
  •  What were some good ideas you saw that other groups came up with?
Reference 1 http://sites.tufts.edu/stompactivitydatabase/files/formidable/a1.jpg
Reference 2 http://sites.tufts.edu/stompactivitydatabase/files/formidable/b5.png

Switch to our mobile site