OctoBot: Build an 8-Legged Robot That Climbs Stairs

OctoBot: Build an 8-Legged Robot That Climbs Stairs & Vacuums! | DIY Kids Robotics
Kid-Friendly STEM Project 🧠⚡

Build OctoBot — the 8‑legged robot that vacuums and climbs stairs!

Most robot vacuums roll around on wheels and get stuck at the bottom of every staircase. OctoBot doesn't — it walks on eight bendy legs, so it can climb right up and keep cleaning. Here's exactly how to build one, with the full circuit and code, in steps easy enough for a young maker with a grown-up helper.

1

Why 8 legs beat wheels

A wheeled robot vacuum can only roll on flat floors. The moment it meets a step, it either falls, gets stuck, or just gives up. Legs solve this because each one can lift, reach, and grip a new surface on its own.

Stair climbing

Legs lift over edges

Each leg can rise higher than a wheel ever could, so OctoBot steps up onto a stair instead of bumping into it.

Steady balance

8 legs = always stable

With eight legs, at least four stay planted on the ground at all times, like a table that never wobbles.

Real cleaning

A spinning brush + suction fan

While it walks, a small motor spins a brush and fan underneath to sweep dust into a little collection bin.

2

What you'll need

Everything here is beginner-friendly and available from hobby electronics stores. Ask a grown-up to help you order the parts.

Brain

Arduino Uno or Nano

The microcontroller that runs your code and controls every motor.

Legs

8× SG90 micro servo motors

One servo per leg, so each leg can swing up, forward, and down.

Power

2× 18650 batteries + holder

Gives about 7.4V — enough for the servos and vacuum motor together.

Driver

L298N motor driver board

Lets the Arduino safely control the stronger vacuum motor.

Vacuum

Small 6V DC motor + mini fan/brush

Creates suction and sweeps dust into a small bin underneath.

Senses

HC-SR04 ultrasonic sensor

"Looks" ahead so OctoBot can find stair edges and avoid falling backward.

Wiring

Breadboard + jumper wires

Connects everything together without soldering.

Body

Cardboard or 3D-printed chassis

A light, oval body to mount the servos, motor, and electronics.

🛡️ Adult helper zone: Always build and test with a grown-up nearby, especially when connecting batteries or using a hobby knife/hot glue gun.
3

How the circuit works

Think of it as three teams reporting to one manager: the Arduino (manager) tells the 8 leg servos when to move, tells the motor driver when to spin the vacuum motor, and listens to the ultrasonic sensor for stair edges.

// OctoBot wiring map
   [ 2x 18650 Battery Pack, 7.4V ]
          |            |
          |            +------------------> L298N (+12V in) --> Vacuum Motor
          |
          +--> 5V Regulator --> Arduino 5V pin
                                   |
   Arduino Uno / Nano  ------------+
     D2  -> Leg Servo 1  (front-left)
     D3  -> Leg Servo 2  (front-right)
     D4  -> Leg Servo 3  (mid-left-1)
     D5  -> Leg Servo 4  (mid-right-1)
     D6  -> Leg Servo 5  (mid-left-2)
     D7  -> Leg Servo 6  (mid-right-2)
     D8  -> Leg Servo 7  (back-left)
     D9  -> Leg Servo 8  (back-right)
     D10 -> L298N IN1  (vacuum motor ON/OFF)
     D11 -> Ultrasonic TRIG
     D12 -> Ultrasonic ECHO
     GND -> shared with battery GND + L298N GND
🔋 Battery = muscle power 🧠 Arduino = the brain 🦿 Servos = the legs 🌀 Motor + driver = the vacuum 📡 Ultrasonic = the eyes
⚠️
Keep power separate: the vacuum motor pulls much more current than the servos. Powering it through the L298N (not directly from the Arduino) protects your Arduino from damage.
4

Step-by-step build

Work through these steps in order. Each one builds on the last, so don't skip ahead.

Cut and shape the body

Cut an oval chassis from stiff cardboard (or 3D print one). Mark 8 evenly spaced mounting points around the edge — 4 per side — for the leg servos.

Mount the 8 leg servos

Glue or screw each SG90 servo into its mounting point, horn facing outward. Attach a simple L-shaped leg arm to each servo horn.

Add the vacuum unit underneath

