Tell us about yourself!
Hey diy_bloke, quick question. I'm using a isolation transformer as the 120v source, I noticed it hums when I turn the dimmer low. Is that normal or am I introducing some weird harmonics into the mainline?
Moving the logic into delay didn't work, I think the phase was getting out of sync. At the bottom of zero_crosss_int we do a short delay and set ac load pin to low, the comment states that the next zero crossing will switch the triac off but why would it not switch the triac off at the time of the digitalWrite?
I meant to say 'moving the logic into *loop* didn't work' :)
That's great because single phase was correct rectifier. I believe this is the datasheet for the diodes used in diy_bloke's circuit: http://www.goodexcel.com/new/download/SPEC2008_RoH...Here's the one I used: http://www.jameco.com/Jameco/Products/ProdDS/10304...You should post pictures of your circuit if you have time.
I've been thinking about the software. We're interrupting at the start of each half-wave cycle (8ms~ in US). If dimming is set to 0 we will delayMicroseconds almost the full duration of the half-wave cycle, this is problematic as other interrupts then queue and eventually a long queue may lead to an undesirable phase shift. Later today I will try testing a method where the interrupt just sets global volatile vars which used in loop method to achieve the same effect using delay instead of delayMicroseconds which should free up time for other firmware interrupts. I will report on the characteristics of this second approach once achieved.
Assuming you wired everything up correctly there could be two possibilities that come to my mind. 1) Your power supply is not providing enough current which could lead to the interrupt being slow and unresponsive. 2) Noise on the crossover signal line causing a false positive on the voltage rise trigger. If you have a scope you should graph the +5v line, the interrupt signal line and triac signal line to try and isolate the fault.
Also double check the bridge is fully rectified and not half wave which I imagine (but am not sure) would result in visible on/off pulsing of the lamp.
OscilloPhone: Use your Smartphone as an Oscilloscope / Signal Generator