Thank you for your reply, it is VERY helpful. Did you calculate the triggering voltage based on R3 (400 ohms) and 5v?
This is how I derived the input current to the MOC3031M:
From the datasheet of the MOC30xx triac driver, the voltage drop across the input IR LED is 1.1-1.2V. Assuming that the external LED you placed in series with MOC (LED2) is of red colour, it will take up about 1.9-2V. Assuming as a starting point that the uC has a low output resistance, then the 5V output is shared among LED2, the triac driver's internal LED and R3. The first two use up 3.0-3.2V, leaving 1.8-2.0V across R3. Divide that voltage by 400 ohms and you get 4.5-5mA. In practice, the uC output will have some internal resistance which will drop some voltage, leaving less than the full 5V available for the external circuit.
I found a MOC3062 which has a maximum 10ma for guaranteed triggering.
The MOC3062 is a zero-crossing type which means that it will trigger only when the controlled AC voltage is at or near zero. OTOH, the MOC3031 is a random-trigger type which means that it will trigger as soon as it receives an input at the LED side. Each type has applications for which it is better suited than the other. If you intend to control the temperature of the nichrome heater by varying the firing angle of the triac, the zero-crossing type is not suitable as you can trigger it only into a full cycle.
So if I use this part instead and lower the resistor value a bit, I should be good right?
As far as the triggering current is concerned, yes. But don't forget the part about random and zero-crossing.
I believe I had a lower value resistor in my breadboard when I was experimenting, but the LED I had in series with my MOC was very bright. I am not sure what it's rating was so I just stuck a 390 ohm resistor in so it was easier to look at.
If it's one of the common 3 or 5mm type, they are usually rated for a maximum of 20-30mA.
Also, Eagle did not have a library for my triac so I just found one with the same pinout. I am using a BTA24-600 and it says it needs a minimum 35ma trigger current. Do I calculate the triacs trigger current based on R2?
R2's job is to bleed off any leakage current passing from the triac's upper terminal through to its gate and prevent it from triggering itself when it should be off. The trigger current magnitude is determined by R1.
I am a little confused but I think I am starting to actually understand whats happening now rather then just copying schematics off the internet.
That's great. I've been in electronics for a long time, but there still are many things that I don't know or fully understand. The learning process is an important part of the fun.
---------- Post added at 23:04 ---------- Previous post was at 21:53 ----------
Oops! I said up there that the MOC3031M is a random-trigger type which is not correct. It's also a zero-crossing type. To use random-triggering for phase control, you can use the MOC301x or 302x series. Of these, the 3012M and 3023M are the sensitive ones. They need no more than 5mA trigger current.