Home Store Project Ideas Project Guide Ask An Expert Blog Careers Teachers Parents Students

X Marks the Spot: Build a Robot to Protect Your Treasures

Time Required Average (6-10 days)
Prerequisites None
Material Availability This project requires a LEGO® MINDSTORMS® NXT 2.0 kit and a computer. See the Materials tab for details.
Cost Very High (over $150)
Safety No issues


You have secret treasure that you need to keep safe from thieves. How do you keep guard 24 hours a day without skipping school and the rest of your important activities? You build a guard robot and have it do the hard work! You can build a guard robot using a LEGO® MINDSTORMS® set and the instructions in this project to guide your efforts. And do not worry: your secret is safe with your robot.


To build and program a robot to guard a territory.


Michelle Maranowski, PhD, Science Buddies

  • LEGO® MINDSTORMS® is a registered trademark of the Lego Group.

Cite This Page

MLA Style

Science Buddies Staff. "X Marks the Spot: Build a Robot to Protect Your Treasures" Science Buddies. Science Buddies, 27 Oct. 2014. Web. 22 Nov. 2014 <http://www.sciencebuddies.org/science-fair-projects/project_ideas/Robotics_p004.shtml>

APA Style

Science Buddies Staff. (2014, October 27). X Marks the Spot: Build a Robot to Protect Your Treasures. Retrieved November 22, 2014 from http://www.sciencebuddies.org/science-fair-projects/project_ideas/Robotics_p004.shtml

Share your story with Science Buddies!

I did this project I Did This Project! Please log in and let us know how things went.

Last edit date: 2014-10-27


Treasure means different things to different people. Some people treasure their rare Pokémon cards. Other people treasure stamps, books, or jewelry. Different people find value in different things, but one thing we all agree on is that we should guard whatever items we treasure. Which of your possessions do you treasure and how do you keep them safe from a sibling or other treasure seekers? Maybe you put your things in a lockbox and then bury it in the backyard. That could work, but your treasure would stay safe only as long as you physically guard the location to prevent others from digging it up. Is there a way to guard your treasure 24 hours a day, even when you are not there? Yes: you could build a guard robot to do the job. Your guard robot could sound an alarm and give any treasure seekers a little push to warn them away if they come within the area of the treasure.

But what is a robot, how do you build one, and is it easy to build? A robot is mechanical device that has been programmed to carry out a series of actions. Generally, a robot is created to help humans do tasks, both complicated and simple. For example, robots aid in medical procedures, collect data from the deepest oceans to the surfaces of other planets, and help us build things. In this robotics engineering project, you will build a small guard robot using LEGO® MINDSTORMS®. Several different companies make robotic platforms that you can use to build a robot. For this project, the Procedure is written using the LEGO® MINDSTORMS® platform because it is easy to get started with and learn to use and put together, and there are online forums where you can get help if you need it. However, if you have access to another robotics platform you can take the general ideas in the Procedure and adapt them to that platform. You will build a guard robot and write a computer program to make it to do exactly what you need it to do. The instructions in the following procedure will help guide you. You can even decorate your guard robot as an animal to help divert an intruder's attention.

Because everybody's treasure location is different, you will build a model guard robot and program it to defend a territory that has a 70 centimeter (cm) radius circle from an intruder. Your robot will detect the intruder and then "push" it out of its circular territory. Ready to get started? Great! Begin with the procedure and start forming your own robotic security team.

Terms and Concepts

  • Radius
  • Pivot
  • Sensor
  • Microprocessor
  • Flowchart
  • LOOP block
  • WAIT block
  • MOVE block
  • ROTATION sensor
  • Data wire
  • MATH block
  • STOP block


  • What is a robot?
  • What are some ways that robots can be used?
  • Are there jobs or tasks that are easier or safer for a robot to do than a human being? Why?"


The following reference is the LEGO® MINDSTORMS® website. It has ideas for robot designs, help forums, and a software tutorial that you can watch.

These tutorials provide an overview of the NXT programming software that you will use to communicate with and direct your robot.

The following two sources are manuals that describe how to write programs with NXT software.

News Feed on This Topic

