Jump to main content

Build an Arduino Walking Robot

1
2
3
4
5
8 reviews

Abstract

Plenty of animals, like dogs and horses, can walk and run on four legs, but what about robots? Sometimes legs are better than wheels—try out this project to design and build your own quadruped walking robot!

Summary

Areas of Science
Difficulty
 
Time Required
Average (6-10 days)
Prerequisites
Previous Arduino experience is recommended. See our How to Use an Arduino page for tutorials.
Material Availability
Circuit parts required, see materials list for details.
Cost
Average ($50 - $100)
Safety
No issues
Credits
Ben Finio, PhD, Science Buddies
How to Build a Walking Arduino Robot (Quadruped) with Cheap Materials | Science Project

Objective

Design and build an Arduino robot that walks with four legs.

Introduction

Humans are pretty good at building vehicles with wheels, like cars. Wheels are great at going fast on flat surfaces like roads. Some vehicles can even drive off-road on fairly rough terrain. However, when it comes to things like going up stairs or getting over very uneven ground, sometimes legs are a better option. Thanks to millions of years of evolution, animals are great at getting around using legs. Humans are bipeds, meaning we walk in two legs. Many animals, like dogs and horses, are quadrupeds that walk on four legs. Insects are hexapods with six legs.

Building robots with legs that can walk, run, balance, and jump like animals can is a challenging task. Check out this robot called BigDog, made by a company called Boston Dynamics, that can walk on four legs and even recover from slipping on ice:

BigDog Overview (Updated March 2010)

In this engineering project, you will build your own (much smaller) quadruped robot using an Arduino and some craft supplies (Figure 1). The robot has four legs, each with two joints: one "hip" joint that rotates the whole leg forward and backward, and one "knee" joint that moves the lower part of the leg up and down. You will try to figure out the best gait, or order in which the robot moves its joints, to make it walk.

Front view of Arduino walking robot
Figure 1. A quadruped robot with a cardboard box for a body and popsicle sticks for legs.

When designing your robot's gait, you will need to consider the location of the robot's center of mass and how this affects its stability. When a quadruped robot is walking and lifts one leg off the ground, the remaining three legs form a tripod. If the robot's center of mass is inside this tripod (when viewed from the top), the robot will be stable. However, if the center of mass is outside the tripod, the robot will start to fall over (Figure 2).

Top-down view of stable and unstable configurations for a quadruped robot when standing on three legs
Figure 2. Top-down view showing the stability of a quadruped robot. The front left leg (not pictured) is lifted off the ground. In the left diagram, the center of mass falls inside a stable tripod formed by the other three legs. In the right diagram, the center of mass falls outside the support tripod, so the robot is unstable.

To build the robot, you will need to know how to use servo motors with an Arduino. Each of the robot's joints is made from a single motor, so there are eight motors total (two for each leg). Watch this video to learn how to use a servo motor:

