Skip to main content

Science Fair Projects Using Lego Mindstorms: Bomb Detecting Robot

Lego NTX Science Fair Project

If you have a Lego Mindstorms NXT Robot or have participated in Lego League, you might want to consider using that robot for a science fair project. Below is an example of two years of science fair projects that my son did in 7th and 8th grade. He won at the local level both years and also placed 2nd at State one year.

You are welcome to use the plans below to develop your own research project. The format of the graphs he used is given, but you will need to do your own building, programming, and testing.

Here are the following areas I will cover for this science project, which was done over a two-year period:

  • Abstract
  • Research problem
  • Hypothesis
  • Materials needed
  • Procedure
  • Safety
  • Data Comparison
  • Year 2 abstract
  • Year 2 project details
  • Year 2 robot design
  • Year 2 procedure
  • Year 2 program design
Lego Mindstorms NXT is programmed as a bomb detector.

Lego Mindstorms NXT is programmed as a bomb detector.


Guided robots are used by the military to find bombs. The purpose of my experiment was to create an unguided robot. Here is how my project was done:

  1. First, I wrote two computer programs: one used the robot’s touch sensor to allow it to locate a corner, turn and start the second program.
  2. The second program activated the light sensors and started the robot on an algorithm of continuous XY loop sweeps which allowed it to find the mirror “bomb.”
  3. Using 4 x 4 beams, I constructed three test maps: a box, a box with an obstacle, and two rooms separated by a wall.
  4. I made the robot out of 2 Lego Mindstorms NXT kits and a few extra Lego parts.
  5. I threw a disc behind my back into the map to randomly place the robot and bomb.
  6. Next, I started the robot and timed how long it took for the robot to complete its first program of finding a corner, and then how long it took to find the bomb.
  7. I also noted how many XY sweeps it required. I did ten trials in each box.

My results

  1. We found that the robot found the “bomb” every time, and it took longer for every map, the time increasing as the difficulty did.
  2. The robot found the “bomb” mostly on the first X scan throughout the entire experiment, contrary to what I had predicted.
  3. The X/Y scan process was more efficient than I had expected.

Research Problem

What is the most efficient search strategy for an unguided robot to detect a bomb?


Searches will take place over a ten-minute period. Success will be measured by both speed and percentage of successful searches. The right turning software search strategy will be both the fastest and the most efficient.

Materials Needed

  • Two Lego Mindstorms NXT kits
  • Mindstorms NXT programming CD
  • Computer to program on
  • USB cable to transfer program
  • Extra Lego pieces
  • Maze (12’ x 12’) constructed of 4”x4” wooden beams. Within the 12’ x 12’ square, maze pattern is created with 1’ and 2’ long segments. Two mazes will be created using either right or random angles. No fasteners will be used; the weight of the 4x4s is enough to keep the robot contained.
  • “Bomb” target will be made of a flat LED flashing light and will be detected by the light sensors in order to simulate the search for a bomb using a bomb sensor.


  1. Create boundary walls of maze with 4x4s.
  2. Create maze pattern with small 4x4 pieces. Place sensor at (a) the center or (b) the edge of the maze.
  3. Place robot in middle of one side of the maze, facing the center of the maze. Start run.
  4. Measure time taken to locate target. If target still not located after 10 minutes, halt the experiment and record as “undetected”.
  5. The robot will be wheeled, with have a CPU in the center, which will have the program downloaded onto it and will control all of the sensors and motors. A touch sensor will be pointed straight forward to detect walls.
  6. Four search strategies will be tested:
  • Right turn search strategy: The robot is programmed to move forward until it encounters a wall sensed by its touch sensor, then takes a 90 degree right turn.
  • Right turn/left turn search strategy: Same as previous, except robot alternates between right and left turns.
  • Double turn strategy: Same as previous, except turns right for two wall encounters, then left for two encounters and so on.
  • 135-degree turn strategy: At each wall encounter, the robot turns 135 degrees right or left (alternating with each encounter).

7. Repeat steps 2-4 for each combination of parameters. Four replicates will be done for each set, with each replicate starting from one of the four sides of the maze.

  • Four replicates x 2 sensor positions in maze x 2 maze patterns = 16 runs per search pattern
  • Four search patterns x 16 runs = 64 runs total


I will not let the robots escape from the testing area. I will not use parts or programs from a stranger on the Internet or in real life. I will have an adult watching and helping with the preparation, testing, and clean-up.

Data Comparison

  1. The number of successful target locations per 16 runs will be calculated for each search pattern. Significant differences between search patterns will be determined by statistical methods. This will determine the most efficient search pattern.
  2. The search times for each successful run will be analyzed to statistically compare search patterns. This will determine the fastest search pattern.

Sample Data Table for Lego Mindstorms Science Fair Project

MapBoxObstacle2 Rooms

Time trial 1

Time trial 2

Time trial 3

Time trial 4

Time trial 5

Time trial 6

Time trial 7

Time trial 8

Time trial 9

Time trial 10


Mindstorms Programing Algorithm

XY programing algorithm