, ,
Reading level:
Note: A computerized matching algorithm suggests the above articles. It's not as smart as you are, and it may occasionally give humorous, ridiculous, or even annoying results! Learn more about the News Feed

Materials and Equipment

Substituting LEGO Mindstorms EV3 for NXT:

This project idea was written using the LEGO Mindstorms NXT 2.0 kit. This project can be done with the EV3 kit, because the building system and sensors are very similar between the two kits. However, the programming environment differs between the two kits. To do this project with EV3 you should still follow the general procedure in this project idea, but you may need to consult additional resources for help programming your robot.

For more information about the NXT and EV3 systems, and compatibility between the two, see Comparing EV3 with NXT and LEGO Mindstorms Frequently Asked Questions.

  • LEGO® MINDSTORMS® EV3 kit, available at toy stores or online vendors like Amazon.com, or a LEGO MINDSTORMS NXT 2.0 kit.
  • Polyethylene pipe, 4 inches in diameter x 6 inches long. Available at hardware stores.
  • ABS DWV cap, 4 inches in diameter. Available at www.homedepot.com SKU # 145668
  • PVC pipe cement. Available at www.homedepot.com SKU # 798304
  • NXT programming manual of your choice. Two are listed in the Bibliography.
  • Computer for programming your robot. Make sure that you have permission from the computer's owner to load the LEGO® Mindstorms® software.

Share your story with Science Buddies!

I did this project I Did This Project! Please log in and let us know how things went.

Experimental Procedure

Note: This engineering project is best described by the engineering design process, as opposed to the scientific method. You might want to ask your teacher whether it's acceptable to follow the engineering design process for your project before you begin. You can learn more about the engineering design process in the Science Buddies Engineering Design Process Guide.

Waterproofing the Motor

  1. Get your motor and packs of Sugru® ready. Sugru is a "self-setting" rubber, meaning you can mold it with your hands initially, but it will harden and solidify in 24 hours.
  2. Use the Sugru to completely encase the motor, as shown in Figure 3.
    1. It will probably take you two to three packs of Sugru to completely encase the motor.
    2. Make sure you let the two wires and the motor's shaft stick out from the Sugru, as shown in Figure 3.
    3. Do not tightly pack the Sugru against the motor's shaft, which will prevent it from spinning. As shown in Figure 3, press the Sugru tightly up against the raised circle at the bottom of the motor's shaft, but leave the top of the circle uncovered.
    4. The Sugru takes 24 hours to solidify completely. In the meantime, you can continue to the next section to attach the propeller to your motor. However, do not put the motor underwater yet!
DC motor waterproofed with Sugru

Figure 3. Use Sugru, a rubber that sets in 24 hours, to make a waterproof shell around the DC motor.

Attaching the Propeller

  1. Cut several segments of heat-shrink tubing (both small and medium diameter) to roughly the length of the motor's shaft, as shown in Figure 4.
DC motor with heat shrink tubing

Figure 4. Cut several segments of heat-shrink tubing to the length of the motor's shaft.

  1. Slip a small-diameter segment of tubing onto the motor's shaft. Use a hair dryer to shrink-fit the tubing onto the shaft, as shown in Figure 5.
hair dryer and heat shrink tubing

Figure 5. Use a hair dryer to heat-shrink the tubing onto the motor's shaft.

  1. Continue to slip segments of heat-shrink tubing onto the motor's shaft, one at a time, as shown in Figure 6.
    1. Use the hair dryer to heat-shrink each new tubing segment before you add another one.
    2. When the small-diameter segments no longer fit onto the shaft, begin using the medium-diameter segments.
    3. Repeat this process until the outer diameter of the heat-shrink tubing is about the same size as the inner diameter of the propeller. This will probably require roughly four to six segments of heat-shrink tubing.
heat shrink tubing on a motor shaft

Figure 6. Place additional layers of heat-shrink tubing on the motor's shaft.

  1. Glue the propeller to the shaft using Elmer's® epoxy.
    1. Follow the instructions on the container to mix the Elmer's epoxy.
    2. Place a small amount of the epoxy inside the propeller's cylinder, using a toothpick or a plastic spoon.
    3. Carefully insert the propeller onto the motor's shaft, as shown in Figure 7. Be careful not to let any epoxy go all the way down to the base of the motor's shaft — this could prevent it from spinning once the epoxy hardens. Use a paper towel to wipe off extra epoxy if necessary.
    4. Once the propeller is pressed all the way onto the shaft, apply a dab of epoxy to the ends of the propeller to help seal it in place.
  2. Put your motor in a safe place and wait a day to continue your experiment. The Sugru and the epoxy both take 24 hours to solidify completely.
