Wake Up! (prototype)


Posted by Nate in Projects.
Friday, October 19th, 2007 at 2:42 pm


Argh!  So close!  Last night was the first night I tried to test the new wakeup system (it feels weird to call it an alarm, but wakeup system is too long..?) and it went pretty well – until morning, that is.  Then, as planned, there were birds twittering nicely, but the room remained sadly dark.  And, totally ruining the intended effect, I was thinking about it all night and kept waking up to see what time it was and when it was supposed to go off!

bpict0002.JPGSo, clearly not working yet.  Let’s back up…  I ended up with a Sony ICF-CD815 Dream Machine CD / radio alarm clock, a nice looking unit with dual alarms.  I can imagine a scenario where one of us has to get up at some terrible hour, and can use one built-in alarm, leaving the second one to trigger the system later for a gentle wakeup.

pict0001.JPGSpeaking of "trigger the system", that’s where my troubles began:  I needed a way to tell the Arduino that the alarm was going off.  I had toyed with the idea of watching voltage across the CD motor, etc, but ruled this out because we’d never be able to play CDs in the room without starting up the light dimmer!  After pulling apart and testing everything I could think to test with just bpict0003.JPGa multimeter (if I keep doing this I’m getting an oscilloscope), I decided to tie into the LED for Alarm A.  By attaching my own light here, I could create a signal outside the clock that I hoped I could detect with the Arduino.

It wasn’t that easy.  The light can be either solid on or solid off depending on if the alarm is set or not, and it goes to a "flashing" state when the alarm is actually going off.  Hmm.  I wrote and tested numerous versions of code to watch for resistance changes in a light-sensitive resistor, and went to bed believing I had it nailed.

blinking.jpg

The complication lies in the poor sampling ability of the resistor (that pulse line above is actually pretty wavy) and the timing issue of the blinks: no matter what I tried, the code would sometimes miss a blink, and decide the alarm was over.  What I ended up doing was keeping track of the last 8 samples and counting state changes.  If I could say that the light "changed" (beyond a certain threshold) at least 3 times out of 8, it was "blinking".  This leads to a little bit of lag – 8 samples takes about 5 seconds – but it seems to be working.

bpict0008.JPG… of course, I didn’t get that sample size right until too late.  This morning some combination of being in the dark and possibly a loose connector left the whole thing inoperable.  Dag.  Always tomorrow morning, I guess!

At right: the little guy making it all happen.  (The Arduino board is actually under the piece you can see.)  The three clear LEDs are for temporary lighting, the red one represents the furnace until I run that wire, and the buzzer is for the backup alarm.  That blue-tape-wrapped thingy on the top is the Alarm A LED glued to a photoresistor for sample the alarm light.  Once I get it finalized I’ll put it all on a new circuit board and in a nice box.  Also still waiting for the final dimmer kit to arrive…  Fun!

(oh, and there’s an output pin standing by to fire the coffee pot in version 2…  :)

Similar Posts:

5 Responses to “Wake Up! (prototype)”

  1. Karen Says:

    I have no idea what you are talking about in pretty much this entire post. But I think you’re super dreamy.

  2. Troy Says:

    All I can say is thank god your on the good guys side.

  3. Troy Says:

    Oh, a name suggestion:

    R.O.O.S.T.E.R.

    Really Omnipotent Operating Subtlely To Ease Reality

    Ok, so I was BS’ing the initialls, I still like it. ;)

  4. Q Says:

    That’s pretty damn sweet! Did you have a lot of these parts just lying around? Or did you start with new materials?

    And what’s this nonsense about the Arduino not being able to sample fast enough to catch the flashing? That’s dumb. You should make it faster. ;)

    So, what’s the software interface for that bad boy look like? Are you writing Java code at an API for the Arduino? I want you to post your code! Hehe. Or not.

  5. Peter Says:

    huh?