DIY Shape-Shifting Cube Robot

DIY Shape-Shifting Cube Robot | Fun Arduino Robotics Project for Kids
🧩 Kid-friendly robotics build

The Shape-Shifting Cube Robot

It sits on your shelf looking like an ordinary cube. Press one button, and it unfolds and spins itself into a sphere, a flower, or a star. This guide shows you how to build the whole thing yourself with an Arduino, four small servo motors, and things from a craft store.

Age10 and up
Build time3–4 hours
DifficultyIntermediate
Cost$20–30

Now showing: Cube

Why build this

A cube that isn't just a cube

This shape-shifting cube robot is one of the most rewarding DIY robotics projects you can build with basic Arduino parts. It hides four small servo motors inside a folding cube shell. When you press the button, the servos pull hinged panels open in a set pattern, so the same cube can "become" a round sphere, a four-petal flower, or a spiky star. It's a great hands-on way for kids and beginner makers to learn about servo motors, circuits, hinges, and simple robot code — while ending up with a toy that's genuinely fun to show off.

Shopping list

What you'll need

Everything here is beginner-friendly and easy to find online or at a craft/electronics store.

Electronics

  • 1x Arduino Uno or Nano
  • 4x SG90 micro servo motors
  • 1x momentary push button
  • 1x external 5–6V power supply (4xAA battery pack works great)
  • Breadboard and jumper wires
  • USB cable for programming

Cube structure

  • Foam board or thin plywood (for 6 cube panels)
  • Fabric hinge tape or duct tape
  • Small cardboard box (the center hub)
  • Thin string or fishing line
  • Craft sticks (for servo arms/links)

Tools

  • Craft knife and ruler
  • Hot glue gun
  • Scissors
  • Small screwdriver
  • Pencil for marking
The concept

How it actually transforms

The trick isn't magic — it's four hinged panels, each pulled by its own servo motor arm. Change how far and in which direction each arm swings, and the same cube folds into a different silhouette.

Center hub 4 servos inside Panel A Panel B Panel C Panel D
1

Cube (closed)

All four servo arms sit at 0°, holding every panel flat against the hub. It just looks like a plain box.

2

Sphere

All four arms swing out to the same medium angle, so the panels curl outward evenly in every direction.

3

Flower

Opposite arms open wider than the side arms, so panels spread out flat like four petals around a center.

4

Star

Arms alternate between a wide angle and a narrow angle, pushing panels in and out to make sharp points.

Kid-friendly tip: Before wiring anything, practice with just paper and your hands — fold a paper cube template and see how the same four flaps can make a round shape, a flower shape, and a star shape. It makes the robot part click into place much faster.
Wiring

Circuit diagram

Four servos draw more current than the Arduino's own 5V pin can safely supply, so we power them from a separate battery pack and share a common ground with the Arduino.

Arduino Uno Pins 3, 5, 6, 9, 2, GND Servo A (pin 3) Servo B (pin 5) Servo C (pin 6) Servo D (pin 9) Push button (pin 2) Battery pack 5-6V
Servo signal wire → Arduino digital pin Button → digital pin 2 (uses internal pull-up) Servo power → external battery pack
Important: Connect the battery pack's negative wire to the Arduino's GND pin too, so both power sources share the same ground reference. Without this, the servos won't respond correctly.
Assembly

Step-by-step build instructions

Work through these steps in order. Have an adult help with the craft knife and hot glue.

1

Cut the six cube panels

Cut six equal squares from foam board (about 8cm x 8cm is a good starter size). These will form the outer faces of your cube.

2

Hinge four of the panels

Pick four panels to be the "moving" ones. Tape one edge of each to the small cardboard hub box using fabric hinge tape, so each panel can swing open and closed freely.

3

Fix the other two panels

Glue the remaining two panels to the top and bottom of the hub so they stay still — these keep the cube's shape steady while the other four move.

4

Mount the four servos inside the hub

Glue or screw each servo motor inside the hub box, one facing each hinged panel.

5

Attach servo horns and arms

Snap a plastic servo horn onto each motor shaft, then glue a craft-stick arm onto the horn.

6

Link each arm to its panel

Tie a short piece of string or fishing line from the tip of each servo arm to the inside of its matching panel, so turning the servo pulls the panel open.

7

Wire the push button