propeller glued to motor shaft

Figure 7. Glue the propeller onto the motor's shaft.

Connecting the Motor to the Battery Pack

  1. Your robot's motor will be powered by a 9 volt (V) battery in a battery pack. This battery pack has red and black wires, just like your motor.
  2. In order to increase the range of your robot, you will use two long pieces of wire to connect the motor to the battery pack. The length of these wires will depend on where you plan to test the robot.
    1. If you test the robot in a plastic container, like a storage bin or a trash can, then about 1 meter (m) of wire should be sufficient.
    2. If you test the robot in a much larger area, like a swimming pool, then you should use longer lengths of wire, like 3–5 m, depending on the size of the pool.
  3. Use the wire strippers to cut two pieces of wire of the same length, one black and one red.
  4. Use the wire strippers to trim 1 centimeter (cm) of insulation from each end of each wire. If you are not familiar with using wire strippers, refer to the Science Buddies Wire Stripping Tutorial.
  5. If your motor's black wire has a circular connector on the end, use the wire strippers to cut it off and then strip some insulation from the remaining wire, as shown in Figure 8.
Cutting off crimped motor lead connector

Figure 8. Remove the connector from the end of the motor's black wire and strip some insulation from the remaining wire.

  1. Twist the red and black wires from the motor together with one end of the long pieces of black and red wires, as shown in Figure 9.
    1. Optional: Ask an adult to help you solder these connections to make them stronger.
    2. Carefully and tightly cover the soldered connections in electrical tape to ensure that they are waterproof.
twisted wires with electrical tape

Figure 9. Twist the wires together and cover them with electrical tape after you solder the connections.

  1. Repeat step 6 to connect the other ends of the long wires to the 9 V battery pack. When you have finished, your motor, wires, and battery pack should look like the ones shown in Figure 10.
underwater robot motor connected to battery pack

Figure 10. Assembled motor, propeller, and battery pack.

  1. Finally, take the cover off the battery pack and insert the 9 V battery.
    1. Make sure the battery pack's power switch is in the OFF position before you insert the battery.
    2. After inserting the battery, turn the battery pack to ON. The motor should spin. If the motor does not spin:
      1. Double-check your electrical connections. Make sure none of the wires you twisted together is loose.
      2. Make sure the motor's shaft is not jammed with epoxy or Sugru. Try spinning the propeller by hand to break it loose if it is stuck.

Building the Robot's Body

  1. Tightly secure the lids on the film canisters so they do not leak. Then, use duct tape to attach them to the longest edge of the clothes hanger, as shown in Figure 11. The film canisters act as floats to keep the robot buoyant.
canisters duct taped to underwater robot

Figure 11. Duct-tape the film canisters to the clothes hanger.

  1. Twist together the long red and black wires, and use several strips of electrical tape to hold them together along their length. This will help prevent the wires from getting tangled in the propeller or the clothes hanger.
  2. Use duct tape to attach the waterproofed motor to the hook of the clothes hanger, as shown in Figure 12.
    1. Make sure the propeller has room to rotate freely. Do not let the propeller touch the clothes hanger or get stuck in the duct tape.
ROV underwater robot

Figure 12. Use duct tape to attach the motor to the hook of the clothes hanger, completing the underwater robot.

  1. You may need to attach one or two nails to the hook of the clothes hanger as a ballast, which acts as weight and enables the robot to sink. You will have to experiment with the nails to find out if ballast is required.

Testing the Underwater Robot

  1. If you are using a large container to test your robot, fill it to the top with water. If you are using a pool or other body of freshwater, skip to step 2.
  2. Place the robot in the water, with the hook of the clothes hanger first. Make sure to keep the battery out of the water. See Figure 13.
    1. The hanger should float just under the surface of the water. Add a nail to the hook of the hanger to act as a ballast and help weigh it down if it does not float just under the water's surface.
