The solution presented here may seem "Rube Goldberg"... but it has worked fine in my home for many years with just one or two simple maintenance repairs along the way. Do take the time and trouble to Do It Right the first time, though... you don't want to be re-doing it frequently!
My curtains, like most people's, I suspect, open when you pull down on one cord, close when you pull down on another. The cords have to be pulled about 20cm to open or close the curtains.
Now... take a deep breath, rush through the next few paragraphs without, yet, worrying too much about the detail. But you'll want it if you decide to build one of these things for yourself. the exact numbers will have to be adapted for your specific circumstances.
Below my curtain's "open" and "close" cords, I mounted a small DC motor, with a long shaft arranged so the shaft is horizontal.
Next, I took another bit of curtain draw cord- like material (I used heavy test deep sea fishing line!), about 2m long, and fixed the middle of that to the middle of the shaft. I opened the curtains. I wrapped about 25cm of the 2m cord around the shaft, outward, away from the point of fixing. I then tied that to the "pull me to open curtains" cord, about 30cm above the motor.
(It pays to make the connections between the curtains "pull me" cords and the cord you have added, the one that started at 2m long, easily adjustable, and adjustable with a fair degree of precision.
I then wrapped about 5cm of the other half of the started-at-2m cord around the shaft, working outward from the point of attachment, away from the wraps we did for the cord going to the "pull me to open curtains" cord.
Then the end of the half with 5cm wrapped was connected to the "pull-me-to-close curtains" cord. It was attached about 55cm above the motor. It was attached so that all of the cords were under a slight tension.
Whew! Brave you! Thank you for reading! We've got past the bad bit. Stop skimming.
If you've done all that correctly, you now have the basis of your curtains open/ close device!!
If the motor begins to turn in the right direction, cord will unwrap from the side connected to the "pull me to open curtains" cord, and the other cord, the one connected to the "pull me to close curtains" cord, wrap, at the same rate, onto the shaft... pulling the curtains closed!
If you cause the motor to rotate in the opposite direction, the opposite happens: The "open curtains" cord is pulled down and the "close curtains" cord is released from the shaft at the required speed.
Making the mechanics is a little tricky, I admit. But it isn't impossible! (If anyone knows of a commercially available device that allows simple control of the motor, I'd be pleased to learn of it, advertise it. (no fee.) "Simple" means that the motor has two wires accessible. Feed DC in one way and the curtains open; the other way and they close.)
"Tricky" in a more satisfying way is the control of the motor....
You have to arrange that the motor will never continue in operation too long in either direction. You want the curtains to nearly fully open or close... but not quite. If the motor ran for too long, when the curtains were fully either way, the motor might burn out, or be pulled from its mounting, or the curtain rail might be pulled down. None will impress the wife.
We'll come to that control in a minute. First we'll look at a circuit to make controlling the motor from a computer easier. Ignore the two green triangles for now.
The diagram shows a DC motor wired to a power source via two relays. The relays are "off". With the relays contacts (SPDT) as shown, the motor will not be turning. Put one or the other relay's contacts into the other position, up, and the motor will turn. It will turn in one direction if Relay A has been energized, in the other direction if Relay B has been energized. Energizing both of relays is another way to turn the motor off.
How you turn the relays on and off is a story for another day, or a quick Google search. Be sure you understand what you are doing, if your solution includes your computer! (Do remember the diode across the coil of the relay!) An Arduino, or another microcontroller like the BASICStamp is a much less expensive "toy" to do "learning" on. I have a page about using a computer's parallel port for controlling things.
With the above, to reiterate the main point, all you have to do is manage the "ons" and "offs" of the relays, and you can make the motor go "forwards" and "backwards" or be off.
When the motor is at the heart of the mechanical "stuff" explained above, that means the curtains open or close.
So... what about the green triangles?
As a safety precaution, and to make it easier to program the relays' ons and offs, we're going to fit two switches to our system. They are single pole, single throw switches. A little micro switch would be perfect. They are both "normally closed". And you mount them on the wall above your curtain operating motor thus: Each has a string from it which attaches to one of the pull cords. Again, an easily adjustable connection is helpful. You make connect the strings as follows: Neither should impede the full travel of either the "open" or the "close" pull cord. One will be attached to each. The connecting string needs to be attached so that just before the curtain gets fully open (in one case) or fully closed (in the case of the other switch), the switch opens. Look at the circuit diagram again. If EITHER of the switches (but NOT both) in the circuit at the places marked by the green triangles is OPEN, the motor immediately stops working. BUT! The circuit will still allow the motor to operate in the OTHER direction, just as soon as the relay settings are changed to select that. Clever? I think so. And even if you don't have my sense of the clever, you can still use the circuit to open and close things!
The beauty of the "hardware" don't-open-or-close-too-far provision is that the computer program to control the curtains doesn't need to be fine tuned to make the motor run exactly the right number of seconds. That time will no doubt vary over time, anyway. The program is merely set to ask for "open" or "close" for long enough to do the job, plus a bit more to cover the times when the process is a bit slower than usual. It would, in my opinion, be foolish to depend entirely on the hardware "don't.... -too-far" provision.... If anything went wrong with that, the motor might be straining against an already fully opened (or closed) closed curtain for protracted periods. Probably not a good idea. Which is why I wrote the program I did which takes care of all that, provides for the curtains to open and close on a schedule, and provides for a light to come on and off at different times, too! Both light and curtains can be operated at nonscheduled times just by clicking on a button on the computer screen.
Please someone build this, tell me you've done so?? It was a lot of work to write it up! Yes, I have the benefit of the automatic curtains and lights... but I've had that for years, without doing the work of this write up!
Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org