
When I want myself to wake up, I make my alarm clock turn it's radio on. So, after taking my alarm clock apart and probing numerous soldered contacts, which looked like they could provide low-voltage DC power to the radio circuit, I found one (relative to ground) which was at approximately 6V when the radio was on, and 0.5V when it was off. This was great news, 6V is just slightly larger than the logic 'high' for the Arduino Decimilla. With a simple voltage divider, and the equation Vout = (Vin * Rb) / (Ra + Rb),it would be trivial to bring that voltage down to a suitable logic-triggering level; I probably don't even need to.
I have used fairly high-valued resistors to ensure very little current is drawn from the clock's circuitry; that way there's little chance of damaging the clock.
Now I have a low-current, 5V(ish) supply, capable of triggering an Arduino digital pin. I also have a circuit which allows the Arduino to turn 240V mains devices on and off.
Can you see where this is going?
With the two circuits joined together, it is possible to turn the light bulb on when the radio turns on. Mission Completed!
Arduino Code Listing:
byte bulbPin = 12;
byte radioPin = 8;
void setup(){
pinMode(bulbPin, OUTPUT);
pinMode(radioPin, INPUT);
}
void loop(){
if (digitalRead(radioPin)){
digitalWrite(bulbPin, HIGH);
for (int i=0; i<5; i++){
delay(60000);
}
digitalWrite(bulbPin, LOW);
}
}
This code will leave the light on for 5 minutes after the alarm has been turned off. If the delay wasn't required, neither would be the Arduino.
A video of it in action:
Admittedly, this light bulb is quite bright; I'm going to get a 20W pearl bulb soon.
Possible additions:
- Serial communication for triggering, eg:
- e-mail received
- Web based (switch on a website) (with serial-to-Ethernet module possibly)
- Light level (LDR triggering)
- Triggered by a break in laser beam across the entrance to the room, hmm...
Words of warning: Mains electricity is very dangerous; do not do anything like this if you're not sure what your doing. I did a fair amount of research before building my circuit. The components in this circuit can become damaged from transient voltage spikes so I'd advise against using inductive loads with this circuit - the triacs may fuse open (or worse!). Stick with resistive loads!
Have fun,
Comments/Suggestions greatly appreciated...
Chris