Jump to content

[Tutorial] Autonomous arduino curtains on a budget

PCowner145

So, you've probably seen curtains that open themselves without you having to get out of bed and doing it yourself and you probably thought it was some luxury item that would set you back hundreds of dollars, so i am here to show you how to make your own motorized remote controlled curtains/blinds for under 100 USD

 

Lets get started. 

 

Video version of this tutorial: 

 

PARTS REQUIRED:

PRINCIPLE OF THE DEVICE: 

The main principle of this device is to have two servos controlled by a remote reel in a string tied to opposite side of each curtain 

Note: While there is currently no way to close the curtains fully autonomous there is a reverse function that will unreel the string and allow you to close the curtains or just take the spool off the servo and untie it by hand (i plan to add a way to close fully autonomous in the future)

 

STEP 1:

Plug IR receiver into your breadboard and connect it to your arduino like so:

Signal pin (receiver) - Digital pin 2 (arduino)

Pover pin (receiver) - 5V pin (arduino)

- or GND pin (receiver) - GND pin (arduino)

 

STEP 2:

Plug in servos to a power source and into arduino:

I used a stripped down usb wire and a 5a adapter

Power pins + and - (servo 1 and 2) - matching lines on your breadboard

Signal pin (servo 1 and 2) - Pins 9 and 10 (arduino)

then using a jumper plug the line you used for negative (-) on your breadboard into GND pin on arduino

 

STEP 3:

Flash your arduino using this code:

//Copy IRremote to library folder
//To find the key codes for your remote control, upload this code to your Arduino and open the serial monitor (insert key codes after 0x)

#include <IRremote.h>      //copy IRremote library to arduino libraries
#include <Servo.h>
#define plus 0x23123  //clockwise rotation button (replace this)
#define minus 0x41243 //rotation stop button (replace this)
#define back 0x12331 //counter clockwise rotation button (replace this)
 
int RECV_PIN = 2;       //IR receiver pin
Servo myservo1;
Servo myservo2;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  myservo1.attach(9);
  myservo2.attach(10);
  myservo1.write(90);
  myservo2.write(90);
}

void loop() 
{
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value

    if (results.value == plus)
    {
  myservo1.write(180);
  myservo2.write(180);
    }
     if (results.value == back)
    {
  myservo1.write(0);
  myservo2.write(0);
    }

    if (results.value == minus)
    {
  myservo1.write(90);
  myservo2.write(90);   
    }
  }
  delay(0);          //General speed

   }

P.s make sure to download IRremote library and copy it into your arduino IDE libraries folder!

 

STEP 4:

Tie a string to opposite end of each curtain and make something to reel it in:

I used two plastic lids and a cardboard tube hot-glued together but you can use anything shaped like a spool 

 

STEP 5:

Now hang everything up and enjoy your autonomous curtains!

 

 

i had to put my FPS up for adoption because i couldn't raise it

-unknown

Link to comment
Share on other sites

Link to post
Share on other sites

25 minutes ago, James Evens said:

why do you need delay(0) on a 328p?

the higher this value is the longer the delay between button press and servo reacting to it. Also that's kinda my first code so yeah it's a bit of a mess 

i had to put my FPS up for adoption because i couldn't raise it

-unknown

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×