Connect one leg of the button to Arduino pin 2, and the other leg to GND.

8

Wire the servos

Connect each servo's signal wire to pins 3, 5, 6, and 9. Connect all servo power and ground wires to the external battery pack, and tie that ground to the Arduino's GND.

9

Upload the code

Plug the Arduino into your computer and upload the sketch from the next section using the Arduino IDE.

10

Test and tune

Press the button and watch the cube move. If a panel doesn't swing far enough, adjust that servo's angle numbers in the code and re-upload.

Arduino sketch

The code

This sketch moves all four servos smoothly and cycles through four modes each time the button is pressed: Cube → Sphere → Flower → Star → back to Cube.

// Shape-Shifting Cube Robot
// Press the button to cycle: Cube -> Sphere -> Flower -> Star

#include <Servo.h>

Servo servoA, servoB, servoC, servoD;

const int pinA = 3, pinB = 5, pinC = 6, pinD = 9;
const int buttonPin = 2;

int shapeMode = 0;
int lastButtonState = HIGH;
unsigned long lastDebounce = 0;
const unsigned long debounceDelay = 50;

void setup() {
  servoA.attach(pinA);
  servoB.attach(pinB);
  servoC.attach(pinC);
  servoD.attach(pinD);
  pinMode(buttonPin, INPUT_PULLUP);
  Serial.begin(9600);
  goToCube(); // start folded up like a normal cube
}

void loop() {
  int reading = digitalRead(buttonPin);

  if (reading != lastButtonState) {
    lastDebounce = millis();
  }

  if ((millis() - lastDebounce) > debounceDelay) {
    if (reading == LOW && lastButtonState == HIGH) {
      shapeMode = (shapeMode + 1) % 4;
      changeShape(shapeMode);
    }
  }
  lastButtonState = reading;
}

void changeShape(int mode) {
  switch (mode) {
    case 0: Serial.println("Cube!");   goToCube();   break;
    case 1: Serial.println("Sphere!"); goToSphere(); break;
    case 2: Serial.println("Flower!"); goToFlower(); break;
    case 3: Serial.println("Star!");   goToStar();   break;
  }
}

// Smoothly move all four servos toward new target angles
void moveAll(int a, int b, int c, int d) {
  int startA = servoA.read();
  int startB = servoB.read();
  int startC = servoC.read();
  int startD = servoD.read();
  int steps = 40;

  for (int i = 0; i <= steps; i++) {
    servoA.write(startA + (a - startA) * i / steps);
    servoB.write(startB + (b - startB) * i / steps);
    servoC.write(startC + (c - startC) * i / steps);
    servoD.write(startD + (d - startD) * i / steps);
    delay(20);
  }
}

void goToCube()   { moveAll(0, 0, 0, 0); }       // panels folded flat
void goToSphere() { moveAll(60, 60, 60, 60); }   // panels curl out evenly
void goToFlower() { moveAll(90, 90, 45, 45); }   // panels splay like petals
void goToStar()   { moveAll(120, 30, 120, 30); }  // panels alternate in and out
Try this: The four numbers inside each goTo...() function are just servo angles from 0° to 180°. Change them and re-upload to invent your own shape — a "twist," a "wave," or your own signature pose.

⚡ Safety first

  • Ask an adult to help with cutting tools and the hot glue gun.
  • Always unplug the Arduino before changing any wiring.
  • Double-check servo wires are connected the right way round before powering on.
  • Keep fingers clear of the panels while testing a new shape for the first time.
Good to know

Frequently asked questions

Do I need to know how to code already?

No. The code provided is ready to upload as-is. As you get comfortable, you can start changing the servo angle numbers to invent new shapes without needing to learn much new code.

Can I use cardboard instead of foam board?

Yes. Cardboard works fine for a first prototype, though foam board holds its folded shape a little better over time.

Why does it need a separate battery pack for the servos?

Four servos moving at once can pull more current than the Arduino's 5V pin is designed to supply, which can cause the board to reset. A separate battery pack keeps the servos powered reliably and protects the Arduino.

Can I add more shapes?

Yes! Add a new function like goToTwist() with your own four angle values, then add another case to the changeShape() switch and update the modulo number in the main loop.

Built with Arduino, servo motors, and a lot of folding paper prototypes. Happy making!

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