0

$USD

$USD
PROJECTS IoT

Summer inspiration-DIY automatic curtain lift

DFRobot Jun 24 2012 1748

I guess many people prefer sitting by the window in the office, they can enjoy the beautiful scenery outside and pleasant sunshine during cold winter. However, they have to pull the curtain down when the light is too strong, especially in summer. So pulling up and down the curtain becomes a daily task, sometimes it is really anoying.


Barry met the same problem in our office. As a robotics engineer, he always tries to apply his knowledge in robotics to get rid of any inconvenience in his daily life. This time, he wants to build an automated curtain. In the first phase of this project, the curtain can be pulled up and down driven by a motor which is remotely controlled through IR. The motion is monitored by two IR switches and can stop when the curtain reaches the top or the bottom.

Hardware used for this project: 

List of hardware: 

1. Romeo-All in one Controller(DFR0004) 

2. IR Kit(DFR0107) 

3. Adjustable Infrared Sensor Switch (SEN0019) 

4. DC motor (12V- FIT0493FIT0277)

5. 12V power adapter

6. Servo extension cable 300mm(FIT0033) 

7. DC Barrel Jack Adapter-Male/Female(FIT0110/ FIT0151)

8. Misc. mechanical parts  


First of all, the original curtain should be modified.A gear was designed which can perfectly match the pattern of beads on the chain which moves the curtain up and down. A DC motor with speeds of 120 r/min is used to drive the gear. The drive assembly is tightly fixed to the wall.


The motor controller is a Romeo microcontroller which integrates an L298N DC motor driver. The romeo includes some on-board buttons which were used to test the function of positive and negative motor rotation. An IR remote and  receiver module were put in place to allow for remote control of the curtain.

Above is a picture of the IR sensors used to sens when the curtain reaches either end. Once the switch is triggered the motor stops moving. In the second phase of this project Barry will add a light intensity sensor to make the curtain adjust automatically to ensure its never too bright or too dim in the office.
Software: Arduino-0022 Software code:
#include <IRremote.h>

const int InfraredSensorPin1 = 7;

const int InfraredSensorPin2 =8;

int RECV_PIN = 11;

int E1 = 5;     //M1 Speed Control

int M1 = 4;    //M1 Direction Control

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()

{

pinMode(InfraredSensorPin1,INPUT);

pinMode(InfraredSensorPin2,INPUT);

pinMode(M1, OUTPUT);

pinMode(E1, OUTPUT);

Serial.begin(9600);

irrecv.enableIRIn(); // Start the receiver

}

void loop() {

if(digitalRead(InfraredSensorPin1) ==LOW&&digitalRead(InfraredSensorPin2) ==LOW)

{

digitalWrite(E1,LOW);

if(results.value==0xFD807F)

{

analogWrite (E1,255);

digitalWrite(M1,LOW);

}

delay(1000);

}

if(digitalRead(InfraredSensorPin1) ==HIGH&&digitalRead(InfraredSensorPin2) == HIGH)

{

digitalWrite(E1,LOW);

if(results.value==0xFD906F)

{

analogWrite (E1,255);

digitalWrite(M1,HIGH);

}

delay(1000);

}

if (irrecv.decode(&results))

{

Serial.println(results.value, HEX);

if(digitalRead(InfraredSensorPin1) ==LOW&&digitalRead(InfraredSensorPin2) ==HIGH)

{

if(results.value==0xFD807F)

{

analogWrite (E1,255);

digitalWrite(M1,LOW);

}

if(results.value==0xFD906F)

{

analogWrite (E1,255);

digitalWrite(M1,HIGH);

}

if(results.value==0xFDA05F)

{

digitalWrite(M1,LOW);

analogWrite (E1,0);

}

}

irrecv.resume(); // Receive the next value

}

}