Just my 2 cent (having done a theatre scene lightning system in the past)
1) if you have the time line between the 2 ZC divided equally the light levels will not be linear but 50% of time will be 50% of light. Where the magic? The light level is linear with the area of the sine part of period your triac is conducting so you have to divide the area in 255 units not time. This is true for every filament lamp. I think here the prop built-in sine table will help you without the need for other tables. At that time the system mcu was an 8051 controlling up to 1024 channels so the conversion (lookup table) was made in eprom (address in, data out) and the triac trigger with latches, counters and comparator to unload the mcu
2) your ZC is to late. Your code should start working from the second ZC: from the first two you know the frequency so you can calculate the advance firing time. The ZC is not really 0V since you have to wait for at least for the led forward voltage level and a propagation delay so you receive a delayed signal.
3) when the filament is cold (off) you will lose the resolution on the low level so usually you never dimm to 0. Instead you keep the filament hot. You have to see the filament slightly red but not enough to emit light. This way you are able to dose the light at low levels.
4) I suggest you move to reverse phase control (eg. using an igbt in place of the triac) and add these benefits:
it only seems a bigger cost since you have to ad a bridge rectifier more but at the end you save the costs (and space) of the triac snubber circuit and emi filters
you do not need to compensate for the ZC delay (advance firing)·since the light turns on after the bridge·diodes forward·voltage (you loose 0.5% of light level on bridge but non noticiable)
with a shunt in series with the igbt you have overcurrent/short protection (never fry the igbt).
As opposite to the triac with the igbt you start light at ZC because you can control its stop:
that means that the current starts rising slowly with the line voltage (no current edge at mid period) so you have much less emi
for the same reason with shunt circuitry you can force the igbt off in time if the current is to high (overload or short on the line) preserving the igbt (as opposite the triac once fired cannot be shut off so it will be destroyed). To better explain this: with such circuit you can turn off the light by placing a short on the line (you are still PWMing the igbt) and when you remove it the light turns on again - dimmer not damaged
For further developments you should now that you have made the first step into "sine-wave" dimmers world
PS: for ICs that have internal protection diodes you can connect the gnd to the line neutral and the IC input through 2 series (1M/1M5) resistors directly to the line live: this is your ZC signal - line frequency (need to compensate the VIH treshold). The same can apply in a safer way to the secondary of your power supply transformer if any (with lower resistors)
Comments
1) if you have the time line between the 2 ZC divided equally the light levels will not be linear but 50% of time will be 50% of light. Where the magic? The light level is linear with the area of the sine part of period your triac is conducting so you have to divide the area in 255 units not time. This is true for every filament lamp. I think here the prop built-in sine table will help you without the need for other tables. At that time the system mcu was an 8051 controlling up to 1024 channels so the conversion (lookup table) was made in eprom (address in, data out) and the triac trigger with latches, counters and comparator to unload the mcu
2) your ZC is to late. Your code should start working from the second ZC: from the first two you know the frequency so you can calculate the advance firing time. The ZC is not really 0V since you have to wait for at least for the led forward voltage level and a propagation delay so you receive a delayed signal.
3) when the filament is cold (off) you will lose the resolution on the low level so usually you never dimm to 0. Instead you keep the filament hot. You have to see the filament slightly red but not enough to emit light. This way you are able to dose the light at low levels.
4) I suggest you move to reverse phase control (eg. using an igbt in place of the triac) and add these benefits:
PS: for ICs that have internal protection diodes you can connect the gnd to the line neutral and the IC input through 2 series (1M/1M5) resistors directly to the line live: this is your ZC signal - line frequency (need to compensate the VIH treshold). The same can apply in a safer way to the secondary of your power supply transformer if any (with lower resistors)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· Propeller Object Exchange (last Publications / Updates);·· Vaati's custom search
www.parallax.com/tabid/706/Default.aspx
I've been using it in a dimming project I'm working on (64 channels) and it works well.