DIY Trailing Edge Dimmer

Introduction: DIY Trailing Edge Dimmer

About: Awesome Electronics Tutorials, Projects and How To´s

In this project we will have a closer look at the electrical challenges AC LED light bulbs offer when it comes to dimming them. That means I will tell you a bit about how they are built and we will also determine the differences between leading edge and trailing edge dimmers. At the end I will then show you how to create a DIY trailing edge dimmer that you can even build at home for cheap. Let's get started!

Step 1: Watch the Video!

The video gives you all information you need to create your own DIY trailing edge dimmer. During the next steps though I will present you some additional information.

Step 2: Order Your PCBs/Components!

Here you can find the links to my EasyEDA files, where you can export the gerber files and thus order the PCBs:

https://bit.ly/2WHUibn

https://bit.ly/2WMFM2b

Here you can find a parts list with example seller (affiliate links):

Aliexpress:

1 x ATtiny85: https://s.click.aliexpress.com/e/_dSJ49k7

1x HI-Link 12V Power Supply: https://s.click.aliexpress.com/e/_Bfh98tiB

1x 1206 Resistor kit: https://s.click.aliexpress.com/e/_dZ3BhPt

1x 1206 Capacitor kit: https://s.click.aliexpress.com/e/_BfgJpGwj

Ebay:

1 x ATtiny85: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x HI-Link 12V Power Supply: http://rover.ebay.com/rover/1/711-53200-19255-0/1...

1x 1206 Resistor kit: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x 1206 Capacitor kit: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

The rest of the components you can find in the schematic for the project. Feel free to order them from your favourite electronics supplier.

Step 3: Solder All the Components!

Now all you have to do is to solder all the components in place on the PCB. At this point the FL5150 circuit is done. But for the ATtiny dimmer you will need to follow the next step.

Step 4: Upload the Code!

Here you can find the code that I created for the ATtiny85. Upload it with your favourite ISP programmer.

Step 5: Success!

You did it! You just created your own DIY AC Trailing Edge Dimmer!

Feel free to check out my YouTube channel for more awesome projects: http://www.youtube.com/user/greatscottlab

You can also follow me on Facebook, Twitter and Google+ for news about upcoming projects and behind the scenes information:

https://twitter.com/GreatScottLab

https://www.facebook.com/greatscottlab

