Build a Spinning DIY Kaleidoscope with Arduino & Servo Motor –

DIY Motorised Kaleidoscope with Arduino | Servo + LED Project for Kids | MakeMindz
🔭 Arduino · Servo Motors · RGB LEDs

Build a
Motorised
Kaleidoscope

Spin mirrors with servo motors, light them up with colour-changing LEDs, and watch your Arduino paint infinite rainbow patterns! 🌈✨

⏱️ 3–4 Hours 🔧 Medium Build 🎓 Age 11+ 💰 ~₹1,600 🌈 Optics + Art
3Mirror Panels
2Servo Motors
Patterns
RGBLED Lighting

🔬 The Science of Kaleidoscopes

A kaleidoscope creates its magical patterns through the physics of light reflection. Three mirrors are arranged in a triangle — every time light hits one mirror, it bounces into another, and that reflection bounces again, and again, creating a six-fold symmetrical pattern from just a few tiny coloured beads or shapes.

Adding a servo motor to rotate the mirror tube means the pattern keeps changing — and an RGB LED gives you infinite colour possibilities. It's where physics, art, and programming meet!

🪞 Law of Reflection

Light bounces off a mirror at exactly the same angle it arrives. Three angled mirrors create a triangle of infinite reflections.

6️⃣ 6-fold Symmetry

With mirrors at exactly 60° to each other, every object inside gets reflected 6 times, creating the classic hexagonal mandala pattern.

⚙️ Servo Rotation

One servo slowly rotates the object chamber, changing the pattern. A second servo tilts the tube to change the viewing angle.

💡 RGB Colour Mixing

Red + Green + Blue LEDs mix to make any colour. Arduino controls each channel with PWM to cycle through the full rainbow.

🌍 Real-World Connection: Kaleidoscope optics are used in real fibre optic art installations, laser light shows, and even the design of some types of camera lenses. Sir David Brewster patented the first kaleidoscope in 1816 — and it became one of the most popular toys in Victorian England!

🛒 Parts Shopping List

Everything available on Amazon India or Robu.in. Total cost around ₹1,600:

🔵
Arduino Uno R3 Controls both servos and the RGB LED — the brain of the build.
⚙️
2× SG90 Micro Servo Motors One rotates the object chamber, one tilts the viewing tube.
💡
RGB LED (Common Cathode) Provides colour-changing light inside the kaleidoscope tube.
🪞
3× Acrylic Mirror Strips (1cm × 15cm) Arranged in a triangle inside the tube — creates reflections.
🔵
Potentiometer (10kΩ) Turn to control the rotation speed of the object chamber live.
🟡
Push Button Cycles through colour modes: rainbow / red / green / blue / white.
🔩
330Ω Resistors (×3) One for each RGB LED pin (R, G, B) to protect from burnout.
🧵
Translucent Acrylic / Glass Beads The "object cell" — small coloured beads, gems, or confetti inside.
📦
Cardboard Tube (toilet roll or PVC pipe, 15cm) The outer tube body. Black inside to reduce light leakage.
🔌
Jumper Wires + Breadboard + 9V Battery For wiring the circuit together and powering the Arduino.

⚡ Circuit Diagram

A clean, compact circuit — everything plugs into one Arduino Uno:

Motorised Kaleidoscope — Wiring Diagram ARDUINO UNO 5V GND Pin 9 (Servo 1) Pin 10 (Servo 2) Pin 3 (LED Red) Pin 5 (LED Green) Pin 6 (LED Blue) A0 (Potentiometer) Pin 2 (Button) Servo 1 — SG90 Object Chamber Rotate Signal → Pin 9 Signal Servo 2 — SG90 Tube Tilt Angle Signal → Pin 10 RGB LED Common Cathode R G B 330Ω on each pin 10kΩ Pot Speed Control Knob Wiper → A0 Push Button Cycle Colour Modes Pin 2 + GND Kaleidoscope Mirror Triangle ← Servo 1 rotates this LEGEND: Servo Signal LED R/G/B Pot/Btn All GNDs share Arduino GND pin
📌 COMPLETE PIN REFERENCE — ARDUINO UNO Servo 1 — Object Chamber (SG90) ──────────────────── Red wire ──► 5V Brown wire ──► GND Orange wire ──► Pin 9 Servo 2 — Tilt Angle (SG90) ──────────────────── Red wire ──► 5V Brown wire ──► GND Orange wire ──► Pin 10 RGB LED (Common Cathode) ──────────────────── R pin → 330Ω → ──► Pin 3 // PWM G pin → 330Ω → ──► Pin 5 // PWM B pin → 330Ω → ──► Pin 6 // PWM Cathode (long leg) ──► GND Potentiometer (10kΩ) ──────────────────── Left pin ──► 5V Right pin ──► GND Wiper (middle) ──► A0 // controls speed Push Button ──────────────────── One leg ──► Pin 2 Other leg ──► GND // use INPUT_PULLUP

