Here's my latest, small project: a 240V mains light triggered by my alarm clock and helped by my decimilla. There will be so many ways to expand this, and it was quite cheap to build (I spent about £6).
Excellent.
Do you know if you add a capacitor from the opto's output to neutral, and a DIAC between the opto and the gate of the triac. Then feed the other side of the opto with PWM you could probably dim up / down the mains bulb.
I did think about doing something like that. I tried: "HIGH, delay(), LOW, delay()" but it faded in and out slowly (phase issues). The diac is definitely the way forward.
It would definitely be better for it to fade in instead of suddenly turning on. It's actually not that pleasant being woken by a 60W bulb at 6am! (I haven't brought a 20W bulb yet)
I'll give it a go next time I buy some stuff online.
What type of capacitor would you recomend for the smoothing (I think that was your intention)?
No it's not smoothing, it generates the phase delay, the RC value (time constant) determines when the voltage gets to 20V or so and fires the diac. It depends on the value of R you get from the 1K and opto transistor. I should start with 0.1uF note it needs to be at least 350V working.
Sorry, I should have made that clearer. I would have used non-polarized capacitors (you can get non-polarized electrolytic caps). I was just wandering if any particular type of capacitor would be best suited to the task.
I used a fading up light bulb as my alarm for years and it's definitly the way to go. Your body responds so much better to the sunrise effect. You'll spend around $50 to buy one, so your approach looks like a winner to me.