Jump to main content

Build an Obstacle-Avoiding Robot (BlueBot Project #4)

1
2
3
4
5
216 reviews
Log In

This feature requires that you be logged in as a Google Classroom teacher and that you have an active class in Google Classroom.

If you are a Google Classroom teacher, please log in now.

For additional information about using Science Buddies with Google Classroom, see our FAQ.

Abstract

In the animal kingdom, many different critters use whiskers to help them find their way around in the dark, through murky waters, or even to help them hunt prey. Whiskers can be very useful when the animals cannot rely on sight. Did you know that you can also build a robot that uses "whiskers" to find its way around? This project will show you how to build a simple robot that uses whiskers as "bump sensors" to help the robot detect when it is about to bump into an obstacle, so it can turn around and avoid crashing. Can you design a robot that can drive around on its own without crashing and getting stuck?

Summary

Areas of Science
Difficulty
 
Time Required
Short (2-5 days)
Prerequisites
You will need to know how to use a breadboard to do this project. See the Science Buddies reference How to Use a Breadboard for Electronics and Circuits if you have not used a breadboard before.
Material Availability
A kit is available from our partner Home Science Tools. See the Materials section for details.
Cost
High ($100 - $150)
Safety
Short circuits can get very hot and present a burn hazard. Be careful to avoid short circuits when building your robot. See the Procedure for more information.
Credits
Ben Finio, PhD, Science Buddies
A video demonstration of the obstacle-avoiding robot.

Objective

Build a basic obstacle-avoiding robot and improve the design to help it avoid getting stuck.

Introduction

Have you ever gotten up to go to the bathroom in the middle of the night and stubbed your toe or hit your shin on a piece of furniture in the dark? It hurts! As humans, we rely heavily on our eyesight to get around. Many other animals are active at night, swimming through murky waters, or crawling into tiny, dark spaces where relying on eyesight is not a good option. Some of them evolved whiskers to help them "feel" their way around in the dark by detecting nearby surfaces, air currents, or even to help them hunt for prey.

What does this have to do with robots, you ask? Engineers want to design robots that are autonomous, meaning they can move around on their own without direct human control. One important part of autonomous operation is avoiding crashing into things. In robotics, this is called obstacle avoidance. Using a camera and a computer to let a robot "see" obstacles with computer vision can be complicated and expensive. One much simpler approach is to use the robotic equivalent of whiskers that stick out from either side of the robot, like the ones shown in Figure 1. These whiskers can be used to detect obstacles and make the robot turn away before it crashes. Figure 1 shows a picture of the robot. Watch the video for a demonstration.

Photo of a robot designed to avoid obstacles using popsicle stick bumpers
Figure 1. The obstacle-avoiding robot you will build in this project.

Can you figure out how the robot works, based on watching the video? The robot has two wheels attached to motors (and a third "roller" wheel that keeps it from falling over). The direction in which the wheels spin can be used to steer the robot. Normally, both wheels spin forward, which causes the robot to move forward. However, when a whisker bumps into an obstacle, it causes the wheel on the opposite side of the robot to spin backwards. This makes the robot steer away from the obstacle. Figure 2 illustrates this concept.

Diagram of whiskers on a robot detecting objects and moving the robot in a different direction to avoid them

A robot with whiskers moves forward when both whiskers are untouched. When the left whisker bumps into an object, the right wheel of the robot is put into reverse which will cause the robot to turn right and avoid the object. The inverse is true if the right whisker bumps into an object, the robot will turn left. If both whiskers bump into an object both wheels are spun in reverse and the robot backs up.


Figure 2. A diagram showing how the obstacle-avoiding robot steers. The blue arrows represent the direction in which the wheels spin. When neither whisker detects an obstacle, both wheels spin forward and the robot drives forward (top image). When the left whisker hits something, the left wheel keeps spinning forward, but the right wheel spins backward, causing the robot to turn right (left image). The opposite is true for the right whisker (right image). If both whiskers hit obstacles, the robot will go in reverse (bottom image).

How do the whiskers make the wheels spin in one direction or the other? This depends on an electrical circuit. A circuit is a path through which electricity can flow. Circuits can be very simple, like a battery that lights up a single lightbulb, or very complicated, like the kind inside your computer. In this robot, a circuit uses electrical signals from the whiskers to control two motors that drive the wheels. Figure 3 shows a flow chart for how the robot works.

Flow chart shows a relationship between a robot's whiskers, circuit, motors, wheels and motion
Figure 3. A flow chart showing how the robot works. Whiskers provide input signals to a circuit that controls motors, which turn wheels and make the robot move.

In this science project, you will follow step-by-step directions to build a basic obstacle-avoiding robot, like the one shown in the video. The robot is able to drive around and automatically avoid some obstacles by turning away from them. However, the robot is not perfect. Sometimes it will get stuck, especially if it drives straight into an obstacle that was directly ahead (so neither whisker detects it). Your goal will be to use the engineering design process to improve your robot and help it avoid getting stuck.

While previous experience with electronics will be helpful in building the robot, it is not required. If you would like to get started building your robot right away, you can move on to the Procedure. For more information about how the robot works and what the different parts of the circuit do, continue reading the rest of the Introduction. For a detailed explanation of the robot's circuit (for advanced students or robotics/electronics hobbyists), including a complete circuit diagram, see the Help section.

Technical Note

The rest of the Introduction contains more details about the electronic components used in the circuit. The following information is provided as a reference, and you do not need to fully understand it in order to do the project. If are ready to just start building the robot, you can move on to the Procedure.

If you would like to read the rest of the Introduction, it will help if you are familiar with basic electronics terms like voltage, current, and resistance. Science Buddies has many beginner and intermediate level electronics projects, an Electronics Primer, and a Electricity, Magnetism, & Electromagnetism Tutorial that can help you learn more about these topics. You can also refer to the Bibliography for more information.

For a complete technical explanation of how the circuit works, including a circuit diagram, see the Help section.

The circuit you will build in this project involves a variety of electronic components. All of the components are combined on a chassis, or plastic base for the robot, which includes wheels. Some of the components, like batteries and switches, you probably use every day (even if you do not notice it). Others, like an H-bridge, might be new to you if you have not done an electronics project before. Table 1 has pictures and descriptions of each component you will use in this project. For a more detailed explanation of what each component does in the circuit, see the Help section.

Item NamePicture Description
Battery pack
A battery pack that can hold four double A batteries
This is the power supply for your robot. Battery packs come in all shapes and sizes. The one in this project holds 4 AA batteries.
Breadboard
A breadboard
A breadboard allows you to quickly and easily connect wires and electronic components in order to build a circuit. The connections are not permanent, so you can easily move things around if you make a mistake.
Switch
A switch with three leads
You use switches every day to turn lights and appliances on and off. This is a tiny switch that fits on a breadboard, to let you turn your robot on and off.
Jumper wire
Six jumper wires of different lengths
Jumper wires are short wires used to make electrical connections on a breadboard. They come with many colors of plastic insulation, which makes it easy to color-code and organize complicated circuits.
DC Motor
A direct current motor
Electrical current causes a motor to spin. Two motors drive the robot's wheels. This type of motor runs on direct current (DC) from a battery (as opposed to alternating current [AC] from a wall outlet).
H-bridge
A L293D h-bridge motor driver
An H-bridge is a special type of chip designed to allow bi-directional control of a DC motor. This is unlike a MOSFET (used in the other robotics projects listed in the Make It Your Own section), which only allows a motor to spin in one direction.
10 kΩ resistor
A resistor
A resistor resists the flow of electrical current. In this project the resistors are used as "pull down" resistors that "pull" the value of a pin on the H-bridge down to 0 V.
Lever switch
A lever switch with three lead wires
Two lever switches act as your robot's bump sensors. Electrically, they work the same as the robot's power switch, but the physical shape is different; they have long levers that act like "whiskers" to detect when the robot bumps into something.
Table 1. Pictures and descriptions of each circuit component used in this project.

Terms and Concepts

General electronics and robotics terms:

Circuit components:

Questions

Bibliography

Check out this reference if you want to learn more about how whiskers work in animals:

These beginner references will be useful if you are just starting out with electronics and robotics:

These references will be useful for students who want to learn more about how the circuit works, and about electronics in general:

These references contain specific information about some of the circuit components and concepts used in this project:

  • Lindblom, J. (n.d.). Resistors. SparkFun Electronics. Retrieved October 16, 2014.
  • Clark, A. (n.d.). Pull-up Resistors. SparkFun Electronics. Retrieved October 16, 2014.
  • Hord, M. (n.d.). Digital Logic. SparkFun Electronics. Retrieved October 16, 2014.
  • Wikipedia contributors. (2014, September 13). H-bridge. Wikipedia: The Free Encyclopedia. Retrieved October 16, 2014.
  • Texas Instruments. (2004 November). L293, L293D Quadruple Half-H Drivers. Retrieved October 20, 2014.

Materials and Equipment Buy Kit

Recommended Project Supplies

Get the right supplies — selected and tested to work with this project.

View Kit

Disclaimer: Science Buddies participates in affiliate programs with Home Science Tools, Amazon.com, Carolina Biological, and Jameco Electronics. Proceeds from the affiliate programs help support Science Buddies, a 501(c)(3) public charity, and keep our resources free for everyone. Our top priority is student learning. If you have any comments (positive or negative) related to purchases you've made for science projects from recommendations on our site, please let us know. Write to us at scibuddy@sciencebuddies.org.

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.

Assembling Your BlueBot Chassis

  1. Follow the instructions in the video to assemble your robot chassis.
    1. Your kit comes with printed directions for assembling the chassis, but we recommend watching the video so you fully understand how all the parts fit together.
    2. The blue plastic parts come with a thin layer of protective plastic coating. Peel this coating off before assembling your chassis.
    3. We also recommend using double-sided foam tape to attach the battery holder to the top of the chassis, as shown in Figure 4. The printed directions recommend putting the battery holder in-between the two chassis plates, but this makes it harder to change the batteries.
    4. You will have some extra parts when you are done, including screws, nuts, and blue plastic gears. Put these parts aside for now; you will not need them for this project.

An assembled chassis with a breadboard and battery pack for an object avoiding robot
Figure 4. A completed BlueBot chassis with breadboard and battery pack on top.

Assembling Your Circuit

  1. To build your circuit, you will need to know how to use a breadboard. Watch the video and see the Science Buddies reference How to Use a Breadboard for Electronics and Circuits.
  1. Now that you know how to use a breadboard, you are ready to assemble your BlueBot circuit. Table 2 shows a list of all the components in the circuit and where they go on the breadboard. You can download and print a PDF of this table—complete with checkboxes to track each step—to use while you are building your robot. You can also view a slideshow that shows breadboard diagrams of the circuit. Follow along in the table and/or slideshow to build your circuit one component at a time. Your finished circuit should look like the one in Figure 5. Pay attention to these notes:
    1. Remember to push all components firmly into the breadboard.
    2. All references to orientation (up, down, left, and right) assume you have the breadboard "right-side up," so the writing is facing you.
    3. Your jumper wire kit comes with an assortment of colors, and the colors may vary. It does not matter what color jumper wires you use. Your colors do not need to match the colors in the diagrams. In general, you should use the shortest wires possible, to help keep your circuit neat.
    4. Your lever switches act as bump sensors, so they need to be mounted on the front of your robot, not on the breadboard. You also need to attach popsicle sticks to the levers to extend the robot's "whiskers." See Figures 6 and 7 for instructions on how to mount the lever switches to your robot's chassis.
    5. Insert the batteries last. If you see or smell smoke when you insert the batteries, you have a short circuit somewhere. Immediately remove the batteries and re-check your wiring.
Component Picture Symbol Breadboard holes Note
Power switch
A switch with three leads
Circuit diagram symbol for a switch
F1, F2, F3 The direction in which it is facing does not matter, but make sure to slide the switch down (toward row 30, away from row 1), this is the "off" position.
Jumper wire
A purple jumper wire
Circuit diagram symbol for a jumper wire
J2 to (+) bus Color does not matter.
Jumper wire
A purple jumper wire
Circuit diagram symbol for a jumper wire
Left side (+) bus to right side (+) bus Color does not matter.
Jumper wire A purple jumper wire Circuit diagram symbol for a jumper wire Left side (-) bus to right side (-) bus Color does not matter.
H-bridge motor driver A L293D h-bridge motor driver Breadboard diagram symbol for a L293D h-bridge motor driver Left side: holes E15 to E22

Right side: holes F15 to F22
The semi-circular "notch" in one end of the chip must face up (towards row 15).
You may need to bend the pins together slightly to get them to fit into the breadboard.
Note: the writing on your H-bridge might not match the picture exactly. This is OK.
10 kΩ resistor A 10k ohm resistor Breadboard diagram symbol for a 10k ohm resistor J16 to (-) bus Brown, black, orange, gold stripes. Direction does not matter.
10 kΩ resistor A 10k ohm resistor Breadboard diagram symbol for a 10k ohm resistor J21 to (-) bus Brown, black, orange, gold stripes. Direction does not matter.
10 kΩ resistor A 10k ohm resistor Breadboard diagram symbol for a 10k ohm resistor A16 to (-) bus Brown, black, orange, gold stripes. Direction does not matter.
10 kΩ resistor A 10k ohm resistor Breadboard diagram symbol for a 10k ohm resistor A21 to (-) bus Brown, black, orange, gold stripes. Direction does not matter.
Jumper wire
A purple jumper wire
Circuit diagram symbol for a jumper wire
J15 to (+) bus Color does not matter.
Jumper wire
A purple jumper wire
Circuit diagram symbol for a jumper wire
J18 to (-) bus Color does not matter.
Jumper wire
A purple jumper wire
Circuit diagram symbol for a jumper wire
J19 to (-) bus Color does not matter.
Jumper wire
A purple jumper wire
Circuit diagram symbol for a jumper wire
J22 to (+) bus Color does not matter.
Jumper wire
A purple jumper wire
Circuit diagram symbol for a jumper wire
A15 to (+) bus Color does not matter.
Jumper wire
A purple jumper wire
Circuit diagram symbol for a jumper wire
A18 to (-) bus Color does not matter.
Jumper wire
A purple jumper wire
Circuit diagram symbol for a jumper wire
A19 to (-) bus Color does not matter.
Jumper wire
A purple jumper wire
Circuit diagram symbol for a jumper wire
A22 to (+) bus Color does not matter.
Top lever switch A single pull double throw lever switch Breadboard diagram symbol for a single pole double throw lever switch Red wire to (+) bus
Black wire to B21
White wire to B16
See Figures 6 and 7 for mounting instructions.
Bottom lever switch A single pull double throw lever switch Breadboard diagram symbol for a single pole double throw lever switch Red wire to (+) bus
Black wire to I21
White wire to I16
See Figures 6 and 7 for mounting instructions.
Top motor A DC motor Red lead to C17
Black lead to C20
When the robot is driving forward, this is the "right" motor.
Bottom motor A DC motor Red lead to H17
Black lead to H20
When the robot is driving forward, this is the "left" motor.
Battery holder Red lead to J1
Black lead to (-) bus
Do not insert batteries until circuit is complete.
AA battery N/A Insert into battery holder. Make sure (+) signs on batteries line up with (+) signs in battery holder.
Table 2. List of circuit components and locations. A printable PDF version is available.


Slideshow with step-by-step instructions viewable online.



A fully wired breadboard for an object avoiding robot
Figure 5. Your completed circuit should look like this.
  1. Use double-sided foam tape to attach the lever switches to the front of your robot, and to attach popsicle sticks to the lever switches, as shown in Figures 6 and 7.
Two lever switches are attached to the bottom front chassis of an object avoiding robot using double sided tape
Figure 6. Use double-sided foam tape to mount the lever switches to the front of your robot. You can decide exactly where you want to put the switches; for example, whether you attach them to the top or bottom plate of the chassis. Note that you might end up adjusting them later.


Two popsicle sticks are attached to individual lever switches at the front of an object avoiding robot
Figure 7. Use tape to attach popsicle sticks to the metal arms of the lever switches to act as "whiskers."

Testing Your Robot

You are finally ready to start testing your robot! Remember that now you will need to follow the Engineering Design Process to get your robot working. Follow these steps to learn how to use your robot.

  1. Double-check your circuit against the breadboard diagrams in the previous section. Remember that just one misplaced wire can prevent the circuit from working properly.
  2. Hold the robot's chassis in one hand, so the wheels are off the ground.
    1. Turn the robot's power switch "on" by sliding it up, toward row 1 on the breadboard.
    2. Your robot's wheels should start spinning forward. If you press down on the popsicle stick attached to either lever switch, that should cause the wheel on the opposite side of the robot to spin backward. Check Table 3 to see what you should do next.
Observation What to do
I see or smell smoke. Immediately turn your robot off. You have a short circuit somewhere. Recheck your wiring against the breadboard diagrams in the previous section.
Each wheel spins forward when I turn the robot on, and each wheel goes in reverse when I press the lever switch on the opposite side of the robot. Your robot works! Move on to the next step.
One or both wheels spin backwards when I turn the robot on. If a wheel is spinning backwards, reverse the red and black wires of that motor. See the Help section for more details.
The wheels spin when I turn the robot on, but do not change direction when I press the lever switches. You have an error in your circuit somewhere. Re-check your circuit against the breadboard diagrams in the previous section. Remember that just one misplaced wire can prevent your circuit from working.
Pressing a lever switch causes the wheel on the same side of the robot to switch direction. You have your two motors or your two lever switches' wires reversed. Swap one set of connections, but not both (for example, take the motor wires that are plugged in to the right side of your breadboard and switch them with the motor wires on the left side of your breadboard).
The wheels do not spin at all when I turn the robot on. See the Help section for troubleshooting information.
Table 3. Troubleshooting procedure for the first time you turn on your robot.
  1. Once you have your robot's circuit working, try putting it down on the floor and aiming it toward a wall at about a 45 degree angle. The robot should drive toward the wall, touch the wall with one of its "whiskers," then turn away and keep driving. You can also try putting your hand or foot in front of the robot's whiskers as it drives around, forcing it to turn.
  2. Your robot might not work perfectly; sometimes it might get stuck or fail to turn. This is where the engineering design process really comes into play. Think about what you can do to improve your robot. Here are some suggestions to get you started:
    1. Do the popsicle sticks come loose or fall off? Is the connection between the popsicle sticks and the lever switches sturdy enough?
    2. What happens if you change the position or angle of the lever switches? Is it better for the "whiskers" to be pointing straight out to the side, or angled slightly forward or backward?
    3. What happens if your robot drives straight into an obstacle, without hitting either whisker? Can you think of a way to fix this?
  3. Once you have your robot working, see if you can get it to navigate a more complicated "obstacle course" or maze. Can it automatically bounce off several obstacles and keep driving without getting stuck? Can you let it drive around a room in your house or school and just bounce off the existing furniture and walls? How long can it drive before it gets stuck? What other improvements could you make to help prevent the robot from getting stuck?

Explore More!

Looking for more robot fun? Explore the World of Robotics with This Suite of Projects!

Troubleshooting

For troubleshooting tips, please read our FAQ: Build an Obstacle-Avoiding Robot (BlueBot Project #4).

icon scientific method

Ask an Expert

Do you have specific questions about your science project? 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.

Global Connections

The United Nations Sustainable Development Goals (UNSDGs) are a blueprint to achieve a better and more sustainable future for all.

This project explores topics key to Industry, Innovation and Infrastructure: Build resilient infrastructure, promote sustainable industrialization and foster innovation.

Variations

Explore More!

Looking for more robot fun? Explore the World of Robotics with This Suite of Projects!

Frequently Asked Questions (FAQ)

If you are having trouble with this project, please read the FAQ below. You may find the answer to your question.
Q: My wheels do not spin at all. What should I do?
A: If your wheels do not spin at all when you turn the robot on, there are several troubleshooting steps you can try:
  • Double-check your circuit to make sure that it exactly matches the breadboard diagrams from the procedure.
  • Make sure all of your jumper wires and component leads are pressed firmly into the breadboard. You can read about other common breadboard mistakes in the the Common Mistakes section of our breadboard tutorial.
  • Make sure your batteries are properly inserted into the battery pack, and that the "+" symbols on the batteries line up with the "+" symbols on the battery pack.
  • Make sure the power switch for your robot is toggled "on" (the slider should be pushed toward the top of the breadboard).
  • If you have been using your robot for a long time, or did some of the other BlueBot projects first, your batteries may be dead. Try putting fresh batteries in your robot if none of the other steps work.
Q: Only one of my robot's wheels is spinning. What is wrong?
A: Your robot's circuit consists of two identical halves that drive the two motors. If only one wheel is spinning, chances are you just have something placed incorrectly on the breadboard in one half of the circuit. Very carefully double-check all of your writing on the side of the motor that is not working. It only takes one misplaced component or jumper wire to prevent the motor from spinning!
Q: My robot is going backwards! What should I do?
A: If your robot is driving backwards, all you need to do is switch the breadboard connections of the red and black leads from each motor. This is shown in Figure 8.
Breadboard diagram shows two motors, a battery pack and two lever switches wired to an obstacle avoiding robot circuit


Breadboard diagram shows two spdt switches, two motors and a battery pack wired to a breadboard
Figure 8. If one or both of your robot's wheels spins backwards, switch the red and black wires for that motor. Look closely at the top and bottom images here — notice how the red and black wires for each motor have been switched, while everything else in the circuit remains the same.

If only one wheel rotates backwards, switch the breadboard connections of the red and black leads from the motor powering that wheel only.

Q: I have double-checked everything and my robot still does not work. How can I check if something is broken?
A: If you are having trouble figuring out why your robot will not work, you can try asking a question in our Ask an Expert forums. If you have access to a multimeter, you can also use that to help troubleshoot your circuit. See the Science Buddies reference How to Use a Multimeter if you need help using a multimeter. There are several steps you can take to check individual parts of your circuit (depending on your multimeter's probes, you may need alligator clips and additional jumper wires to take these measurements).
  • Try plugging your motor's leads directly into the buses on your breadboard (for each motor, one lead to the power bus, one lead to the ground bus). If the motors turn on, then you know that they are working, and the problem is elsewhere in your circuit. If the motors do not turn on, that does not necessarily mean they are broken. There might be a problem with your power supply (see next point).
  • Check your breadboard's power supply.
    • Set your multimeter to measure DC volts. Four fresh AA batteries should provide just over 6 V.
    • Turn your power switch on and measure the voltage between the breadboard's buses. If you do not read a voltage, there may a problem with your power switch (see the first question in this FAQ), but you should also double check that your power switch and the red jumper wire from hole J2 to the power bus are in the right place.
    • Unplug the red and black battery pack leads and measure the voltage of the battery pack directly. If you get a reading, then you know your battery pack is working, and the problem is with your breadboard connections or the power switch. If you do not get a reading, make sure all the batteries are in the correct orientation in your battery pack, and that none of the metal clips and springs that hold the batteries in place are loose.
  • Test the pins on the H-bridge. See the How does the circuit work? question for explanations of what the different pins do. Specifically:
    • Pins 1, 8, 9, and 16 should all be at about 6 V when your robot is on. If they are not, then your H-bridge chip may not be properly receiving power. Check your jumper wire conections to the power bus.
    • Pins 4, 5, 12 and 13 should all be at 0 V because they are connected to ground. Make sure you did not accidentally connect them to the power bus instead.
    • Pins 2, 3, 6, and 7 should all toggle between 0 V and 6 V when you press one of the bumper switches. Pins 6 and 7 should always have the opposite value of pins 2 and 3 (e.g. when pins 2 and 3 are at 6 V, pins 6 and 7 should be at 0 V and vice versa). If not, make sure you have the resistors and bumper switches all connected correctly.
    • The same applies to pins 10, 11, 14, and 15 when you press the other bumper switch.
  • If the motors work when you plug their leads directly into the buses, and the voltages on the H-bridge chip appear correct, then you know the individual components in your circuit are functioning so nothing is "broken." Double and triple-check all your breadboard connections. Remember that just one misplaced wire can prevent the whole circuit from working.
Q: How can I make my robot go faster?
A: Your robot's motors use a lot of electrical power. As the batteries drain, they might have trouble powering the L293D and the motors at the same time, which can result in your robot getting stuck easily or failing to turn. To fix this, you can use two different battery packs: one to power the motors, and one to power the rest of the circuit. To add a second battery pack, use the 3xAA battery pack that comes in your BlueBot kit (you will need three more AA batteries, since the kit only comes with four) and follow these steps, as shown in Figure 9:
  1. Remove the jumper wire that goes from hole A22 to the (+) bus.
  2. Move the 4xAA battery pack's red wire to hole A22. Note: This wire now bypasses the breadboard's power switch. To turn the robot "off" completely, you will need to disconnect this wire.
  3. Plug the 3xAA battery pack's red wire into hole J1, and the black wire into the (-) bus. You will need to mount the 3xAA battery pack to the chassis with double-sided tape. You can put it in between the top and bottom chassis plates, or on top of the 4xAA battery pack.

For an explanation of how this works, see the L293D's datasheet and the answer to the next question in this FAQ. Pin 8 on the L293D (labeled VCC2 in the datasheet) is the power source for the motors connected to the chip. Pin 16 (labeled VCC1) is the "logic-level" voltage. These two voltages do not need to be the same. You can actually power the motors with up to 36 V (do not try that in this project — it would destroy your motors!).

Breadboard diagram shows two motors, two battery packs and two lever switches wired to an obstacle avoiding robot circuit
Figure 9. Circuit diagram for adding the 3xAA battery pack to your robot. It is essential to remove the jumper wire connecting hole A22 to the (+) bus, or else you will short the two battery packs together.
Q: How does the circuit work? What is the circuit diagram?
A: The circuit diagram for the robot is shown in Figure 10. If you do not know how to read a circuit schematic, see the How to Read a Schematic reference. The circuit depends on the L293D chip, a type of "H-bridge," also referred to as a "motor driver." The chip can control two motors in forward and reverse. Its operation depends on digital logic, which consists of "highs" and "lows" (also referred to as 1 and 0 or on and off). Since the circuit has two symmetric halves, this explanation will just explain one half of it.
  • The L293D has two input pins (2 and 7). These control two output pins (3 and 6), which are connected to the motor. If an input pin is high, its output pin will also be high (about 6 V with four fresh AA batteries). If the input pin is low, its output pin will also be low (0 V). (note: this is a simplified explanation of how the L293D works, specific to this circuit. You can read more details about the L293D in its official datasheet).
  • Both input pins have pull-down resistors, that "pull down" their voltage to 0 V by default. This will be important later on. You can read this tutorial to learn more (note that the tutorial is about pull-up resistors, but the concept is exactly the same for pull-down resistors).
  • In order for the motor to spin, current must flow through it, which means its wires must be at two different voltages. If both wires are at 6 V, or both wires are at 0 V, the motor will not spin at all. However, if one wire is at 6 V and the other wire is at 0 V, current will flow through the motor and it will spin. Reversing the voltages just reverses the direction the motor spins.
  • The lever switch's "common" pin is connected to the positive voltage supply (V+). The other two pins are connected to the input pins (2 and 7) of the L293D. So, at any given time, one of those input pins will be shorted directly to V+, a logical "high." Since the resistance to V+ is much lower than the resistance to ground through the pull-down resistor, this brings the input pin's voltage up to V+. The other input pin remains at 0 V, because it is connected to ground through the pull-down resistor.
  • When the lever switch switches positions, this switches the voltages (V+ and 0 V) on the two input pins, causing the motor to switch directions.
Circuit diagram for an obstacle avoiding robot
Figure 10. The circuit diagram for the robot.
Q: What are the circuit diagram symbols for the components in this project?
A: Table 3 shows a picture, a breadboard diagram symbol, and a circuit diagram symbol (when applicable) for each component in the project.

Item namePicture Breadboard Diagram Symbol Circuit Diagram Symbol
Battery pack
A battery pack that can hold four double A batteries
Breadboard diagram symbol for a battery pack
Circuit diagram symbol for a battery
Breadboard
A breadboard
Breadboard diagram symbol for a breadboard
n/a
Switch
A switch with three leads
Breadboard diagram symbol for a switch
Circuit diagram symbol for a switch
Jumper wire
Six jumper wires of different lengths
Breadboard diagram symbol for a jumper wire
Circuit diagram symbol for a jumper wire
DC Motor
A direct current motor
Breadboard diagram symbol for a direct current motor
Circuit diagram symbol for a direct current motor
Male-female jumper wire
Four male to female jumper wires
Breadboard diagram symbol for a jumper wire
Circuit diagram symbol for a jumper wire
H-bridge
An L293D H bridge motor driver
Breadboard diagram symbol for an L293D H bridge
Circuit diagram symbol for an L293D H bridge
10 kΩ resistor
A 10000 ohm resistor
Breadboard diagram symbol for a 10000 ohm resistor
Circuit diagram symbol for a resistor
Lever switch
A single pole double throw lever switch or SPDT lever switch
Breadboard diagram symbol for a lever switch
Circuit diagram symbol for a switch
Table 3. Circuit components used in this project, along with their respective breadboard diagram symbols and circuit diagram symbols.
Q: How did you make the breadboard diagrams for this project?
A: The breadboard diagrams for this project were created using Inkscape, a free vector graphics program. You can find free scalable vector graphic (SVG) files for many circuit components on Wikimedia Commons. There are other free programs specifically for making breadboard diagrams, such as Fritzing.

Careers

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

Career Profile
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… Read more
Career Profile
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… Read more
Career Profile
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… Read more
Career Profile
Just as a potter forms clay, or a steel worker molds molten steel, electrical and electronics engineers gather and shape electricity and use it to make products that transmit power or transmit information. Electrical and electronics engineers may specialize in one of the millions of products that make or use electricity, like cell phones, electric motors, microwaves, medical instruments, airline navigation system, or handheld games. Read more

Contact Us

If you have purchased a kit for this project from Science Buddies, we are pleased to answer any question not addressed by the FAQ above.

In your email, please follow these instructions:
  1. What is your Science Buddies kit order number?
  2. Please describe how you need help as thoroughly as possible:

    Examples

    Good Question I'm trying to do Experimental Procedure step #5, "Scrape the insulation from the wire. . ." How do I know when I've scraped enough?
    Good Question I'm at Experimental Procedure step #7, "Move the magnet back and forth . . ." and the LED is not lighting up.
    Bad Question I don't understand the instructions. Help!
    Good Question I am purchasing my materials. Can I substitute a 1N34 diode for the 1N25 diode called for in the material list?
    Bad Question Can I use a different part?

Contact Us

News Feed on This Topic

 
, ,

Cite This Page

General citation information is provided here. Be sure to check the formatting, including capitalization, for the method you are using and update your citation, as needed.

MLA Style

Finio, Ben. "Build an Obstacle-Avoiding Robot (BlueBot Project #4)." Science Buddies, 18 Nov. 2023, https://www.sciencebuddies.org/science-fair-projects/project-ideas/Robotics_p028/robotics/obstacle-avoiding-robot?class=AQXsTZF2KkC_SNL3dzWWaK685NFSzHfCgHHbt-N3mWEFEcF-u7nSapBIn5o_zgwmAnEnFmoK4PC2WWq_3-gfPaLWO21b9YSZkvznNLK_h1yMs0eLb3L_ETkZ_fPI2T05eW4. Accessed 28 Mar. 2024.

APA Style

Finio, B. (2023, November 18). Build an Obstacle-Avoiding Robot (BlueBot Project #4). Retrieved from https://www.sciencebuddies.org/science-fair-projects/project-ideas/Robotics_p028/robotics/obstacle-avoiding-robot?class=AQXsTZF2KkC_SNL3dzWWaK685NFSzHfCgHHbt-N3mWEFEcF-u7nSapBIn5o_zgwmAnEnFmoK4PC2WWq_3-gfPaLWO21b9YSZkvznNLK_h1yMs0eLb3L_ETkZ_fPI2T05eW4


Last edit date: 2023-11-18
Top
We use cookies and those of third party providers to deliver the best possible web experience and to compile statistics.
By continuing and using the site, including the landing page, you agree to our Privacy Policy and Terms of Use.
OK, got it
Free science fair projects.