🔧 Step-by-Step Build Guide

Follow every step in order. The physical build and the code work together — build first, then code!

1
🪞 Build the Mirror Triangle

The heart of your kaleidoscope is three mirrors arranged in a perfect equilateral triangle:

  • Cut three acrylic mirror strips: each 1 cm wide × 12 cm long
  • Arrange them reflective-side inward into a triangular prism — tape the outside edges with black electrical tape
  • The internal angle of each mirror must be exactly 60° for 6-fold symmetry
  • Use a clear plastic endcap or thin acetate sheet at one end as the "object cell" window
  • Fill the object cell with: coloured glass beads, glitter, small gems, or cut foil pieces
  • Seal the cell end loosely — it needs to rotate but not spill
🪞 Mirror tip: Shiny side of the acrylic mirror MUST face inward — toward the centre of the triangle. If reflections look dull or incorrect, you have it backwards!
2
📦 Assemble the Tube & Servo Mounts

Build the outer body that holds everything together:

  • Outer tube: Use a 15 cm cardboard tube (paint inside flat black — absorbs stray light)
  • Slide the mirror triangle prism inside the tube snugly
  • Servo 1 (rotation): Mount at the object-cell end of the tube. Attach the servo horn to a disc that spins the object cell
  • Servo 2 (tilt): Mount on a small base bracket — the tube rests on its horn so it can tilt forward and back
  • RGB LED: Insert at the object cell end, pointing in — this lights up the beads from behind
  • Viewing eye: The open end of the tube is where you look
💡 Lighting placement: The LED should shine into the object cell, not into the mirror tube directly. Light illuminates the beads from behind, and the mirrors multiply the coloured reflections. Test this before gluing!
3
📦 Install Arduino Library

Open Arduino IDE → Sketch → Include Library → Manage Libraries:

Library Manager
// Search and install:
"Servo"    // Already built into Arduino IDE — no install needed

// That's the only library needed for this project!
// analogWrite() for RGB LED is built-in too.
4
🧠 Upload the Kaleidoscope Code

This is the complete Arduino sketch — servo sweeping, rainbow colour cycling, potentiometer speed control, and button-selectable colour modes:

kaleidoscope.ino
#include <Servo.h>

// ── Pin Definitions ────────────────────────────
#define SERVO_ROTATE_PIN  9
#define SERVO_TILT_PIN   10
#define LED_R             3   // PWM
#define LED_G             5   // PWM
#define LED_B             6   // PWM
#define POT_PIN          A0   // speed control
#define BTN_PIN           2   // colour mode button

Servo servoRotate;
Servo servoTilt;

// ── State variables ─────────────────────────────
int  colourMode   = 0;   // 0=rainbow 1=red 2=grn 3=blu 4=white
int  rotAngle     = 90;
int  rotDir       = 1;   // sweep direction
int  tiltAngle    = 80;
int  tiltDir      = 1;
int  hue          = 0;   // 0-255 for rainbow
bool lastBtn      = HIGH;
unsigned long lastBtnTime = 0;

// ── Rainbow: HSV hue (0-255) → RGB ──────────────
void hueToRGB(int h, int& r, int& g, int& b) {
  int sector = h / 43;
  int frac   = (h % 43) * 6;
  int p      = 0;
  int q      = 255 - frac;
  int t      = frac;
  switch (sector) {
    case 0: r=255; g=t;   b=p;   break;
    case 1: r=q;   g=255; b=p;   break;
    case 2: r=p;   g=255; b=t;   break;
    case 3: r=p;   g=q;   b=255; break;
    case 4: r=t;   g=p;   b=255; break;
    default: r=255; g=p;  b=q;   break;
  }
}

