Bekir Bilge
Published © CC BY

Auto Day/Night Window Blind

With this project, I made an auto turn on or off blind mechanism to my triangle window with the light sensor.

IntermediateProtip9,376
Auto Day/Night Window Blind

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Arduino Nano Sensor Shield
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
LDR, 5 Mohm
LDR, 5 Mohm
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Story

Read more

Schematics

Automatic Window Blind

Code

Automatic Window Blind

Arduino
#include <Servo.h>
Servo myservo1,myservo2;  // create servo objects to control a servos

int potpin = A0;  // analog pin used to connect the LDR
int val;    // variable to read the value from the analog pin

void setup() {
myservo1.attach(6);  // attaches the servo on pin 6-9 to the servos object
myservo2.attach(9);
Serial.begin(9600);
delay(100);//
}

void loop() {
  val = analogRead(potpin);            // reads the value of the LDR (value between 0 and 1023)
  if (val > 750){      // meausure it to sense day or night
  myservo1.write(90); // sets the servo blind opened position 
  myservo2.write(90);// sets the servo  blind opened position 
  Serial.println("Opened");
  Serial.println(val);
  }
  else{
  myservo1.write(0);  // sets the servo blind closed position 
  myservo2.write(180); // sets the servo blind closed position 
  Serial.println("Closed");
  Serial.println(val);
  }
  delay(2000);  // waits for 2 seconds. If it is opened or closed you can cut off power
}

Credits

Bekir Bilge
1 project • 3 followers
Contact

Comments

Please log in or sign up to comment.