Basic Programming


Name of Activity Basic Programming
Author Ali Boreiko
Keywords touch sensor, ultrasonic sensor, sound sensor, light sensor, simple programming, introduction to NXT, introduction to Mindstorms, introduction to programming
Subject NXTs
Grade Level 4, 5, 6, 7, 8
Time 1 Hour Total
Brief Description Students complete a simple series of programming challenges to familiarize themselves with Mindstorms programming.
Lesson Objectives: For students to become more competent programmers
Materials Needed: computers with Mindstorms, whiteboard/chalkboard, a list of simple challenges OPTIONAL: pre-built cars
Preparation and Set Up: 1. Decide what functions of the NXT will be most useful for your class. Do you want them to know how do use a particular sensor? How to steer the robot? How to make the NXT make noises? Then, create a list of ~8 challenges that target these areas of Mindstorm programming (see our example under “References”). Create the challenges so that harder challenges only require the students to change 1 or 2 parts of their program. That way they will see the direct connection between the change they made and the robot’s actions. They will also feel accomplished if they are able to complete more challenges.

2. You may have the students pre-build a car, but the activity can also be done by programming other things (e.g. an NXT arm)

  1. Ask each group to put the necessary sensor/equipment onto their robot.
  2. As a class, program the first challenge. As kids complete the challenge, have them come up to the board and demonstrate the challenge to either STOMPer. Once the students have accomplished and demonstrated the challenge, write their name on the board next to the challenge.
  3. Once kids have finished the first challenge, they may go on to harder challenges–but they must complete them in order!
  4. As kids complete the challenges, check off the challenges under their names. This way, you recognize kids who stay focused on the tasks.
Extensions: This activity can be adapted for various skill levels by simply making the challenges more difficult or adding more difficult ones at the end of the list
Previous Activity (if applicable) Introductory building
References Our list of touch sensor challenges
Umbrella Unit/Curriculum (if applicable) Introduciton to Mindstorms, Introduction to NXT Robotics

Same End, Two Ways of Getting There


Name of Activity Same End, Two Ways of Getting There.
Author Matt’s mini group
Keywords NXT, Ultrasonic sensor, light sensor, understanding how they work
Subject NXTs
Grade Level 4, 5
Time 2 Hours Total
Brief Description Understanding how sensors really work and use different sensors to accomplish the same goal.
Lesson Objectives: To understand how the ultrasonic sensor works. Use two sensors to accomplish same goal.
Materials Needed: Already built NXT car, bouncy ball to demonstrate ultrasonic sensor, flashlight maybe to demonstrate how the light sensor senses both reflected and ambient light and the difference between the two.
Preparation and Set Up: Already built car and a thorough understanding of how the sensors truly work.
Necessary Background Understand how the sensors are able to accurately sense whatever it is they sense.
Procedure In order to understand how untrasonic sensors work, children can throw a bouncy ball against a wall from different distances and see how it takes longer to come back to them when they are farther and less time when they are closer.  In order to understand how the light sensor works, they should pull up the real time reading of the light sensor on the brick and hold it up to different lightings and see how the reading changes and test how it is different when sensing reflection as opposed to ambient light and use these readings to set the threshold to put in the program.  A flashlight can also be held up to a piece of paper at different distances and see how the intensity changes.  The challenge will then be to have a car go back and forth between two walls using the ultrasonic sensor on one side and the light sensor on the other side.
Extensions: Use a different sensor as well to accomplish the same goal if a group is far ahead.
Previous Activity (if applicable) Basic programming knowledge and basic sensor usage.
Umbrella Unit/Curriculum (if applicable) NXT

Introduction to Sensors-Ultrasonic





Name of Activity Introduction to Sensors-Ultrasonic Sensor
Author Danish Bhatti, Kenny Westermann
Keywords NXT Robotics, Sensors, Ultrasonic Sensor, Datalogging
Subject NXTs
Grade Level 4
Time 1 Hour Total
Brief Description An introduction to robotics would be incomplete without imparting a basic understanding of how robots perceive their environment and react to it. We did this activity to add more dimensions to the functionalities of the robots that our class made. Up till now the robots could not function with respect to external stimuli and performed only simple tasks.