// ── Set LED colour ──────────────────────────────
void setColour(int r, int g, int b) {
  analogWrite(LED_R, r);
  analogWrite(LED_G, g);
  analogWrite(LED_B, b);
}

// ── Handle button press (debounced) ────────────
void checkButton() {
  bool btn = digitalRead(BTN_PIN);
  if (btn == LOW && lastBtn == HIGH && millis() - lastBtnTime > 250) {
    colourMode = (colourMode + 1) % 5;
    lastBtnTime = millis();
    Serial.print("Colour mode: "); Serial.println(colourMode);
  }
  lastBtn = btn;
}

// ── Setup ───────────────────────────────────────
void setup() {
  servoRotate.attach(SERVO_ROTATE_PIN);
  servoTilt.attach(SERVO_TILT_PIN);
  servoRotate.write(90);
  servoTilt.write(80);

  pinMode(LED_R, OUTPUT);
  pinMode(LED_G, OUTPUT);
  pinMode(LED_B, OUTPUT);
  pinMode(BTN_PIN, INPUT_PULLUP);

  Serial.begin(9600);
  Serial.println("Kaleidoscope starting! 🌈");
}

// ── Main Loop ───────────────────────────────────
void loop() {
  checkButton();

  // Read potentiometer → rotation speed (5–30ms per step)
  int potVal   = analogRead(POT_PIN);
  int stepDelay = map(potVal, 0, 1023, 5, 30);

  // ── Servo 1: sweep the rotation continuously ──
  rotAngle += rotDir;
  if (rotAngle >= 160 || rotAngle <= 20) rotDir = -rotDir;
  servoRotate.write(rotAngle);

  // ── Servo 2: slow tilt oscillation ────────────
  static unsigned long lastTilt = 0;
  if (millis() - lastTilt > 80) {
    tiltAngle += tiltDir;
    if (tiltAngle >= 110 || tiltAngle <= 60) tiltDir = -tiltDir;
    servoTilt.write(tiltAngle);
    lastTilt = millis();
  }

  // ── LED colour based on selected mode ─────────
  int r, g, b;
  switch (colourMode) {
    case 0:                          // 🌈 Rainbow
      hueToRGB(hue, r, g, b);
      setColour(r, g, b);
      hue = (hue + 2) % 256;
      break;
    case 1: setColour(255, 0,   0  ); break; // 🔴 Red
    case 2: setColour(0,   255, 0  ); break; // 🟢 Green
    case 3: setColour(0,   0,   255); break; // 🔵 Blue
    case 4: setColour(255, 255, 255); break; // ⚪ White
  }

  delay(stepDelay);
}
🎛️ Controls: Turn the potentiometer to change how fast the mirror rotates — slow for dreamy patterns, fast for a blurring effect. Press the button to cycle through Rainbow → Red → Green → Blue → White colour modes. Each gives a totally different feel!
💡 Code note: The hueToRGB() function converts a single 0–255 hue value into RGB components. As hue increases from 0 to 255, the colour travels through red → yellow → green → cyan → blue → magenta → back to red. This is the classic rainbow cycle!
5
🎨 Final Assembly & Display Stand

Put it all together and make it look beautiful:

  • Mount the Arduino and breadboard on a flat base plate (cardboard, wood, or acrylic)
  • The tilt servo sits on the base — the tube rests horizontally on its horn bracket
  • The rotation servo sits at the end of the tube, spinning the object cell cap
  • Route wires neatly along the tube with cable ties or tape
  • The potentiometer and button can be mounted on a small control panel in front
  • Decorate the tube with coloured tape, paint, or wrap it in prismatic foil paper
👁️ Viewing tip: Look through the open end in a dimly lit room for the best effect. The darker the room, the more vivid the internal LED colours appear. Try pointing the tube toward a lamp behind you for extra brightness!

🛠️ Troubleshooting Guide

