How to make a mindstorm nxt follow you

Written by laura gittins
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to make a mindstorm nxt follow you
(Koichi Kamoshida/Getty Images News/Getty Images)

The sound sensor on a LEGO Mindstorm robot allows your creation to respond to noise around it. You can program your robot to follow noises you make by using two loops, one within the other. The inner loop will make your robot continuously turn left and listen for a sound. If it hears a sound, it will break this loop and move forward. After it finishes moving, it will stand still and the main loop will repeat.

Skill level:
Moderately Easy

Other People Are Reading

Things you need

  • LEGO Mindstorm set
  • Mindstorm USB cable
  • Computer

Show MoreHide


  1. 1

    Build a robot out of your Lego pieces. Connect two motors with wheels to ports B and C on the NXT brick so your robot can move towards sounds. Connect the sound sensor to port 2. Make sure the sound sensor faces the front of the robot so that it will detect sound in front of it.

  2. 2

    Open the Lego Mindstorms NXT program on your computer. Start a new program.

  3. 3

    Connect a loop control to the start of your program. You will use this loop to have your robot continuously listen for noise and drive forward when it does.

  4. 4

    Connect another loop control within the first one and change the control type to "Logic." Within this loop, connect a move control, a timer control, a sound sensor control and a logic control. Change the timer and sound sensor controls to use logic.

  5. 5

    Use the thread to connect the timer to port A on the logic control and the sound sensor to port B on the logic control. Connect the result port to the loop condition port of the loop control.

  6. 6

    Click on the motor control. Drag the "steering" option to the left, which will make your robot turn in this direction. Change the duration to 90 degrees. Click on the sound sensor. Drag the "compare" option to the left. This will make your robot respond to louder noises.

  7. 7

    Connect a "Move" control to the outside of the inner loop. Change the power to "100" and the duration to five seconds. This will make your robot drive forward after it hears a noise.

  8. 8

    Plug your robot into the computer using your Mindstorms USB cord. Click the "download" button to download your program to your robot. Disconnect your robot from the cord when the program finishes downloading.

  9. 9

    Put your robot on the ground and press the "run" button to start the program. Your robot will start turning to the left to listen for you. Move away from the robot and make noises. When the robot faces you, it will hear your noise and move towards you. Move somewhere else and try again.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.