AC light dimmer

Hi,

I am working on a project that I will briefly outline here:

First is a web interface, based on an apache network server. This communicates to a python CGI script, which sends a serial signal to my Arduino Mega 2560. This will control the lights and sound system volume and such in a room of my house. My question is regarding the AC light control portion. As you can no doubt tell from the title, I want to dim them. I have mostly figured out how to do this from several google searches, but I want to detail the circuit for inspection by those of you more experienced in electronics than me. I will have a triac (BTA16-600SWRG from digikey), I chose the one that did not say snubberless because the manufacturer's website said the standard ones are suitable for dimming. The TRIAC will be connected straight to mains, with the gate connected to a digital out of the arduino. Possibly with a transistor in between? I will also have an AC transformer connected to an opto=isolator connected between the 5v output on the arduino and an analog input. When the analog input reads 0v, delay for x milliseconds, and fire a pulse at the TRIAC. This should cut off the waveform somewhere in the middle, depending on how bright you want the light. I also had thought to put a relay (Datasheet) on the line to the light, so that when the desired brightness is below 10% or so, just to turn off the current in the AC line. Does this all sound workable?

As stated, you would be running the Arduino with the "ground" side connected to one side of the mains. This is potentially dangerous and precludes connecting it to your network server via a serial link unless you opto-isolate that link. I recommend you isolate the triac drive instead, then you can ground the Arduino as normal. The easiest ways to do this are to use either a pulse transformer (use a transistor to discharge a small capacitor through the primary, and drive the triac gate from the secondary), or an opto-triac (the opto-triac just triggers the main triac, it doesn't replace it).

Doing the phase control by delaying from the zero crossing is sound, however there will be a small phase shift in he transformer caused by the magnetising current. This probably doesn't matter, but one alternative is to use a resistor and bridge rectifier to drive an opto isolator at low current direct from the mains.

Why bother with the relay, when you can turn off the light by not firing the triac?

Since posting, I ran accross a thread in which someone got it working and posted a schematic and code. Here is the post. I ordered 2x H11AA1 opto isolators, 3x MOC3082M opto TRIACs, and 3x BTA16-600SWRG TRIACs from digikey. This looks like a better way to do it. As soon as I receive the parts, I will build it and try it.