Automatic Curtain Controller for Kids: Build a Sunlight Robot! | Easy Arduino Robotics Project

Automatic Curtain Controller for Kids: Build a Sunlight Robot! | Easy Arduino Robotics Project
☀️ STEM PROJECT #07 — BEGINNER FRIENDLY · AGES 8 AND UP · BUILD TIME: ~1 HOUR
🤖 Robotics for Kids

Build a Curtain Robot That Wakes Up With the Sun!

An easy, step-by-step Arduino robotics project: a smart curtain that opens by itself when sunlight hits its sensor — no alarm clock needed!

🔋 1 Arduino board 🧠 Beginner code ⏱️ 45–60 min build 👨‍👩‍👧 Adult helper recommended

Tap the buttons above to see exactly what our robot will do!

What is an Automatic Curtain Controller?

It's a tiny robot brain that watches the sunlight outside your window. When it gets bright enough, it spins a little motor that gently pulls your curtains open — completely on its own!

👁️

It "sees" light

A part called an LDR sensor acts like a robot eyeball that can tell if a room is dark or bright.

🧠

It "thinks"

An Arduino board reads the sensor and decides: should the curtain open, or stay closed?

💪

It "acts"

A servo motor turns and pulls a string attached to the curtain, just like a tiny robot arm!

🔄 The Robot's Thinking Loop

☀️ Light hits sensor
🧠 Arduino checks brightness
⚙️ Servo motor turns
🪟 Curtain opens!

What You'll Need 🧰

Ask a grown-up to help you find these. Most come in a basic Arduino starter kit!

PartQtyWhat it does
Arduino Uno board× 1The robot's brain
LDR (light sensor)× 1The robot's eye
10kΩ resistor× 1Protects the sensor circuit
SG90 micro servo motor× 1Pulls the curtain string
Breadboard× 1Holds everything together
Jumper wires× 8–10Tiny wire connectors
USB cable× 1Powers the Arduino + sends code
String + small craft hook× 1 setConnects servo arm to curtain
🛡️
Safety first! Always build circuits with the USB cable unplugged. Ask a parent or teacher to check your wiring before you plug it in. Never use a wall power adapter for this project — USB power from a computer is enough and is much safer.

Circuit Diagram 🔌

Here's exactly how to connect everything. Follow the colored wires carefully!

ARDUINO UNO USB to computer 5V GND A0 (sensor) PIN 9 (servo) BREADBOARD LDR (eye) 10kΩ resistor SERVO MOTOR (arm pulls curtain string) GND rail (shared ground)
Yellow wire — 5V power to sensor
Red wire — Ground (GND)
Mint wire — Sensor signal → A0
Pink wire — Servo signal → Pin 9
Why the resistor? The 10kΩ resistor and LDR work as a team called a "voltage divider." It stops too much electricity from confusing the sensor — kind of like sunglasses that protect your eyes!

Step-by-Step Instructions 🪜

1

Place the LDR on the breadboard

Push the two legs of the LDR sensor into two different breadboard rows so they don't touch each other.

Tip: It doesn't matter which leg goes where — the LDR works the same in both directions!
2

Add the resistor

Connect the 10kΩ resistor from one leg of the LDR down to the ground rail on the breadboard.

3

Wire power and ground

Run a wire from Arduino's 5V pin to the top of the LDR. Run another wire from Arduino's GND pin to the breadboard's ground rail.

4

Connect the sensor signal

Wire the point between the LDR and resistor to Arduino's A0 pin. This is how the Arduino "reads" the brightness level.

5

Attach the servo motor

Connect the servo's red wire to 5V, brown/black wire to GND, and orange/yellow signal wire to Pin 9.

6

Build the curtain arm

Tie a piece of string from the servo's plastic arm to your curtain (or a model curtain on a small frame for testing). When the servo spins, the string should pull the curtain sideways.

7

Upload the code

Plug in the USB cable, open the Arduino IDE, paste in the code below, and click Upload. Watch the little LED blink while it sends the program!

8

Test it!

Cover the LDR with your hand (night) then shine a flashlight on it (day). Your curtain robot should react within a second or two. 🎉

Arduino Code 💻

Copy this code into the Arduino IDE. Don't worry about understanding every line right away — just try it, then come back and explore!

curtain_controller.ino
// 🌞 Automatic Curtain Controller
// Opens the curtain when it gets bright, closes it when dark

#include <Servo.h>

Servo curtainServo;              // create our servo "arm"

const int lightSensorPin = A0;   // the robot's eye
const int brightnessLimit = 500; // try 300-700, test your room!

int currentAngle = 0;          // 0 = curtain closed

void setup() {
  curtainServo.attach(9);       // servo signal wire on pin 9
  curtainServo.write(currentAngle);
  Serial.begin(9600);      // lets us peek at sensor readings
}

void loop() {
  int lightLevel = analogRead(lightSensorPin);
  Serial.print("Light level: ");
  Serial.println(lightLevel);

  if (lightLevel > brightnessLimit && currentAngle == 0) {
    // it's bright! open the curtain
    curtainServo.write(90);
    currentAngle = 90;
  }
  else if (lightLevel <= brightnessLimit && currentAngle == 90) {
    // it's dark! close the curtain
    curtainServo.write(0);
    currentAngle = 0;
  }

  delay(500); // check brightness twice a second
}
Try this: Open the Serial Monitor (magnifying glass icon, top right of the Arduino IDE) to watch the live light numbers. Find the number for "bright" and "dark" in your room, then set brightnessLimit right in between!

Troubleshooting Guide 🔍

My curtain doesn't move at all
Check that the servo's orange signal wire is on Pin 9, and that the red wire is connected to 5V (not GND by mistake). Also double check the code uploaded without any red error messages.
The curtain moves the wrong direction
Swap the 90 and 0 values in the code, or simply re-attach the servo's plastic arm pointing the opposite way.
It reacts even when the room looks the same brightness
Your brightnessLimit number probably needs adjusting. Use the Serial Monitor to find better day vs. night numbers for your specific room.
The servo jitters or moves randomly
This usually means a loose wire. Re-check every connection on the breadboard, and make sure the servo is getting steady 5V power.

Cool Ways to Upgrade Your Robot 🚀

⏰ Add a clock

Use an RTC module so the curtain only opens after 7 AM, even on cloudy days.

📱 Add Bluetooth

Control your curtain from your phone using an HC-05 Bluetooth module.

🔔 Add a buzzer

Make it play a cheerful sound every time the curtain opens for school!

Test Your Robotics Brain 🧠

Which part of our robot acts like its "eye"?

Servo motor
LDR sensor
USB cable
Breadboard

Frequently Asked Questions

What age is this robotics project good for?

This project works well for kids around age 8 and up, with an adult or older sibling helping with wiring and the craft parts of the build.

Do I need to know how to code already?

No! The full code is provided above. Beginners can copy and upload it directly, then experiment with changing numbers to learn how it works.

Can I use this on a real window curtain?

Small light curtains can work, but for heavier curtains you'll want a stronger gear motor instead of a micro servo. Start with a model curtain to learn the concept safely.

What is an LDR sensor?

LDR stands for Light Dependent Resistor. It changes how much electricity flows through it depending on how much light hits it, which is what lets Arduino "see" brightness.

🌞 Sunlight Robots Club
Made for curious young makers everywhere. Always build with an adult helper nearby.

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