Introduction: Light Reactive Curtain

About: I'm just a lady who likes making stuff. I got my degree in engineering but also enjoy cooking, sewing, knitting, gardening and backpacking, among other things.

For the last project of the semester in my  Craft and Computing class, we had to make a family of items that fulfilled some need that people have.  My team partner and I are all about self expression and so we decided we wanted to make something artistic to help people express themselves in some way.  Since we live in dorms, we are not allowed to do very many things to our rooms as far as decorating and painting and things, so we decided to make some cool things people could use in their dorms.

One of those things was a light reactive curtain for a window.  When the curtain senses that there is light outside, the servo pulls the curtain up to let more light into the room and it closes when it is dark outside.

Materials:

-Fabric
-Arduino Uno
-Curtatin rod
-Wire (and spool)
-Foam core
-Zipties
-Hot glue

Step 1: Sew the Curtain

First, we sewed the curtain.  You can really make your curtain any kind you want.  We found some pretty, sheer, sparkly, green fabric, which was awesome, but we also wanted the curtain to not be see through so we added a layer of black fabric to the back.  
I sewed the short edges of both fabrics together and hemmed the other sides so there would be no loose threads.  I then sewed a channel at the top for a curtain rod to go through.  Finally, I sewed two seams down the center of the curtain about half an inch apart for a cord to go through and pull the curtain open.

Step 2: Mechanism

To open and close the curtain, we ran a wire through the channel in the center of the curtain and attached a Popsicle stick to the bottom so that the wire wouldn't be pulled out.  We opted for a a wire instead of a string or cord because the wire is smooth and therefore able to gather the curtain up with minimal friction.

We hacked a servo so that it was able to rotate completely, made a box out of foam core to house our electronics, and made a hole in one side so that most of the servo was inside the box with just the part that rotates sticking out.  We attached a spool to wind the wire onto the servo, then attached the whole box to the hanger that we used to demonstrate our curtain.

Step 3: Circuit

We used an Arduino Uno to control our sensor and servo. The circuit and circuit are shown below. You will have to adjust the delay in the code based on your servo and the length of your curtain, and the light threshold based on your location.

#include <Servo.h>

Servo myservo; // create servo object to control a servo

int lightPin = 0; // analog pin used to connect the photoresistor
int ledPin = 11; //analog pin to connect to LED


void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
pinMode(ledPin, OUTPUT); //sets the led pin to output
Serial.begin(9600);
}

void loop()
{
int threshold = 400; //400 for classroom, 100 for bedroom/dorm
int lightLevel = analogRead(lightPin);
Serial.println(lightLevel);

if (lightLevel>threshold){ //if it sees light (light=high resistance, dark = low resistance)
myservo.write(180);//forward
//digitalWrite(ledPin, HIGH);
delay (5000); //spin servo for 5 sec
while (analogRead(lightPin)>threshold){ //while light is still above threshold
// digitalWrite(ledPin, LOW);
myservo.write(87); //do nothing (no movement)
delay(10);
}

}else{ //if it sees no light
myservo.write(0); //reverse
// digitalWrite(ledPin, HIGH);
delay (5000);//spin servo for 5 sec
while (analogRead(lightPin)<threshold){ //while light is still below threshold
//digitalWrite(ledPin, LOW);
myservo.write(87); //do nothing (no movement)
delay(10);
}
}
}


Step 4: Awesome Curtain

Our curtain ended up working remarkably well!  One problem is that the code has to be re calibrated if you move the curtain into different lighting conditions, but if this were to just be hanging in a window as an actual curtain, that would not be a problem.
Video coming soon!