XY programing algorithm

Lego Mindstorms NXT Robot Used In This Project

Year 2 Abstract

The robot, algorithm, and program from my Year 1 project, "Can Robots Find Bombs?" was not as independent as an actual bomb-finding robot should be. Its limitations were that robot had to be placed at a right angle and it had to be adjusted every once in a while.

The robot, program, and algorithm in this Year 2 project, "Can Robots Find Bombs Independently?" fixes both of those problems. The robot can be placed at any angle anywhere in all three maps, does not require adjusting, and is a lot faster. The changing-angle algorithm searches the open space quickly, then moves to the next area gradually. It is less predictable than the X-Y sweep algorithm, but is more efficient.

Lego Robot Cleaning Machine

Year 2 Project Details

Last year I made a project, Can Unguided Robots Find Bombs? which involved building and programming a robot that was capable of:

  • Navigating three simple maps made of 2x2 wood planks
  • Being able to do so after being placed randomly inside the map
  • Using light sensors to detect 3 1” mirrors in a triangle pattern placed randomly somewhere on the map

However, I had a few problems with last year’s robot.

  • The robot had to be set parallel to the wood planks, to ensure that the algorithm worked properly.
  • The robot occasionally got off track by a few centimeters, and I would have to adjust it to keep it from going off the planned path.

This year, I was able to fix those problems. The new robot and algorithm do not need to be set at a particular angle to the wall, so as well as randomly putting the robot in a spot, I was also able to randomly pick a direction for the robot to be facing. As well as that, I did not touch the robot during the testing, except for when I put down the robot and pressed the button to initiate the program.

Because of this, the robot would be a lot more practical in a real life situation than last year’s robot. Ideally a person would start the robot and let the robot run without having to watch or make changes to the robot’s trajectory, and my new robot makes that possible.

Year 2 Robot Design

The results are a lot more dependent on the design of the robot this year than they were last year. The robot last year was not designed to get itself unstuck because the program was designed to make that not happen. The new algorithm is simpler but can occasionally get the robot stuck in a corner, grinding against the wall without the touch sensor bumping the wall, etc.

Because of this a very good robot needed to be built that could get the robot out of a pickle. This year the robot has a frame around it to prevent the robot from getting its wheels stuck on the walls, and to make the robot parallel to the wall if the robot came to the wall at an angle loose enough that the touch sensor didn’t bump the wall.

As well as adding a frame, I added several toothed gears and rubber parts to the end of the touch sensor to get more traction and to help the robot get out of corners if it gets stuck.

Lego Mindstorms Robots

Year 2 Procedure

  1. Get robot from previous experiment.
  2. Redesign the old robot with a frame around the vertical NXT brick, motors on the back, two light sensors pointing downward, one multi-directional wheel in between the light sensors, one touch sensor pointing forward in front of the multi-directional wheel, and a platform in front of the NXT brick holding on the sensors and wheel.
  3. Make a program with a changing-angle algorithm. The robot will move until it detects a wall with the touch sensor, then it will turn to the right at a 90 degree angle. The angle will continue to change until it reaches a 180 degree angle, then the robot will start over at 90 degrees.
  4. Test the new algorithm with the redesigned robot in the same three robots from Can Unguided Robots Find Bombs? and record results in time that the robot takes to find the bomb and whether the robot needed any human interference.

Year 2 Program Design

My algorithm for this year (changing-angles) is a lot different than my algorithm from last year (X-Y sweep). X-Y sweep depended on the robot always making the turns exactly right and being totally exact. I realized that attempting that, for my purposes and with the robot and software I am using, would be too difficult to perfect. So changing-angles is both simpler and less dependent upon perfect turns and exact angles.

This content is accurate and true to the best of the author’s knowledge and is not meant to substitute for formal and individualized advice from a qualified professional.

Questions & Answers

Question: What was your hypothesis statement for your science fair project?

Answer: Can a robot be built that can detect bombs automatically?

© 2013 Virginia Kearney


Luqman Jibril on November 29, 2017:

Hi. I love your work. I'd like to ask if you could share the building instructions with me. It'll be great to use it in my class with my kids here.

Virginia Kearney (author) from United States on April 17, 2016:

Hi Mike--we don't have the code anymore but it wasn't too complicated. You can probably figure it out by looking at the diagrams.

Mike R on April 17, 2016:

Virginia would you happen to have the program(code) for the robot. I would like to see if I can recreate the code you and your son originally put together.

Virginia Kearney (author) from United States on October 09, 2014:

Brandon--try looking up these keywords: "bomb detector," "engineering," "robotics." You could also look up "How Bomb Detectors Work" and "Weapons engineers"

Brandon Akinseye on October 08, 2014:

I am doing a science fair project for the lego nxt bomb detector.

For the bibliography I need 5 websites and I have 4 so far and I need some more information like the engineering question

ExpectGreatThings from Illinois on October 25, 2013:

As the parent of a newborn, 5 and 3 year old, I can't wait to be able to do stimulating and challenging projects like this! Well done! - Ginger