Introduction: Blinds' Eye
This is a machine that will automatically open and close your blinds, based on whether it is light outside (with some caveats; see Step 5: Software). I wanted to build it for two reasons: security and convenience. If you have your lights on timers and your blinds open and close automatically, it can be difficult for potential thieves to tell whether someone is home or not. Also, it's nice that the evening dog-walkers are not staring at me while I type this because I forgot to close the blinds when it got dark today.
I live in the USA, so my parts are sourced mostly from Amazon. I also own a RepRap 3D printer so there are a lot of 3D printed parts. You'll need a printer that can produce small features, because the gears have small teeth.
Step 1: Supplies
If you want to build one of these as-shown, you will require about $60 worth of parts:
1x Arduino Pro Mini 5V https://www.sparkfun.com/products/11113
1x Sunkee light sensor board http://www.amazon.com/gp/product/B00CW82WZY/
1x Zitrades motor driver board http://www.amazon.com/gp/product/B00CW82WZY/
1x tiny motor http://www.amazon.com/gp/product/B00CW82WZY/
2x 607 bearings http://www.amazon.com/gp/product/B00CW82WZY/
1x SPST switch http://www.amazon.com/gp/product/B00CW82WZY/
1x power supply http://www.amazon.com/gp/product/B00CW82WZY/
1x DC power jack http://www.amazon.com/dp/B00CQMGWIO/
1x m7 by 35mm long hex-head bolt (probably from your local hardware store)
A similar switch and DC power jack are much cheaper from somewhere like www.mouser.com, but you'll have to pay shipping. Do a little looking around and you may be able to reduce your cost.
You'll need three screws that you probably have lying around if you're attempting this. Two need to be flat-head wood or sheet metal screws, 3mm to 4mm in diameter and at 15mm to 20mm long. The other is a pan-head wood or sheet metal screw of the same diameter but 20mm to 25mm long.
You'll also need to 3D print the mechanical parts, or order them from Shapeways. I have a RepRap 3D printer with a 0.35mm nozzle, and it just barely did an adequate job on the tiny gear teeth. The STLs are available on GitHub, as is the Arduino sketch that you'll need: https://github.com/drewtm/windowlackey
Obviously, you'll need some wire. I used various kinds; whatever you have available should be fine, as long as it's small enough to fit in the various places it needs to go.
The electronics should suit you no matter what kind of blinds you have, but you may need to design a different gearbox for your blinds. If you happen to design an alternative mechanism, you should put it on GitHub!
Step 2: 3D Printing
The gears and the electronics enclosure are quite small, and you may have a difficult time printing them on, for instance, a Makerbot, with it's 0.5mm nozzle. They are sized for the 0.35mm nozzle on my RepRap, but I would have liked to make them smaller and the gears finer pitch. Perhaps one day I will have a printer that can do finer detail. Again, the source files are here: https://github.com/drewtm/windowlackey
If you are going to 3D print the parts yourself on a RepRap or other fused filament printer, print them in the orientation shown above. However, I don't recommend printing them all at once, because if one part fails it will mess up the others. I used three perimeters and 50% infill with 0.18mm layer height.
If you are going to order the parts from Shapeways, I recommend their 'strong and flexible plastic' material, but I haven't actually tried the Shapeways version. I put these same STL files on Shapeways; they're ready-to-buy if you want, with a ~$10 markup: https://www.shapeways.com/model/2925386/blinds-eye...
Step 3: Mechanical Assembly
A. Press the two 607 bearings into the ends of the bore of the large gear/sprocket.
B. Push the motor rear-first into the front of the anchor bracket and push the small gear onto the motor shaft.
C. Solder wires to the motor on the back side of the bracket. There's no positive or negative because the motor runs both directions. The wires run off to the side through a channel in the back of the anchor bracket.
D. Pre-install an M7 hex head bolt into the anchor bracket, to form threads in the plastic. You may need to heat up the bolt to let it push its way in. You could use a tap, I suppose, but for small screws I prefer formed threads in FDM parts; they are stronger in my experience.
E. Hold the anchor bracket against the wall, put the sprocket through the ball chain, and use the M7 bolt to attach the sprocket to the anchor. Pull the ball chain quite tight and mark your holes on the wall where the anchor will mount.
F. Use the top cover of the electronics enclosure to mark a place on the wall for the controller. The sensor hole on the side should be facing toward the window such that it registers the brightness outside, not the brightness inside.
G. Drill the three pilot holes in the wall.
H. Bend a piece of a coat hanger as shown in the photo to make a guard, so that it fits in the L slots on the back of the anchor bracket. Mine also has a little pocket bent into the wire to hold the other cord that I never use, so it doesn't catch in the gears.
J. Screw the anchor bracket onto the wall, sandwiching the wire guard in its grooves between the bracket and the wall.
K. Optionally, use a paper clip or other small wire to enclose the other pull-cord.
L. Slide/snap the three circuit boards into the bottom part of the electronics case. You'll wire them up in the next step.
M. Put the bolt head cover onto the bolt. Now it looks so pretty.
Appendix: don't forget that you'll need an outlet to plug into.
Step 4: Electronics Assembly
See the wiring diagram and photos for how to connect the three circuit boards, the switch, and the DC power jack. Make sure to include enough length of wire to the switch and the DC power jack in order to get them to convenient locations. The wires should be small enough to fit out of the case beside the motor screw terminals.
Before you hook up the motor driver board, you'll want to de-solder its overly-bright power LED, because that LED drowns out the Arduino's LEDs, especially the green LED that indicates when the blinds are almost ready to move. The offending LED is circled with a red X in the photo. I ended up destroying the LED while trying to remove it with my soldering iron... oh well. Just don't overheat the motor driver board and burn up anything else.
Step 5: Software and Programming
This design is based on a light sensor, and uses the inaccurate timer on an Arduino to help prevent the blinds from opening or closing at strange times--for instance when car headlights hit your window at night, or when the mailman walks by in the morning and casts a shadow. Once the blinds open due to a light trigger, they won't try to open again for 20 hours. Similarly, once they close, they'll wait almost a full day before looking for dusk again. With this mechanism, the blinds stay automatically in-sync with the daylight, regardless of daylight savings time, your latitude, the time of year, the weather, or the accuracy of any clock.
The blinds open and close based on timed motion, where the closing motion lasts slightly longer than the opening motion. This way, even without any position sensor, the blinds are always sure to return to the jammed-closed position, without slowly drifting further open or further shut due to timing inaccuracies, friction changes, etc. You may have to adjust the timing, though, if the friction in your blinds changes.
There is an override switch included in the design. If you close the blinds manually during the day, they'll stay closed until the next morning. The program will still register when dusk happens as usual, but the blinds won't move if they're already there. You can also use the override switch to 'train' the blinds, by closing them when you want them to close, then flipping the switch back the other way before they're done closing. When you do this, it registers as a training event instead of a manual override. After a few times, it should get them pretty close to how you want. (You can train the opening trigger in the same way.)
To program the Arduino Pro Mini, you'll need an FTDI cable like this one: https://www.sparkfun.com/products/9718
The Arduino website has some info on how to program it: http://arduino.cc/en/Guide/ArduinoProMini
If you're unfamiliar with Arduino in general, read around on that site a bit. You'll need to download the Arduino IDE to your computer and use it to open this .ino file: https://github.com/drewtm/windowlackey/blob/master... Then you'll choose the type of board and the serial port (hopefully there will only be one serial port to choose from) and press the 'upload' button.
You may need to customize a few things for your own installation:
#define OPENTIME - Opening drive duration. Set this by trial and error. Luckily it's pretty linear, so you should be able to get it dialed in with only a couple of tries. The number is in milliseconds.
#define CLOSETIME - Closing drive duration. Make this slightly longer than the opening drive duration
word dawnbright - Opening light level. You can use the example sketches in the light sensor library to get some baseline light readings at the times of day you want the blinds to operate, then code those numbers into the sketch. The units on this number should be half-lumens, but that's pretty meaningless to me.
word duskbright - Closing light level. Set in the same way as the opening light level.
Depending on what kind of switch you used, you may need to change the macro #define swON to be defined as (digitalRead(swpin)==HIGH). I have mine set up so that the '1' mark on the switch means blinds open and the '0' mark means blinds closed.