Mount the small DC motor with its fan/brush attachment in the center-bottom of the chassis, right above a small dustbin tray.

Wire the servos to the Arduino

Connect each servo's signal wire to pins D2–D9 as shown in the circuit map. Connect all servo power/ground lines to the shared battery rail.

Wire the motor driver and vacuum motor

Connect the L298N to the battery, the vacuum motor, and Arduino pin D10, following the circuit diagram above.

Add the ultrasonic "eyes"

Mount the HC-SR04 facing forward and slightly downward at the front of the chassis, then wire TRIG and ECHO to D11 and D12.

Upload the code

Plug the Arduino into a computer, open the Arduino IDE, paste in the OctoBot sketch below, and click Upload.

Test on flat ground first

Place OctoBot on a flat floor before trying stairs. Watch its walking gait, and only move to a real staircase once it walks smoothly.

5

The Arduino code

This sketch moves OctoBot's 8 legs in an alternating "tripod-style" gait (like a real ant or spider), runs the vacuum motor while walking, and uses the ultrasonic sensor to detect a stair edge so it lifts its front legs higher to climb.

octobot.ino
// OctoBot — 8-legged stair-climbing vacuum robot
// Beginner-friendly Arduino sketch

#include <Servo.h>

Servo legs[8];
const int legPins[8] = {2,3,4,5,6,7,8,9};

const int vacuumPin = 10;
const int trigPin   = 11;
const int echoPin   = 12;

const int STAND = 90;   // neutral leg angle
const int LIFT  = 50;   // lifted leg angle
const int STEP  = 120;  // forward reach angle

void setup() {
  for (int i = 0; i < 8; i++) {
    legs[i].attach(legPins[i]);
    legs[i].write(STAND);
  }
  pinMode(vacuumPin, OUTPUT);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  digitalWrite(vacuumPin, HIGH); // vacuum runs while OctoBot moves
}

long readDistanceCM() {
  digitalWrite(trigPin, LOW);  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH); delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  long duration = pulseIn(echoPin, HIGH, 20000);
  return duration * 0.034 / 2;
}

// Tripod gait: legs 0,3,5,6 move together, then 1,2,4,7
void walkStep(bool climbing) {
  int liftAngle = climbing ? LIFT - 20 : LIFT; // lift extra high on stairs
  int groupA[] = {0,3,5,6};
  int groupB[] = {1,2,4,7};

  for (int i = 0; i < 4; i++) legs[groupA[i]].write(liftAngle);
  delay(150);
  for (int i = 0; i < 4; i++) legs[groupA[i]].write(STEP);
  for (int i = 0; i < 4; i++) legs[groupB[i]].write(liftAngle);
  delay(150);

  for (int i = 0; i < 4; i++) legs[groupA[i]].write(STAND);
  for (int i = 0; i < 4; i++) legs[groupB[i]].write(STEP);
  delay(150);
  for (int i = 0; i < 4; i++) legs[groupB[i]].write(STAND);
  delay(150);
}

void loop() {
  long distance = readDistanceCM();

  // A stair edge shows up as a sudden jump in distance
  bool stairDetected = (distance > 15 && distance < 40);

  walkStep(stairDetected);
}
🧩
Make it your own: try changing STAND, LIFT, and STEP to see how the walking style changes, or add a button to turn the vacuum motor on and off separately from walking.
6

Frequently asked questions

Is this project safe for kids to build?

Yes, with a grown-up helping — especially for cutting the chassis, gluing parts, and connecting the battery. The voltages involved (under 8V) are low, but adult supervision is still recommended.

Do I need to know how to code already?

No. The sketch above is ready to upload as-is. Learning happens by changing small numbers (like the angles) and watching what happens — that's how real engineers experiment too.

Why 8 legs instead of 6?

Six legs (a "hexapod") is a classic beginner design, but 8 legs give OctoBot extra stability and stronger grip on stair edges, similar to how a real octopus or spider distributes its weight.

Can it actually replace a store-bought robot vacuum?

Not quite — store-bought vacuums are more powerful and polished. OctoBot is a learning project designed to teach robotics, electronics, and code through a fun, hands-on build.

Built for curious young makers 🛠️ — always build with a grown-up, and have fun experimenting!

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
Young inventors love it!
🖨️
3D Print
All parts
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course