# Digital dimmer with microcontroller

1. ## Digital dimmer with microcontroller

Hi, I have found below circuit for a digital dimmer by microcontroller. Can anybody analyze this please? How does triac changes the amount of bulb's intensity?

•

2. ## Re: Digital dimmer with microcontroller

As it is, it can only turn the lamp on or off but not dim it. To allow dimming it would use phase control and need to synchronize the microcontroller signal with the AC input.

The usual method is to use zero crossing (ZC) detection, this is simply means a signal is produced so the microcontroller knows the point where the AC waveform reverses polarity, in other words when the AC voltage passes zero as it changes from positive to negative or negative to positive. Remember that a triac like the BT136 has to be triggered but once it has been triggered it stays conducting until the current through it drops to almost zero. So if you trigger it just after zero crossing, it stays conducting for the whole period until the next zero crossing. If you delay triggering it, the first part of each cycle will pass without it conducting so the effective power it can pass to the load (the bulb) is reduced.

Knowing when the zero crossing occurs, the microcontroller can calculate a trigger delay from almost immediate to almost the end of the half cycle so from almost nothing to full power can be passed to the load.

Brian.

•

3. ## Re: Digital dimmer with microcontroller

Originally Posted by betwixt
As it is, it can only turn the lamp on or off but not dim it. To allow dimming it would use phase control and need to synchronize the microcontroller signal with the AC input.

The usual method is to use zero crossing (ZC) detection, this is simply means a signal is produced so the microcontroller knows the point where the AC waveform reverses polarity, in other words when the AC voltage passes zero as it changes from positive to negative or negative to positive. Remember that a triac like the BT136 has to be triggered but once it has been triggered it stays conducting until the current through it drops to almost zero. So if you trigger it just after zero crossing, it stays conducting for the whole period until the next zero crossing. If you delay triggering it, the first part of each cycle will pass without it conducting so the effective power it can pass to the load (the bulb) is reduced.

Knowing when the zero crossing occurs, the microcontroller can calculate a trigger delay from almost immediate to almost the end of the half cycle so from almost nothing to full power can be passed to the load.

Brian.
Thanks for your answer. But I have a problem with this. When I set to near zero the delay for triggering triac the bulb doesn't have the full power and full light!! What is the problem!?

•

4. ## Re: Digital dimmer with microcontroller

It should have full power except for a tiny amount lost in the Triac itself but that is so small you wouldn't notice it.

Divide the problem into two. If you disconnect the trigger signal from the micro and wire the input pin directly to the micro supply (5V/3.3V) what happens then?
With the optocoupler LED lit all the time it should give full power to the lamp, if it doesn't, you have a problem on the AC side of the circuit. If it does, there is something wrong with the trigger signal. Try the experiment to see which is responsible.

Brian.

5. ## Re: Digital dimmer with microcontroller

Hi,

There is a lot of information missing.
Do you use zero cross detection?
Where is your code, or at least a flowchart?

Thanks for your answer. But I have a problem with this. When I set to near zero the delay for triggering triac the bulb doesn't have the full power and full light!! What is the problem!?
You talk as if you use a transitor that can be switched ON and OFF at random times...but you use a triac, you have to synchronize to mains frequency.

Klaus

6. ## Re: Digital dimmer with microcontroller

Originally Posted by KlausST
Hi,

There is a lot of information missing.
Do you use zero cross detection?
Where is your code, or at least a flowchart?

You talk as if you use a transitor that can be switched ON and OFF at random times...but you use a triac, you have to synchronize to mains frequency.

Klaus
Yes I have a circuit for detecting zero crossings. in the code after any rising or falling edge of the output of zero crossing I set a delay and after that delay I enable the trig signal for a while to switch on triac.But when this delay is near zero I should have the full power delivered to the bulb but it doesn't!

•

7. ## Re: Digital dimmer with microcontroller

Hi,

do you have a scope? (If not: sooner or later you need to buy one)
--> measure zero cross signal and triac firing signal in one scope picture.

Klaus

--[[ ]]--