Control a Positional Servo Motor with an Arduino (Lesson #10)

Now, get ready to build your own walking robot!

Terms and Concepts

Questions

Bibliography

Materials and Equipment

Notes about using an Arduino:

Note: this is an engineering design project, so the following materials list is just a suggestion. You can substitute or add other materials.

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

  1. Make a general sketch of how you plan to build your robot and where you will mount all the parts. Figures 3, 4, and 5 show top, bottom, and side views respectively of the Science Buddies robot. The Arduino and breadboard are mounted on the top of a cardboard box. The voltage regulator is mounted on the back of the box and the battery is taped under the box. The legs are made from popsicle sticks attached to the servo horns with double sided tape and zip ties (note: we later found that hot glue made sturdier connections). Remember that this is an engineering design project, so you can come up with your own design, you do not have to copy the design shown here.
Top view of robot showing Arduino and breadboard
Figure 3. Top view of the robot.

Bottom view of robot showing motors and battery
Figure 4. Bottom view of the robot.

Side view of the robot showing the legs
Figure 5. Side view of the robot.
  1. Arduino tutorials that show you how to use a single servo motor usually power the servo directly from 5 V on the Arduino. This works because the small servos are rated for 4.8–6 V, and the Arduino can provide enough current for a single servo. However, the Arduino's 5 V pin cannot provide enough current to drive all eight servo motors at once. We recommend powering your Arduino and motors using the circuit shown in Figure 6.
    1. The Arduino is powered by the 7.4 V LiPo battery through its Vin pin, where it can accept between 7–12 V as an input.
    2. Since 7.4 V is too high to power the servos directly, this voltage is also sent through a voltage regulator that converts it to 5 V. The voltage regulator has a much higher current rating than the Arduino. This allows you to safely power the motors without drawing too much current through the Arduino.
    3. You can learn more about powering Arduino projects from our Powering Your Arduino Project video and the official Powering Alternatives for Arduino Boards page.
    Circuit diagram for connecting the Arduino, battery, switch, and voltage regulator
    Figure 6. Circuit diagram for powering the robot. The positive wire from the 7.4 V battery goes to a switch. The other side of the switch goes to the Arduino Vin pin and the input voltage of the voltage regulator. The 5 V output from the regulator goes to the positive wire of each servo motor. All components in the circuit must have a common ground, but be careful not to short-circuit the different positive voltages together (including the 5 V output from the regulator and the 5 V pin on the Arduino).
  2. Connect the eight servo motors to your Arduino as shown in Figure 7.
    1. Each servo motor has three connections: ground (brown), power (red), and signal (orange). Note that if you purchased different servo motors than the ones in the materials list, the colors may be different.
    2. Break off the male-male header pins in sets of three and use them to connect the female ends of the servo motor cables to the breadboard, then use additional jumper wires to make connections to the Arduino.
    3. Make sure you connect the power wires to the 5 V supply from the voltage regulator and not the 5 V supply from the Arduino.
    4. Make sure you keep track of which motor is connected to which Arduino pin. You may wish to label the motors with a permanent marker.
    Breadboard diagram showing servo motor connections to Arduino
    Figure 7. Breadboard diagram for connecting the eight servos to the Arduino (battery and voltage regulator not pictured, the servos should be powered by the 5 V output from the voltage regulator).
  3. Test your circuit to make sure all eight servos work properly. It will be easier to troubleshoot any issues now before you have assembled the robot. You can use the servo test example code to test your servos. This code will move the servos attached to each pin one at a time. It will be easier to see the servos move if you attach servo horns before running the code.
  4. Once you are sure your circuit is working, it is time to assemble your robot. Use double-sided foam tape, hot glue, and zip ties for the attachments as needed. You may need to unplug some wires and re-connect them later in order to build the robot. Refer to figures 3, 4, and 5 for guidance, but remember that this is an engineering design project, so you can come up with your own design. Figure 8 shows the motor configuration for our robot and the direction of positive rotation for each motor (e.g. increasing leg 1's angle will cause it to rotate forward, increasing knee 1's angle will cause it to rotate outward), but your configuration may be different depending on how you attach the motors.
    1. Mount the Arduino, breadboard, voltage regulator, and battery to the cardboard box.
    2. Attach the four "hip" motors to the underside of the box. Use additional pieces of cardboard as supports to stiffen the motors if needed.
    3. Use popsicle sticks to form the upper parts of the legs.
    4. Attach the "knee" motors to the legs.
    5. Use popsicle sticks to form the lower parts of the legs.
    6. Add something (like a dab of hot glue) to the robot's "feet" to give them a better grip on slippery surfaces like wood.
    7. As needed, carefully re-route all wires to the breadboard. You may want to poke holes in the box to route wires through or use zip ties for cable management. Make sure the wires will not get tangled in the robot's legs when they move.
     top view of joint configuration for the walking robot

    top view of the robot with the front of the robot facing the top of the image. Top left corner: leg 1, positive rotation forward, knee 1, positive rotation outward. Bottom left corner: leg 2: positive rotation forward, knee 2, positive rotation inward. Bottom right corner: leg 3, positive rotation backward, knee 3, positive rotation outward. Top right corner: leg 4, positive rotation backward, knee 4, positive rotation inward.


    Figure 8. The robot's joint configuration and direction of positive rotation for each motor.
  5. Now for the challenging part: programming your robot to walk! You will need to write a program to control your robot's gait by moving the legs. You can use our quadruped robot example code to start, but since every robot is different, this code may not work for your robot. Here are some things to consider:
    1. You will have to decide in what order you will move joints. For example, you could lift knee 1, swing leg 1 forward, then put knee 1 down, repeat this process for the other three legs, then swing all four legs backward at once. Alternatively, you could swing the legs backward one at a time or in pairs.
    2. Remember to think about the robot's center of mass and forming a stable support tripod with the legs.
    3. Think about the range of motion you need for each joint. You probably do not need each motor to rotate through its full 180 degree range.
    4. Watch your robot to see if it sags under its own weight. Try to think of ways you can reinforce the robot to make it sturdier, or how you can make it lighter. As noted above, we found that hot glue worked better than double-sided tape for sturdy connections.
    5. Make good use of variables and functions to keep your code organized. For example, you can use variables to control servo angles instead of hard-coding certain angles, and you can write functions to control different leg movements such as "leg 1 forward."
    6. Using a single servo "write" command with a large change in angle can result in very jerky motion. Instead, you can use while loops with smaller, incremental changes in angle to result in smoother motion. See the Arduino 'sweep' page for example code.
    7. It may take a lot of experimentation on your part to find a gait that makes your robot move forward. Your robot might fall over or even move in circles at first, but that is OK! Iteration is an important part of the engineering design process. Keep trying and see if you can get your robot to move forward, even if it moves slowly or awkwardly.
    8. If you have a lot of trouble getting your quadruped robot to walk, consider adding two more legs to make a hexapod. This makes it easier to form a stable support tripod and keep the robot from falling over. See the Variations section for some more suggestions.
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.

Variations

  • Can you find more than one gait that makes your robot walk? Can you compare different gaits to see which is faster?
  • Can you build a bipedal robot that walks on two legs like a human?
  • Can you build a hexapod insect robot that walks on six legs? Try programming the robot to walk with an "alternating tripod" gait, where three legs (the front and back legs on one side, and the center leg on the opposite side) are always on the ground at any given time. This can help keep the robot stable. There are many examples of Arduino hexapod robots online.
  • Can you use laser-cut or 3D-printed parts to make a sturdier robot?
  • Can you use larger, more powerful servos to better support the robot's weight?
  • Can you build a robot that can walk over obstacles or uneven ground?
  • Can you build a robot that walks using only mechanical timing and no Arduino? Check out our Build a Simple Walking Robot project.

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
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
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

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 Arduino Walking Robot." Science Buddies, 5 Sep. 2023, https://www.sciencebuddies.org/science-fair-projects/project-ideas/Robotics_p058/robotics/arduino-walking-robot. Accessed 26 Sep. 2023.

APA Style

Finio, B. (2023, September 5). Build an Arduino Walking Robot. Retrieved from https://www.sciencebuddies.org/science-fair-projects/project-ideas/Robotics_p058/robotics/arduino-walking-robot


Last edit date: 2023-09-05
Top
Free science fair projects.