Tired of opening and closing the curtain every morning and evening, I tried to design a device that can open and close the curtain in my room automatically according to the illumination outside. My initial design is to use a motor to move a a rubber conveyor that is connected with the curtain. Here's a scratch of my design. In fact, I have several different designs, including using a screw rod, using two motors with a line, and using conveyor. Finally, I decided the use adopt the conveyor design because its both cheap and easy.

## Step 1: Purchase Needed Items on the Internet

I afraid the common motors may not pull the curtain to the right place every time, so I decided to use steppers. I bought steppers, conveyors, gears, and light-sensitive resistors from the internet. With the help of the internet, I also learned the correct way to use steppers. The limited voltage one the stepper is definitely wrong--3.3V DC is too low. I used a 12 volt power supply.

## Step 2: Write Program

My program consists of two parts: stepper drive part and light measurement part. Every minute, the light measurement part will measure the ligth intensity 10 times and save all these data into a array. Than all elements of the array is added together to get the final value that determines the opening or closing of the curtain. I decided to measure the light intensity 10 time mainly to avoid sudden and short variations of light intensity. For example, if the light-sensitive resistor is illuminated by someone's electric torch at the mid night for a second, my Smart Curtain won't open because a single high light intensity value will not increase the sum of all ten values too much. There is also a gap between opening and closing value in order to prevent the constant opening and closing when the light intensity is close to the threshold value. If the opening and closing values are the same number, for instance, 100, the usual light intensity fluctuation near 100 will cause the curtain to open or close many times. I also set long delays because it is not important to measure the light intensity so often. The txt of my Arduino program is provided above.

## Step 3: Connect the Wires and Test

Connect the wires according to my program, and test the motor drive, stepper, light-sensitive resistor, and program before implementing them on the wall. The first picture was taken during my testing part, and the second picture is my motor drive. I used A4988ET motor drive. The threshold light intensity for opening or closing was also determined during the testing process. After testing, it is the time to make containers of the motor and gear.

## Step 4: 3D Print Containers

I designed my containers using 3D One( Education version), and cut it to slices which are acceptable for 3D printers through Repetier-Host. I because the size of my container must match the size of my motor, an accurate measurement of the size of my motor, gear, and space under the ceiling is crucial. A vernier caliper is preferred. The thickness of my containers is 5mm, and the density is 20%. After I had finished my model, I printed that out using the 3D printer in the XmakerSchool, South West JiaoTong University, China.

## Step 5: Implement Containers and Connect to the Curtain

I used electric drill to make setscrews into the ceiling and put gaskets between the containers and the setscrew because I afraid that my containers are not strong enough. Don't forget to put some newspaper on the floor before beginning to drill, because the powder from the ceiling is extremely difficult to collect. In my design, the conveyor is directed connected to the curtain, and the length between the curtain and the conveyor shorter than the distance of the link between them. As a result, the link will have a angle which enables the stepper to pull the curtain easily.

## Step 6: Power Supply and Final Adjustment

I put my Arduino board on the frame of the window using Scotch tape. Because my wire is too short, I had to use patch board. Because the total mass of the patch board and wire is too heavy for Scotch tape, I used a rope to hold the patch board. The light-sensitive resistor was also put on the window with Scotch tape. After examining the heat generation and the stability of the system, my Smart Curtain was finally finished! I can now stop opening and closing the curtain in my room with my hand.

Even though, I think that my curtain should also be able to be control by human, but just light intensity. I was now trying to use Bluetooth to control it, and I will publish new Instructables after by Bluetooth part has been finished in the future. If you have any suggestions or advice, please tell me! Also, I think there must be some grammar mistakes in this Instructable because I'm a non-native English speaker. Thanks for your tolerance of my poor grammar and thanks for viewing!

## Step 7: Bluetooth Control Added

I have finally completed my study the use of Bluetooth in Arduino and improved my previous Smart Curtain with Bluetooth technology. First, get a Bluetooth part and implement it on Arduino. Remember that the TX and RX on the board should be connected to the RX and TX of Bluetooth, respectively. Second, I improved my program by adding a condition change. The user can change the condition of the curtain using Crazy Car, an app on cell phones. When in Automatic mode, the curtain respond to the light intensity; while in manual mode, the curtain only respond to signal sent by the cell phone using Bluetooth. I used an LED to indicated the status of the curtain. By the way, I found that there was not enough GND on the Arduino board so I soldered two wires to it. My new Arduino program and app Crazycar were provided here.

<p>This is great! I need to make one of these for myself too. Can you please post a video of the curtain in action too please. Pictures aren't very good in understanding some of the things.</p><p>Thanks for this post.</p>
<p>Hey, great idea. I have been thinking about something similar for a long time, but couldnt come up with a way of doing this since i dont know much about motors yet.</p><p>Can you pls provide parts list with links to motors and converyors that you used?</p><p>Can you recommend a motor for these regular vertical shutters (like here http://www.hornbach.de/data/shop/D04/001/700/315/77/DV_8_3821552_b_20110908223002.jpg)?</p>
<p>So first, I used stepper, a special type of motor. Steppers are motors that can revolve certain angles. For example, a normal motor cannot move the conveyor the same distance every time because motors are not designed to be accurate; however, steppers are so accurate that they can rotate a exact angle. Steppers are a little more difficult to control than motors. You need a stepper drive. I recommend A4988, which is currently the most prevalent model. You also need special program to drive steppers. Luckily, your Arduino had already contained a sample stepper drive program. Just open 'examples' in the Arduino program and click 'Stepper' and you will get the required stepper drive. </p><p>Both 42 and 57 steppers are OK. (the number determines the size of stepper, for example, the length of a 42 stepper is 42cm. Any brand is OK, just make sure that it is powerful enough. I think that all 42 steppers should be OK.</p><p>I used 5mm conveyor. Rubber may be more tough than people normally think. A 5mm wide conveyor is definitely strong enough.</p><p>As for you link, sorry I cannot read German. Studying English is painful enough for me. Still, if you have any questions, feel free to ask me!</p>
Hey thanks for the introduction :)<br>The Link is just a Picture of the type of shutters i was talking about.
<p>You can use a normal motor with encoders to get the absolute position. Always use a safety mechanism like a LED sensor to make sure it doesn't exceed the design limits. Also you can current sense to make sure the motor is not stalled.</p>
Wow, that will make the mechanism more simple! I cannot imagine why I didn't think of that before! I will learn more about your way to determined if my system can be simplified. By the way, my Arduino board already has LED sensor, so I needn't add any extra LED. I'm no a native English speaker, so if my understanding of you is mistaken, please tell me, thank you!
<p>I love the idea but, correct me if I'm wrong, can I still open/close the curtain by hand?</p>
<p>Of course you can! you can just pull it by your hand, but better turn it off first. In my design, the initial situation was that the curtain was opened, so when you turn the curtain on, make sure that the curtain is open. In fact, I am now trying to use Bluetooth to control the curtain with cell phone, but my current Bluetooth control method still has some problems.</p>
<p>That is awesome. I need to make some of these for my house.</p>