Once we put sensors into the equation, robotics suddenly became much more engaging for the students since their creations started displaying a sense of awareness as compared to the mindless drones that they were before.

At the start of the lesson, we began by trying to show the class how animals in nature perceive their environments. We also discussed how humans use their eyes ears and touch to understand different aspects of our environment. Then we worked on relating this concept to robots and NXT robots in particular. How the sensors corresponded to some of the key senses of the human body, how the NXT brick functioned as the Brain and how motors resembled muscles in their role as actuators.

Then we moved on to talk about the ultrasonic sensor and its functions. We also spent some time teaching the class how they could incorporate the sensors into their mindstorms programs. In the previous lesson we had introduced the wait-for command so the class was very quick to catch on.

We gave the class some time to install the sensors on their robots and then we simply put up a checklist of tasks we wanted the class to have their robots perform–tasks that had at least one part which relied on the use of the ultrasonic sensor. e.g: If anything comes closer to the robot than 20cm, have the robot panic and run backwards at full speed for 2 seconds.

Lesson Objectives: Understanding the concept of a sensor.
Where sensors are found in the natural world.
How does the Ultrasonic sensor work?
How to write a program that can make use of ultrasonic sensorsor sensors in general?
Altering the design of your robot to ensure optimum placement for the sensor.
Materials Needed: NXT Kit
Computers w/ NXT software
Preparation and Set Up: None
Necessary Background Experience making NXT robots that rely on sensors.
Procedure 1-What are Sensors? 2-Where can we find them in the real world? 3-What is an ultrasonic sensor and how does it work? 4-Adding the sensor to the robot. 5-Programming it. 6-Testing the machine 7-Optimization

NXT Alarm





Name of Activity NXT Alarm
Author STOMP
Keywords alarm, sensor, security, NXT, proximity, ultrasonic sensor
Subject NXTs
Grade Level 4, 5, 6, 7, 8, 9+
Time 1 Hour Total
Brief Description Build and program a security system using an NXT. The alarm should be triggered by the proximity (ultrasonic) sensor.
Lesson Objectives: - To learn about programming using the proximity sensor.
- To apply programming to real life problems.
Materials Needed: One NXT brick per group
One or more proximity sensor per group
Assortment of pieces to attach proximity sensor
Computers running MINDSTORMS NXT software
Preparation and Set Up: Set up computers running NXT Software.

Arrange students in groups of two.

Distribute necessary materials.

Necessary Background Programming is used in real life situations. Programming is used in a wide variety of devices to enhance our lives in terms of safety, ease, entertainment, transportation, etc. This activity is a good example of a way that programming can be used in the real world.
  1. Have student design an alarm box that will detect when a person approaches the box. If students want to use more than one proximity sensor or a different sensor as well they should be allowed to be creative.
  2. Allow students to decide how their security system will respond when someone approaches (display something on the screen, make a noise, drive away)
  3. Have students program the NXT to respond when someone approaches the proximity sensor and to stop responding when that person backs off.
    1. The entire program will need to be looped so that the NXT is always secure
    2. When the NXT is not being threated it should signal that it is alarmed by displaying “system alarmed” on the NXT screen.
    3. When the proximity sensor senses that an object is near it should respond (say by displaying back off! and playing a tone).
    4. The alarm should be looped until the proximity sensor no longer detects an object close to it.
  4. Students may use more than one sensor to trigger the alarm.
  5. Allow students to test and redesign their prototypes.
Extensions: Use multiple sensors to trigger the alarm. Have a different response for each
Build an NXT alarm clock or timer.
Attach the NXT alarm to a diary or box. Build something to keep people from opening the diary/box.
Program the NXT so that a user needs to enter a security code to turn off the alarm.
Reference 1
Reference 2
Reference 3
Reference 4

Switch to our mobile site