Introduction: Smart Curtain
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.