NXT Alarm





Name of Activity

NXT Alarm




alarm, sensor, security, NXT, proximity, ultrasonic sensor



Grade Level

4, 5, 6, 7, 8, 9+


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.

  • Students may use more than one sensor to trigger the alarm.
  • 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


    1 comment on this post.
    1. Marya Schnedeker:

      I did this activity with 8th grade students as an introduction to sensors and programming. The students did struggle with the programming (particularly debugging), but when pointed in the right direction, they seemed to understand the programming blocks and loops. However, they did require a lot of support. It would have been ideal if we had a large board or screen where we could do the programming part together. The students seemed to enjoy the activity. Especially the fact that their designs, when triggered, would give them sound feedback.

    Leave a comment

    You must be