Robot testing
 Robotics science project

Figure 13. Testing the underwater robot. This robot models an ROV robot, because power is being supplied via a cable out of the water.

  1. Turn the battery pack's power switch to ON. Does the robot move down? How fast does it move? What happens when you turn the battery pack to OFF? Does the robot move back up slowly or quickly?
    1. Safety tip: Keep your fingers away from the spinning propeller to prevent injury.
  2. If your robot moves up instead of down, do not worry. This just means you need to switch the red and black wires to make the propeller spin in the opposite direction.
    1. Take your robot out of the water.
    2. Use your wire strippers to cut the red and black wires at a point close to the 9 V battery pack.
    3. Now, connect the red wire from the battery pack to the long black wire, and the black wire from the battery pack to the long red wire by twisting them together, the same way you did in step 6 of the section.
    4. Wrap the connections in electrical tape.
    5. Test your robot again. The propeller should spin in the opposite direction, enabling your robot to move down.

Share your story with Science Buddies!

I did this project I Did This Project! Please log in and let us know how things went.


  • Could your guard robot monitor a semicircular rather than a circular territory? Modify the scanning portion of your program to monitor a semicircle.
  • Build an additional intruder and test if your robot can distinguish intruders that are close together. See how closely you can place the intruders and still have the robot "push" them out individually.

Share your story with Science Buddies!

I did this project I Did This Project! Please log in and let us know how things went.

Ask an Expert

The Ask an Expert Forum is intended to be a place where students can go to find answers to science questions that they have been unable to find using other resources. If you have specific questions about your science fair project or science fair, our team of volunteer scientists can help. Our Experts won't do the work for you, but they will make suggestions, offer guidance, and help you troubleshoot.

Ask an Expert

Related Links

If you like this project, you might enjoy exploring these related careers:

female robotics engineer adjusting robot

Robotics Engineer

Have you watched "The Transformers" cartoon series or seen the "Transformers" movies? Both shows are about how good and evil robots fight each other and the humans who get in the middle. Many TV shows and movies show robots and humans interacting with each other. While this is, at present, fantasy, in real life robots play a helpful role. Robots do jobs that can be dangerous for humans. For example, some robots defuse landmines in war-stricken countries; others work in harsh environments like the bottom of the ocean and on the planet Mars. At the heart of every robot is a robotics engineer who thinks about what a robot needs to do and works with several engineering disciplines to design and put together the perfect piece of equipment. Read more
robotics technician

Robotics Technician

Robots are no longer futuristic machines. Robots are here and now and are used in manufacturing, health care, service industries, and military applications. They perform tasks that are repetitive and hazardous—things that humans don't want to do or are unsafe to do. But robots are still machines, which means they require humans to build, maintain, program, and keep them functioning efficiently. Robotics technicians work with robotics engineers to build and test robots. They are responsible for installing and maintaining robots and keeping them in working order for their employers. If you are interested in working with robots, your future is here and now. Read more
Mechanical engineer building prototype

Mechanical Engineer

Mechanical engineers are part of your everyday life, designing the spoon you used to eat your breakfast, your breakfast's packaging, the flip-top cap on your toothpaste tube, the zipper on your jacket, the car, bike, or bus you took to school, the chair you sat in, the door handle you grasped and the hinges it opened on, and the ballpoint pen you used to take your test. Virtually every object that you see around you has passed through the hands of a mechanical engineer. Consequently, their skills are in demand to design millions of different products in almost every type of industry. Read more
Computer programmer typing on a keyboard

Computer Programmer

Computers are essential tools in the modern world, handling everything from traffic control, car welding, movie animation, shipping, aircraft design, and social networking to book publishing, business management, music mixing, health care, agriculture, and online shopping. Computer programmers are the people who write the instructions that tell computers what to do. Read more

News Feed on This Topic

, ,
Reading level:
Note: A computerized matching algorithm suggests the above articles. It's not as smart as you are, and it may occasionally give humorous, ridiculous, or even annoying results! Learn more about the News Feed

Looking for more science fun?

Try one of our science activities for quick, anytime science explorations. The perfect thing to liven up a rainy day, school vacation, or moment of boredom.

Find an Activity