The Curtain-Wakener

Apr 8, 2021

By Drew

Wouldn’t it be nice to sleep in a dark, dark room that gradually fills with light in the morning to help you wake up? And wouldn’t it be nice to not pay for a lighting system or fancy curtains to accomplish this?

Wouldn't it also be nice to make a web page that works on outdated browsers? I have not done that yet.


The video explains most of it and shows it in action, but here’s some info anyway.

After misspeaking in the video, I now only refer to open curtains as awake curtains, and closed curtains as asleep. Thus the name of my creation.

Ingredients Used:

  • K'nex:
    • Way to mount to curtains/wall (in my case just getting pieces to clamp around curtain hardware)
    • Structural pieces
    • 2 chains of sufficient length
    • 4 sprockets (2 for each chain)
    • Enough gears to transfer motion from one chain to the other
    • A motor, ideally one of the ones with a slower speed and thus more torque
  • Arduino & power for it
  • Other electronic bits:
    • 5V relay (Songle SRD-05VDC-SL-C)
    • Transistor (NPN PN2222)
    • Diode (1N4007)
    • 1kΩ resistor
    • Little prototyping board and enough connecting wires
  • Lamp wire and alligator clips to connect relay and motor
  • Carabiners and wire to connect curtains to chains
  • Tools such as hands, wire strippers, drill, clippers, file


3 Sections

I managed to clamp K’nex around parts of the curtain rod in a way that was secure enough to build everything else off of. The right side is the driving motor and moves the right chain, the middle transfers motion to the left curtain/chain, and on the left is an idling sprocket.

It was a bit tougher to get the left chain’s tension right given that the chain links are larger than those of the right chain, and as such adding or removing a link usually makes too much of a difference in chain length. (It is also a bit heavier than the right chain and requires a bit more tension to prevent too much drooping.) After rebuilding the left assembly several times I got it to work.

Left Part

There is a good amount of tension pulling on the left, so I built up the structure enough that it has managed to remain put despite how italicized it looks.

Middle Part

I was a bit worried about the middle assembly being mounted in only one spot on the bottom given how large it is, but the tension from either chain helps keep it in place fairly well.

Right Part

It took several tries to figure out how to orient the chains in a way that worked and fit the motor/driving sprocket in the right side assembly in a somewhat compact way.

Selecting a Motor

It would have been ideal to control the K’nex motor with my own power source and motor controller. Then I could spin it in both directions (to reset it at night), and probably control the speed to make it move more slowly and quietly. But, I couldn’t get it moving at anything more than a weak crawl, and never managed to figure out why. Given how jank the rest of the project is, it was not worth investing more effort into this.

Not that it was super critical, but it might’ve been nice to be able to use the stepper motor I have and know exactly how far it needs to turn to be able to wake it up just the right amount. But, given variability in how I set the curtains up when manually closing them, and slack in the chain and curtains how non- rigid most of the moving parts are, I feel like it would not really be any better than turning on basic motor for x seconds like I do currently. And also the motor gets stuck anyway once it wakes up most of the way and cant squish the curtains any further, and this inadvertently works as a good way to stop it so having the stepper motor that might be a bit more precise really isn’t necessary at all.

But, it is quieter.

Would it be capable of pushing the curtains, or is it too little and weak to handle that? I never found out. But with enough gears I bet I could get it to a ratio that works, while adding a lot of bulk to the right side. And my plan was to use epoxy to attach a little K’nex gear to the motor and go from there. But, again, it just wouldn’t be worth the time or effort. Time to slap a relay in there and be done.

The Electronics

I had a relay, but not a relay module, and this video helped me set everything up in order to operate the relay. I also added a button that I could push to trigger the relay for testing.

I drilled the holes in the battery compartment lid and used some clippers & a file to cut the little piece of battery connecting metal in half to keep the two sides electrically isolated (see my video). I am sure a bit of hot glue would have helped here, but I was able to carefully shove the lid back on with everything in place.

Here is a wiring diagram of everything. It is basically copied from the referenced video above.

Wiring Diagram
Actual Wiring
Wiring Close-up

The Code

I might start a GitHub at some point, but this is so basic that it wasn’t worth it.

int relay = 4;
int button = 3;
int openTime = 21000; //time it takes to actually open the curtains, since I have no feedback
int sleepHours = 7; //number of hours to wait overnight until they open
long sleepTime = 1800000; //additional milliseconds to wait overnight until they open

void setup() {

pinMode(relay, OUTPUT);
pinMode(button, INPUT_PULLUP);

for (int i = 0; i < sleepHours; i++){

delay(3600000);

}
delay(sleepTime);

digitalWrite(relay, HIGH); //turn relay on
delay(openTime); //wait 21s while curtains wake up
digitalWrite(relay, LOW); //turn relay off

}

void loop() {

if(digitalRead(button) == LOW) //if button pressed

digitalWrite(relay, HIGH); //turn on relay

else

digitalWrite(relay, LOW); //otherwise turn relay back off

}


21 seconds was about the right amount of time to wake the curtains after a few tests. I broke sleep time into number of hours plus additional time to make it a little cleaner.

I am realizing now that it might have been better to wake up the curtains in small increments at a time, pausing in between, to make the lighting process more gradual. But, I would probably hear the relay click and the motor turn on every time, so nevermind.

The Big Cons

  • Still extremely loud. Loud enough to wake me up and basically defeat the purpose of trying to wake up more naturally with the light.
  • Can only work in one direction. Unless I go and physically turn the switch on the motor. Then it can only go in the other direction.
  • You have to make sure to start the program exactly X hours before wakeup time, since all it does is wait exactly that long. And you need to edit and re-upload the program to change that waiting time. It would be cool if it had a clock and a few buttons and you could just set the time you want to get up.

The Big Pro

  • I can say that it works! And it didn't cost me anything other than time.

Conclusion

If I ever decide that I care more about this project, I will get a motor that doesn’t suck and go from there. And also maybe build parts out of something other than K’nex.

This project is not really much more than a cheap proof of concept. It met the most basic base requirements to be considered “working,” and that is good enough for me. And I still think it looks kinda cool.

Left Part
Left Part


Questions? Comments? Feel free to hit me up with an email at contact@drewuhpicture.com or a DM on one of the social media platforms that I'm on (links below).

Wish you could leave a comment right here? Let me know that too! I am considering trying to integrate some sort of comment system eventually, and I will be more motivated to do so if I know that people would be into it.

Bye!

Go back to creations page