Patterns not magical enough? Here's how to fix the most common issues:

🔴 Problem🟡 Likely Cause✅ Fix
No pattern visible — just dark LED facing wrong direction or missing Confirm RGB LED points INTO the object cell from behind. Check GND is connected to LED cathode
Only one colour on LED 330Ω resistors missing on some channels Each of R, G, B pins needs its own 330Ω resistor. Missing resistors can short the channel
Pattern has no symmetry (just blobs) Mirror angles not exactly 60° Remake the mirror triangle more carefully — all three 60° angles. Use a protractor to check
Servo jerks instead of sweeps smoothly Delay too short OR potentiometer reads 0 Set potentiometer to mid-position. In code, ensure stepDelay minimum is at least 5ms
Button does nothing INPUT_PULLUP not working / wiring reversed Button must connect pin to GND (not 5V). Confirm one leg to Pin 2, other leg to GND
Servos jitter when LED is on Power supply insufficient Both servos + RGB LED from Arduino 5V can strain the supply. Reduce to one servo or use external 5V
Reflection looks dim Stray light entering tube sides Paint or tape the inside of the outer tube completely flat black — this makes reflections vivid

🚀 Level Up Your Kaleidoscope!

Once your motorised kaleidoscope is working, try these stunning enhancements:

🎵 Music Reactive

Add a microphone module — colours and speed respond to music playing nearby!

📱 Bluetooth Control

Add HC-05 module — choose colours and speed from a phone app over Bluetooth!

📷 Camera Mount

Fix a phone camera at the eyepiece and record the patterns — instant mesmerising videos!

💎 Crystal Object Cell

Replace beads with a real crystal or prism inside — creates sharp spectral light patterns!

NeoPixel Ring

Replace the single RGB LED with a 12-pixel NeoPixel ring for much brighter, richer colour mixing!

🌀 Stepper Motor

Upgrade to a stepper motor for precise rotation speeds — program exact pattern cycles!


❓ Frequently Asked Questions

Why do mirrors at exactly 60° create a 6-fold pattern?

When two mirrors face each other at 60°, each reflects the other's reflection. At exactly 60°, you get exactly 6 copies of the original object arranged in a perfect hexagon — because 360° ÷ 60° = 6. At 45° you'd see 8 copies, at 90° you'd see 4. The 60° angle produces the classic hexagonal kaleidoscope pattern!

Can I use normal flat mirror glass instead of acrylic mirror?

Yes! Regular mirror glass works beautifully — often better than acrylic because it's perfectly flat. However, glass is harder to cut safely. Ask an adult to score and snap it, or use a glass cutter. Wrap the edges with electrical tape so you don't cut your fingers.

What is the hueToRGB() function doing exactly?

It converts a single "hue" value (0–255) into three separate brightness values for Red, Green, and Blue. Imagine a colour wheel — as the hue number increases, you travel around the wheel: red → orange → yellow → green → cyan → blue → purple → back to red. By slowly increasing the hue in the loop, we create a smooth rainbow animation!

Why does the pattern look different at different speeds?

At slow speeds you can see individual object positions clearly reflected in geometric arrangements. At fast speeds the objects blur into smooth colour gradients and the reflections merge into flowing abstract patterns. Both are beautiful — experiment to find your favourite speed!

Is this good for a science fair project?

Excellent choice — it sits right at the intersection of physics (optics, reflection), engineering (servo control, circuit design), and art (colour mixing, pattern). For a truly impressive exhibit, prepare an experiment comparing patterns with 3 mirrors vs 4 mirrors vs 6 mirrors — and measure how the number of reflections changes with the mirror angle.

Can I put water or liquid in the object cell?

Yes — a sealed transparent tube filled with coloured water, baby oil, or glycerine with glitter creates an amazing "liquid" kaleidoscope effect. Make sure the cell is completely sealed before letting it rotate, or it will leak. Silicone glue around the cap edges works well!

Where light, mirrors, and code become art.

#ArduinoKaleidoscope #MotorizedKaleidoscope #RGBLEDProject #ServoMotorArduino #STEMOptics #KidsRobotics #MakeMindz #DIYKaleidoscope #ArduinoForKids #ScienceAndArt

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