Description
I made 2 automatic curtains with--
a DC motor,
a rope,
an empty yogurt bottle,
a round piece of paperboard,
a curtain,
the Arduino board, bread board, batteries and resistors,
a force sensor/a photocell.
To illustrate stepping on the sensor, here I use a slipper instead of a rug in this picture
Automatic Curtain 1--
Every time when I want to stand at my French door to look out through it, or when I want to open the door to go to my little patio, I'll have to step on the mat in front of the door.
In this case, I put the force sensor under the mat in front of my door. When I step on the mat, the curtain will be automatically drawn open.
Automatic Curtain 2--
I put my bed beside the window. Everyday in the morning I hope my curtain will open by itself so that the sunlight will wake me up. After I open my eyes on the bed, the first sight will be the beautiful sky!!
In this case, I use the photocell instead of the force sensor. Putting the entire set by my window, the photocell can detect sunlight and control the curtain.
My Code
/*
* one pot fades one motor
* modified version of AnalogInput
* by DojoDave <http://www.0j0.org>
* http://www.arduino.cc/en/Tutorial/AnalogInput
* Modified again by dave and again by Aithne Sheng-Ying Pao
*/
int controlPin = 0; // select the input pin for the photocell or the force sensor
int motorPin = 9; // select the pin for the Motor
int val = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(controlPin); // read the value from the sensor, between 0 - 1024
Serial.println(val);
analogWrite(motorPin, val/4); // analogWrite can be between 0-255
}
My Video
To illustrate stepping on the sensor, here I use a slipper instead of a mat in this picture
Comments
Comments from TAs
Cool project. I'm impressed that you were able to get the small motor to actually open your curtains! And, I like the idea. Looking at your code, it seems like it would work well for the FSR case but probably not well for the photocell case, since the motor would keep running as long as it was sunny outside! It would be interesting to make the curtain open automatically in the morning and then to close automatically in the evening. I guess you could time how long it takes to open or close and then set the motor to run for the appropriate amount of time once the sensor goes above or below a certain level.