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!
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
What You'll Need 🧰
Ask a grown-up to help you find these. Most come in a basic Arduino starter kit!
| Part | Qty | What it does |
|---|---|---|
| Arduino Uno board | × 1 | The robot's brain |
| LDR (light sensor) | × 1 | The robot's eye |
| 10kΩ resistor | × 1 | Protects the sensor circuit |
| SG90 micro servo motor | × 1 | Pulls the curtain string |
| Breadboard | × 1 | Holds everything together |
| Jumper wires | × 8–10 | Tiny wire connectors |
| USB cable | × 1 | Powers the Arduino + sends code |
| String + small craft hook | × 1 set | Connects servo arm to curtain |
Circuit Diagram 🔌
Here's exactly how to connect everything. Follow the colored wires carefully!
Step-by-Step Instructions 🪜
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.
Add the resistor
Connect the 10kΩ resistor from one leg of the LDR down to the ground rail on the breadboard.
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.
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.
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.
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.
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!
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!
// 🌞 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 }
brightnessLimit right in between!
Troubleshooting Guide 🔍
My curtain doesn't move at all
The curtain moves the wrong direction
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
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
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"?
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.

Comments
Post a Comment