Be the First to Share

    Recommendations

    • Sculpt & Carve Challenge

      Sculpt & Carve Challenge
    • Eggs Challenge

      Eggs Challenge
    • Backyard Contest

      Backyard Contest

    38 Comments

    0
    Nitz
    Nitz

    Question 18 days ago on Step 5

    Hi, Thanx for the project. I have a few questions. I tried making the project with attiny 85.Though i used mosfet JCS2N65VC, it is rated for2A. It works perfectly fine with 12W LED bulb, though Q2 heats up a little while Q3 doesnt.
    1. Why have you used IRF 840 mosfet(8A), though our requirement is very low for LED Bulb?
    2. Why is Q2 Heating ?
    3. I tried using 100W bulb, but immediately Mosfets heat up & blow off even though 100W bulb will draw a maximum of 400mA? If i need output load of 500W Bulbs, what modifications are required?
    Thanx

    0
    19cool53
    19cool53

    Tip 4 months ago

    Sorry. I forgot the rectifying diode for the 12v supply. (see schema)

    attiny-dimm4.png
    0
    19cool53
    19cool53

    4 months ago

    I like this well looking, few components design. Nevertheless, I would like to suggest a few
    (so far not tested) changes that came up while studying the schema:

    1:
    Isolate the mains part from the controller part.
    The 12v GND is connected to both IRF840's and to the 5v power ground. Thus, we will have mains connected to the controller part, including its potentiometer and - perhaps - a metal axis.
    To avoid it, replace the 7805 by a separate 230 AC / 5v DC power supply.
    (see aliexpress.com : AC-DC 5V 700mA 3.5W Precision Buck Converter AC 220v or similar)
    (GNDREF is not connected to GND !!!)

    2.
    Generate the 12v supply by a RC-Zener combination. (see attached schema).
    The 12v supply is only needed to drive the mosfet gates. This type of supply is seen in timer power line switches and could easily provide the 5v power, however that would eliminate the isolation.

    3.
    Allway's add pullup resistors on inputs.
    The relatively high impedance may cause jitter and false interrupt firing, as mains will never provide a perfect sinus wave. You may also add a small capacitor between interrupt input and ground. (see schema)

    4.
    Add a serial resistor to the mosfet's gate to protect it.
    This will avoid overcurrent and reduce dI/dt a bit. (see schema)

    5.
    Add a snubber R-C couple. (see schema)
    Depending on the wire lengts and the load (vent), you may have a nice inductance that will produce high voltage spikes while switching off and may very well destroy your fet's.

    5.
    Instead of a potentiometer, you can use touch sensors (TTP223).
    This sensor will work even from behind a plastic or glass cover. Using 2 sensors: one to
    increase and another to decrease power level.
    ( see aliexpress.com : TTP223 Touch Key Switch Module )

    6.
    Flip mains live (P) and neutral (N) and add a hard switch.
    The lamp is allways connected to the live (P), even if switched off. This can be misleading dangerously. Flip live (P) and neutral (N) but keep the fuse in the live line. This will connect the lame to the neutral line while switching switch P->L instead.
    Add a hard switch in the live line that really switches off. The switch can be combined with a fuse holder.

    AC230v - DC 5v-0.6A.pngTTP223 touch.png2022-04-04_14-14.png
    0
    edwindebock
    edwindebock

    6 months ago

    For the circuit with the attiny , should it be possible to use a B1212S-1W as dc - dc isolator so that the 12V of the DC circuit is isolated from the AC voltage?
    Or after looking further U5 can be replaced by APV1122 to have an isolation.

    0
    shekhar.singh.us
    shekhar.singh.us

    8 months ago

    Can you upload the code for Arduino Nano.

    0
    kazemzahedi
    kazemzahedi

    Question 1 year ago on Introduction

    Hi Scott, Thank you so much for such a great video. I need to build a 12-volt ac version where AC input to the board would be 12-volts for dimming 12 volts dimmable LED's commonly available. I will be using a microcontroller and FL5150 IC. How can I modify your 120-volt version components to work with 12-volts ac Thanks again Kazem

    0
    sinderw
    sinderw

    3 years ago

    Hi, I wanted to know what is the point of using an optocoupler (U5) in the ATTiny version? The ground is common between the two sides and therefore the logic circuit is either riding on the neutral wire (not very safe) or on the live wire (well, not safe at all)

    0
    afagard
    afagard

    Reply 2 years ago

    how do you plan on switching the load without an opto? what you are saying would be true if there was no opto with a digital pin feeding a mosfet directly. the opto prevents this from being the case and provides a level of isolation if properly spec'd and designed. everything to the right of the opto is isolated in this schematic. unless i'm not understanding you correctly?

    0
    TT-392
    TT-392

    Reply 2 years ago

    sinderw is right here, sure the optocoupler provides a little transistor that might help in driving the fet. But it provides no isolation because the ground and 12V of the low voltage side are connected on the mains side. This actually makes it a really dangerous circuit because you are now working with a non isolated power supply. And yes, non isolated power supplies can be done safe with proper potentiometers made for mains applications or when you are using a wireless system. But that is clearly not the case here.

    0
    afagard
    afagard

    Reply 2 years ago

    Idk what I was looking at, but you guys are totally right. Damn that is dangerous.

    0
    TT-392
    TT-392

    Reply 2 years ago

    The dangerous part isn't even really the mains going through a pot. This
    can actually be done safely with a proper pot and casing, or I guess rubber gloves. The dangerous part is that at first look, you can very easily mistake the circuit for a safe isolated one.

    0
    LinY2
    LinY2

    Reply 1 year ago

    yeah, he should have added a dc dc isolator

    0
    MrinmayD2
    MrinmayD2

    Reply 3 years ago

    True. Really dangerous with mains running through the pot.
    BTW if the circuit is running AC mains through all of it, why not use capacitor voltage dropper as power supply

    0
    oschonrock
    oschonrock

    Reply 2 years ago

    I noticed this problem too.

    The issue here is that if you're going to use the 12V Power Supply GND as the center of your MOSFETS then you shouldn't / can't use that same GND for the uC side. ie the 5V power supply must not be just an voltage regulator cut down version of the 12V with the same ground. You must have a separate isolated 5V and 12V.

    This always happens when you meed to switch high side MOSFETS I think. So you always need a whole isolated separate power supply. Alternatively there are specialist MOSFET driver ICs with bootstrap capacitors that can do this kind of thing. Not an expert on those yet.

    But this circuit is dangerous and should not be used like that.

    0
    afagard
    afagard

    Reply 2 years ago

    mains isn't running through the pot... the pot isn't even on that circuit...

    0
    theboy007
    theboy007

    2 years ago

    What is the value of the fuse you use? did you picked this based on the max amount of current that is allow to flow trough the IRF840? ( from project: https://bit.ly/2WMFM2b)

    0
    Puputo2
    Puputo2

    2 years ago

    Hello guys!
    In the FL5150 circuit I can see Scott dimming the bulb using just one pot, what does the other pot do?
    And would be possible to remove the leadig edge option? I mean remove the switch and every component needed for it.
    Thanks!

    0
    kurtosbrasil
    kurtosbrasil

    Reply 2 years ago

    in simple words, point zero or offset

    0
    j.tauscher87
    j.tauscher87

    Reply 2 years ago

    In the datasheet you can find it as offset pot (Roffset).

    Unbenannt.PNG