Hello! The Arduino community is a wealth of information, and I greatly appreciate any help that is offered.
In the long run, I’m trying to make five separate sets of LED strings fade and blink simultaneously. I plan to do this with one Arduino as a sensor driven trigger (I’ve got that working), wirelessly transmitting to the others (I have that working, too), but I never expected that the hardest part was going to be making the dimmers!
The problem is that I am trying to use off-the-shelf Christmas LEDs (for price and the fact that it’s all pre-wired, since the final display will have about 2,000 LEDs), which means I need 120v power to run them. I believe that means I can’t use my Mosfet Shield http://www.sparkfun.com/products/10305, because it only handles up to 60v. The Mosfet shield would be ideal, since it runs off of PWM which I understand fairly well, is cheap, has six channels (I’d use 4), and already has a board.
But, since it doesn’t handle the voltage I need, I am looking into TRIACS. I have assembled a prototype board based on this diagram:
-which I found in this forum topic http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1276992650/0.
I am having several problems with that circuit, as well as the code.
1)I keep burning up resistor 3, which in the diagram is a 56ohm resistor. I also tried both of the resistor values from similar circuits on the MOC3041M datasheet http://www.datasheetcatalog.org/datasheet2/2/048xrw12q8wiqfuc09tqwfy5dgwy.pdf. What happens is that the 4.8watt LED string I’m using for testing seems to work correctly, switching on and off, and even flickering like crazy when I send a PWM signal through the optoisolator, but if I plug in a 60w incandescent bulb everything is just fine (the circuit doesn’t immediately start to fail), but as soon as I send a digital HIGH signal to the optoisolator, R3- no matter what value I’ve used, up to 1/2watt, starts on fire and will not stop until the 120v A/C is disconnected.
There’s a picture of my breadboard circuit attached (you’ll note that I had accidentally put a 330k resistor where a 330 should have been, which was later corrected but with no additional success).
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, whereas the MOC3031M would not handle the higher voltage, since this was the specific isolator called for from the circuit diagram I am using.
For the record, I am using a BT138 TRIAC http://www.ee.latrobe.edu.au/internal/workshop/store/pdf/BT138.pdf.
2)I can not for the life of me figure out how I’m supposed to run this thing. I had foolishly thought that it would work with a PWM signal, but it seems I’m very wrong. From what I’ve read in the forums, it seems that I’ll need to use the zero crossing circuit in my optoisolator to time the dimming through the TRIAC, and that the way to do that is through an interrupt on Timer1, but that’s all new to me, and the code I’m looking at is either too complex for me to modify for my purposes, or not compatible with my hardware/circuit.
This is the code I was most interested in, from Ryan McLaughlin on this forum topic: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1236998971/75. I tried to post it here, but I ran out of characters :~
For what it’s worth, finding help might be a little easier if all of the relevant forums weren’t locked, and I could just ask for help from the people who have already done this, but I don’t think that’s possible because of the forum migration that recently took place.
3)When the capacitor is connected, I get enough current to dimly light up my LED string before my Arduino was turned on, so I took it out and there was no change either way (as far as melting things or operation), other than that trickle of power when I wasn’t sending a signal. Maybe this be irrelevant when I find what I’m doing wrong elsewhere, but I’ve included it in case it helps someone diagnose my error(s).
Thank you to anyone who can help! I am now in absolute crunch time for this project (it’ll be canceled and done another way if I can’t show proof of concept today, it’s a project for a play at a local theater).
Also, for the record, I have handled mains power safely before in a professional environment and I am aware of the dangers to myself and my equipment.