keep burning up resistor 3, which in the diagram is a 56ohm resistor.
I am also concerned that the optoisolator I have is for 240v and not 120v, but I had assumed (again) that it could run at either voltage,
I know that the Arduino can operate on up to 20vdc (12vdc recommended), and that you can get up to your input voltage (minus something like .7vdc I'm told)
I didn't really expect the triac circuit to "work" with PWM (I expected it to do something, I just didn't know what),
Status update: it works!Well, not the triac circuit, I've done it much more simply with a mosfet and a rectifier to avoid zero-cross detection. I also ran my own numbers and figured out why my resistors were frying (after some of you pointed out that I should do my own math), and I just don't know how those other guys got that circuit to work. I'll get back to triacs eventually, but this way seem infinitely simpler because it avoids the zero-cross interrupt coding. I have also used this circuit (with higher amp parts and the addition of a schottky diode- but the explanation below is for my 4amp dimmer circuit) to control the speed of a 12vdc drill.What I've done is to take wall power and run it through a 4amp rectifier bridge, then run that power through my 9am 200v mosfet with an outlet in line with the positive wire for me to plug my light string (or anything) into. To control the gate, I put a 5v voltage regulator (and capacitors) on a 9v transistor battery, with positive running through the detector on an optoisolator and then to the gate, and ground tying into my 110v DC ground. There is also a 100k 1/4watt pull down resistor from the gate to ground.The emitter of my optoisolator is running the "fade" sketch off of a battery powered Arduino Uno. I am very pleased with the results, and I have effectively faded LED strings and a 60watt incandescent bulb without any noticeable problems or heat generation. However I still have some questions.1)I read some things I don't understand about how my 100k pulldown resistor may be effecting the PWM signal due to power dissipation or recovery time or something. Is there a better resistance or wattage for the circuit, and why?2)By using separate batteries for my voltage regulator and Arduino, I believe I am getting the best isolation. However, this is not the most practical. In the future, I intend to use a transformer to step down a separate branch of AC to 12vac, then rectify it to 12vdc, so that my voltage regulator can take it to 5vdc, which is within the specs of my mosfet gate. This will all be on the detector side of the optoisolator, so it shouldn't affect the isolation between the 110v and the Arduino.I would also like to run the Arduino off of the 110vac, but I want to know how that will effect my isolation.If I plug a standard wall wart into the same 110vac source to power my Arduino, have I lost some or all of my isolation by sharing a common ground? If not, could I instead just branch off some of that 12vdc from the transformer/rectifier setup before it goes to the 5v regulator and power my Arduino on that (given that I believe I have accounted for amp draw), or will that negate the purpose of the optoisolator?The way I see it, the only way to get the Arduino completely isolated from that circuit is to have it on batteries, which I don't want to do (it'll be in a theatrical play for 6 weeks, and that's a lot of batteries). But is sharing a common ground acceptable?Thanks everyone for your help! I could not have gotten this far without the input you guys have given me.-JasonPS- I plan to do some pictures and a schematic when I have this completely solved and functional when I have some time, so other people can see what I've done, so any ideas to make this as safe as possible are welcome. I have a liquid, brush on insulation material that I plan to use on my 110v parts, save the mosfet's heat sink (which will be physically isolated from being touched).