Skip to content

Arduino Blinds Control Project

Build an automated light-responsive blind control system using Arduino, a photocell sensor, and a servo motor.

  • Arduino
  • Beginner
  • 45–60 minutes
  • 3 steps

Shop this project

Cart

Prices from vilros.com. Tax and shipping at checkout.

Before you start, you'll need

  • Arduino Uno
  • Breadboard
  • 7 jumper wires
  • 10 kΩ resistor
  • Photocell (light-dependent resistor)
  • Positional servo motor

Wire the circuit

About 10 minutes

Connect the photocell sensor and servo to your Arduino.

  1. Connect a jumper wire from the 5V pin on the Arduino to a + rail on the breadboard.
  2. Connect a jumper wire from a GND pin on the Arduino to the - rail next to the + rail.
  3. Place the 10 kΩ resistor on the breadboard with one leg connected to the - rail.
  4. Place the photocell on the breadboard with one leg connected to the resistor.
  5. Connect a jumper from the + rail to the other leg of the photocell.
  6. Connect a jumper from analog pin 0 to the leg of the photocell connected to the resistor.
  7. Place the servo connector pins on the breadboard.
  8. Connect the servo's red wire to the + rail (5V).
  9. Connect the servo's black wire to the - rail (GND).
  10. Connect digital pin 3 to the servo's signal wire (yellow or white).

You should see

All components are connected and the circuit matches the wiring diagram.

Upload the control sketch

About 25 minutes

Program the Arduino to read light levels and adjust the servo.

  1. Open Arduino IDE and create a new sketch.
  2. Copy the complete sketch into your IDE.
  3. Adjust the upper and lower light limits based on your room's lighting (mine were 300 and 95).
  4. Connect your Arduino via USB and select the correct board and port under Tools.
  5. Click Upload to send the sketch to your Arduino.
cpp
#include <Servo.h>

Servo myServo;
int photoPin = 0;
int lightValue = 0;
int upperLimit = 300;
int lowerLimit = 95;
int maxPos = 180;
int minPos = 0;
int halfPos = 90;
int currentPos = 0;

void setup() {
  myServo.attach(3);
  myServo.write(halfPos);
  currentPos = halfPos;
  Serial.begin(9600);
}

void loop() {
  lightValue = analogRead(photoPin);
  
  if (lightValue >= lowerLimit && lightValue <= upperLimit) {
    // Do nothing, light is acceptable
  } else if (lightValue > upperLimit) {
    decLight();
  } else if (lightValue < lowerLimit) {
    incLight();
  }
  
  Serial.println(lightValue);
  delay(100);
}

void decLight() {
  if (currentPos - 10 >= minPos) {
    currentPos -= 10;
    myServo.write(currentPos);
  }
}

void incLight() {
  if (currentPos + 10 <= maxPos) {
    currentPos += 10;
    myServo.write(currentPos);
  }
}

Adjust upperLimit and lowerLimit values to match your room's lighting conditions.

You should see

The sketch uploads successfully without errors.

It didn't work
  • Compilation error about Servo library.

    The Servo library is built into Arduino IDE. Make sure you've selected Arduino Uno under Tools → Board.

Test the blind control

About 10 minutes

Verify the servo responds to light changes.

  1. Open the Serial Monitor (Tools → Serial Monitor) and set it to 9600 baud.
  2. Watch the light value readings in the Serial Monitor.
  3. Cover the photocell with your hand to simulate darkness—the servo should rotate to open the blinds (increase light).
  4. Shine a flashlight on the photocell—the servo should rotate the opposite direction to close the blinds (decrease light).
  5. If the servo doesn't move enough, adjust the upperLimit and lowerLimit values in the sketch and re-upload.

You should see

The servo rotates in response to light level changes, increasing light when it's too dark and decreasing light when it's too bright.

It didn't work
  • Servo doesn't move at all.

    Check the servo wiring (red to 5V, black to GND, signal to pin 3). Verify the servo is receiving power. Try a different servo if available.

  • Light values in Serial Monitor don't change much.

    The photocell may not be wired correctly. Check that one leg connects to 5V through the breadboard + rail, and the other connects to the 10 kΩ resistor and analog pin 0.

What to do next

Stuck? Contact Vilros Support with your board model and what you see on screen.