AC dimming with PWM and Arduino

dim-lampAlmost 3 years ago, I published a simpel TRIAC AC dimmer for the arduino. That proved to be a very popular design. Yet in spite of the simplicity of the circuit the software needed was a bit complicated as it  needed to keep track of the  zero crossing of the AC signal, then keep track of the time and then finally open the TRIAC.
So to avoid  letting the arduino just wait for most of the time, an interrupt and a timer were necessary.

So why can’t we just use PWM, like with LED’s? Well, I explained that in that instructable, but there are possibilities to do that. Someone looking for that would no doubt end up at  design by Ton Giesberts/Elektor Magazine that can do PWM of an AC source.

That will work, but in spite of my admiration for Giesberts and Elektor, there is something fundamentally wrong with that circuit. I think it is necessary that I explain what is wrong before I come up with improvements.
If you are not interested in the technical details, just skip to the next step.

GiebertsAt first glance, it seems like a complicated circuit, but we can bring it back to 2 or 3 components:
A lamp, and a switch, but as in fact the switching is done in DC rather than AC, it becomes a  lamp, a bridge rectifier and a switch.
That switch, which is in fact the MOSFET and the components around it is controlled by the Arduino (or PIC or whatever). So, switching that on and off in a certain duty cycle will switch the lamp on and off and if done fast enough the lamp won’t be seen anymore as flickering, but as being dimmed, similar as we do with LED’s and PWM.

So far so good. The theory behind the circuit is sound. However, the MOSFET needs a voltage on its gate to be switched on and as we cannot get that from an arduino for obvious reasons (it is only 5 Volt, which isnt enough AND you don’t want your arduino  to be connected to the mains grid), Giesberts uses an optocoupler. That optocoupler still needs a DC voltage and Giesberts is using the to DC rectified AC voltage for that.

giesberts2And that is where the problems start, because he is  feeding the gate from the MOSFET, with a voltage that is shorted by that same MOSFET. In other words, if  teh MOSFET is  fully opened the DC voltage coming from the rectifier is completely shorted. Therefore there will be no voltage anymore to put on the gate and the MOSFET will block again.
This effect might not be so outspoken by a low dutycycle (= lamp on a low intensity), because of the presence of C1, that will retain its charge for a while and will be receiving new charge thanks to the low dutycycle, but at 25-80% dutycycle the voltage on C1 just cannot be sustained anymore and the lamp may start to flicker. What’s worse is that at moments that the voltage on the gate drops,  for a while the MOSFET will be still conducting, but not be fully  saturized: it will slowly go from its nominal 0.04 Ohm resistance to infinite resistance and the slower this goes, the higher the power that needs to be dissipated in the MOSFET. That means a lot of heat. MOSFETS are good switches but bad resistors. They need to be switched ON and OFF fast.
Currently the circuit heavily relies on D1 to keep the voltage on the gate of T1 at acceptable limits while the voltage is swinging between 0 Volt and Full peak
At peak the rectified voltage is 230×1.4=330V
The average rectified voltage is 230×0.9=207V

If we forget about the smoothing effect of the capacitor for a while and presume the optocoupler to be fully open the average voltage on the capacitor would be 22/88 * 207 =52 Volts and in peak 22/88 * 330= 83 Volts. That it is not is because of D1 and the fact that the MOSFET will short the Voltage.

If the optocoupler is not in saturation and its impedance therefore infinite, the capacitor C1 would charge up to full rectified voltage if not for D1.  On average 3mA will  flow through R3,R4 and R5 (207-10)/66k which equals a power consumption of 0.6 Watt  in the resistors R3,R4, R5

Improvements
giesberts3The problems mentioned with the Giesberts circuit can be remedied by putting the lamp somewhere else: remove it from the AC line and put it in the Drain of the MOSFET. For the lamp it doesnt really matter if it is receiving DC or AC. You could make more improvements, as now there is no need to cater for a a voltage swinging between 0 and 330 Volt

But as we are changing the design, we might as well take it a step further and use an IGBT (Insulated Gate Bipolar Transistor) Simply put, an IGBT is a device that is a MOSFET at its gate and a bipolar transistor at its Collector and Emitter, making it an ideal switch. Thus we can come to the following circuit:

igbt-mosfet1The IRBT acts as a fast switch that either switches  the lamp on or off. It needs about 12 Volt on its gate to do  that. The voltage divider R1/R2 should put about 13-15 volts* max on the Gate of the IGBT, switching the lamp fully ON. As there might be some fluctuations on the grid 4k7 is a safe value. If you want to be safe, make sure you have an IGBT with a Base Emmitter  breakdown voltage of >= 20 Volt and put a zenerdiode of 15 V parrallel to R2. Possible IGBT’s are IRGPC40W or IRG4PC30, but basically any will do provided they have a Base emmitter voltage rating of at least 20 Volts
When the optocoupler receives a signal, it  opens and pulls the voltage on R1/R2 to zero, effectively closing the IGBT. The PWM signal of an Arduino is faster than the 50Hz  Frequency so you will basically see the PWM signal modulated on the 50Hz rectified sine wave, making the effective voltage lower.
This circuit is ONLY for incandescant bulbs. It is NOT for any inductive load as it is DC biased. With regard to the capacitor C1, I have tested it with 100uF but will probably work with lower capacity as well.

ac-pwm

  • Although the average voltage will be 230*0.9, C1 may eventually charge to 310-330 hence 4k7 is a safe value.

 

igbt-mosfet2 (1)

However, if you add the zener, you dont really need the 6k8 resistor anymore:

mosfet-pwm

With regard to MOSFETs vs IGBTs  both have their pro’s and con’s and the voltage and switching rate this circuit is operating under may just be in an overlap of both spectra. Using a MOSFET rather than an IGBT is therefore possible. MOSFETS are generally also cheaper than IGBT’s. A tried and tested MOSFET is the STP10NK60Z  (Thanks Pavel). This MOSFET has a gate-source breakdown voltage of 30 Volt and has clamping diodes protecting the the gate. MOSFETs usually need a bit of a higher voltage than IGBTs  to switch so a 6k8 resistor should be fine. If you use a MOSFET without clamping diodes a zener of 15 Volt is advisable

Note: Peak and average voltages are calculated with the following formulas:
CodeCogsEqn (2)

CodeCogsEqn (3)

Thus for 230 Volt Vp=323.86 Volt and Vavg=206 Volt

Video here

Heat development:
I tested this with a 60 Watt lamp at full brightness, without any heatsink: the temperature rose with 9 degrees above ambient after half an hour and an hour.
Then I tried with continous dimming from zero to full and back again.: The temperature rose with 10 degrees above ambient after about 10-15 minutes and stayed like that for the hour I tried.

With a 150 Watt halogen spot the temperature went up 15 degrees. It reached max temperature after about 10 minutes and then stayed the same for the hour tested.

This was measured with a DHT11 sensor directly clamped to the MOSFET

Advertisement

128 thoughts on “AC dimming with PWM and Arduino”

  1. Hi, thanks a lot for this. I made the elector design and had much problems with it. It only regulated a small range and the FET got really, really hot. I tried a lot of suggestion but nothing helps. I made the change you propose and that is really not more than putting the lamp somewhere else and now it works great. You are great

  2. Hi, thank you very much for this design, I am a little noob in hardware design so i got to ask, how much load can this circuit handle, I have 5 incandescent 100 W bulbs in series and I would like to know if this circuit is capable of handling it, its on 127V at 60 Hz, Thank you.

  3. Hi, thank you very much for this design, I am a little noob in hardware design so i got to ask, how much load can this circuit handle, I have 5 incandescent 100 W bulbs in series and I would like to know if this circuit is capable of handling it, its on 127V at 60 Hz, Thank you.

    1. if you have 5 bulbs in series and these bulbs are standard 127 Volt bulbs, they may not give much light.
      much depends on the IGBT that is being used and the heatsink you are using.
      If for instance you are using the IRG4PC30, that has a maximum current of 31 amps so ideally that could be used to switch 31×127 Watt if properly heatsinked.
      However, it can only dissipate 100 Watt. As the Vce on is 1.59 Volts at full power (31 Amps) that would be 42 Watt, so that would be OK.
      Keep in mind though that when the temperature rises to say 100 degrees, the max collector current is only 17 Amps, So I would definitely not go above that, but that is still 890 Watts
      Your 5 100 Watt lamps however will not put out 500 Watt as you have them in series. To get 500 Watt from it you need to put them parallel.
      If you put them in series they will put out much less
      At 127 Volt your lamps will draw 0.78 Amps. That means they have a resistance of 162 Ohm.
      If you put those in series that will be 814 Ohm. On 127 Volt that will only be 20 Watt for all of them together. Really no sense in putting them in series. Put them parallel

  4. I have problem with this circuit. I made it and tried to use for two 100 W incandescent bulb and I used very big heat sink for IGBT, but IRG4BC40UP was destroyed after half hour of working. I also used MOSFET IRF840 and it was destroyed too. I dont know what is the problem.

    1. I am not really sure how that happened. did you use the MOSFET in the same circuit as the IRG4BC40UP? (I did not test it with a MOSFET)
      did it happen af full blast or at a dimmed value? Did it regulate correct until you blew the components?

    2. I gave it some more thought and pulled up the datasheet. I am using a 4PC30, you are using a 4BC40 but that really should not be the source of the problem.
      Your IBGT can take 12 Ampere so no way could that have killed it, So the only thing I can think of is that Heath killed it (read power dissipation).
      I have pulled up my circuit again and ran that with a sinusoid PWM value for about an hour with a 100 Wat lamp. Yes gets fairly hot but was still going.

      Your IBGT should be able to dissipate 160 Watt at 25 degrees but that quickly diminishes once the IBGT gets hotter (only 65 Wats at 100 degrees).
      the dissipation as you probably know has nothing to do (or at least not much) with the Wattage of the lamp but everything with the speed of switching. Ideally the IBGT works as an ON/OFF switch so it is either fully open and should not dissipate that much power, or fully closed and then it should not dissipate much power either.
      Teh danger is in between if the switch doesnt go fast enough there is period in which the IBGT acts as a resistor and then it can dissipate power.
      The VCEon is 1.5 Volt so even at 200 Wat (lets say that takes 1 amp) the dissipation in the IBGT is only 1.5 Watt.
      If the gate voltage is too low, the max collector emitter current is limited and the dissipaition goes up, but even then I reckon it is about 20 Watt that gets dissipated.
      Can you get me the following measurements (without IGBT) if you do not put a signal on the entrance, then what is the voltage over R2? Then please put 5 Volt on the entrance and measure again over R2.
      Please let me know

  5. Hello
    Do you know some other dimmer circuit for dimmable lamp not for usual bulb? For example for OSRAM LED Parathom Pro 12W 650lm ?

  6. Hi. As I understand, simply applying PWM and switching AC loads on and off will not lead to predictable dimming so we need to detect zero crossings. You have explained this well in your blog 3 years ago. I wonder how this design works without having a zero crossing detector. Please help me understand.

    1. The difference is that in this case you feed the lamp with a DC voltage (albeit one with some peaks) So there actually is no zerocrossing. Also The IGBT unlike a triac will not switch off.
      With the triac dimmer, one would open the Triac somewhere within the sinusoid cycle. As soon as the zerocrossing occurred, the TRIAC would switch itself OFF.
      With a frequency of 50Hz the full cycle length is 20mS. In that period there are two zerocrossings: for the upgoing wave and for the downgoing wave.
      If you would set the ignition to wait till 5ms after each zerocrossing (so at the top of either the positive or negative cycle), The TRIAC would be ON two times during the full cycle and get half of the full power (AreaUndertheCurve).
      Because the IGBT doesnt switch off on a zerocrossing and ideally there is no zerocrossing in DC, it doesnt really matter when you ignite it.
      Now ofcourse if only using a bridge rectifier, what you get is a fluctuating DC voltage that in principle will be zero after each peak, but that doesnt matter because teh IGBT doesnt switch off so basically you will get a PWM modulated 50Hz fluctuating ‘DC’ in which at a set dutycycle of the PWM the Area Under the Curve will remain constant.

      1. Thank you for your explanation. However, there are a few things I still can’t figure out. If we use your new design, I can see that the lamp will indeed get a “DC” voltage. But if we use Giesberts’ original design, aren’t we still feeding AC to the lamp? So I’m thinking that both your and Giesberts’ design are working because both of you are not using a triac which as you explained is switching itself off at zero crossings. But if this is the case, then we could have chosen any switch that is not dependent on zero crossings such as a mechanical relay. However, nobody seems to be using it. Can you help me understand why?

    2. Sorry for my late reply. I must have missed yr comment

      For as far as my circuit goes, I feed the lamp with a DC voltage so PWM is not a problem.
      As far as the Giesberts circuit goes, that is because the 50Hz is modulated with a PWM signal so the area under the curve (brightness) diminishes.
      With the zerocross dimmer you get the dimming by delaying the ignition of the Triac, so if you want to have the lamp at say 1/2 strength, you ignite the triac at the top of the sinus (=halfway the cycle). To know that halfway point (or any other point on the sinus) you need to know when the sinus starts, hence the zerocross detection.

      With the PWM modulation if you want the lamp at 1/2 strength you dont wait till you reached the halfway point of the cycle, but you just start takingsmall pieces out of the entire sinus. With a 50% dutycycle that also gives 50% of the AUC. But in this case it isnt really important where on the curve you start as you take out small chunks all along the way. As long as the frequency is high enough it doesnt matter if you start at zerocrossing or a wee bit later
      This is only possible with a transistor and not with a triac as we cannot switch off a TRIAC, that is switched off when the voltage drops.
      As far as using a relay goes…:-) that just isnt fast enough but if you could switch a relay with a frequency of say 500Hz or more that would work

      Ofcourse this can only work if the PWM frequency is high enough and definitely way over 100Hz

  7. Thank you for the great explanation. Just some extra questions I have:

    – What type to use for D1, just a 1N4007 like in the original circuit?
    – what voltage rating should C1 have? 400V?
    – If I would use this circuit in a consumer product, would output filtering be required to meet emission standards?

    thanks in advance.

    1. a 1N4007 is ok
      400 volt for C1 would be fine
      if you use it in a commercial product (i.e. for sale) in EU or EEA you need CE marking to testify it meets health, safety and environmental standardsstandards, the exact requirements are in the as dimmers up to 1000Volt fall under the Low Voltage Directive (2006/95/EC) The electromagnetic aspects however are covered in Directive 2004/108/EC15, so you would have to check there. Wether it would qualify for self certificationor certification by a notified body i am not sure but the directives no doubt will give insight on that

      1. Thanks again for the clarification. I guess that reading the standards will give me more info.
        But just as a shortcut, I notice this circuit doesn’t have a big choke coil like the conventional triac-based phase-cut dimmer designs. Does it not need one because of the higher switching frequencies?

      2. I didnt find a need for a choke. I am no expert on switching but I guess it wouldnt hurt to add one. The PWM frequency of the Arduino is about 500Hz.
        keep in mind ythought that the TRIAC based dimmers work with another principle as they do phase cutting rather than PWM

  8. Nice design, really like it.
    I noticed PCB and schematic design are not the same.
    On PCB C1 is directly connected to Br1, but in schematic design it’s after D1.
    My guess is that PCB is wrong here 😉

    I was wondering. Do I understand correctly that it is in fact an inverted PWM?
    If arduino would give high signal, this dimmer switches off right?

    If so, is it done for the sake of simplicity?

    1. Arvin, Thanks. You are very very right. I usually build the circuit on veroboard before I design a PCB and in this case the PCB has a mistake. Thanksso much, I will correct it asap.
      It is indeed an inverted pwm. The main reason is speed. The voltage on the gate willl be made to switch between High and low faster therefore minimizing the transition phase in which the transistors C-E acts like a resistor, this minimizing the power dissipation in the Transistor.
      Thanks for yr remarks

  9. Hi, thanks for taking your time to write such useful article. Too bad that I found it just a day after I received my components for 20 dimmers I was going to make for my home based on the original scheme. Changing to IGBT would cost me quite a bit extra, so I think I will use your advice to work around the problems on the original scheme this time. One question though – I read it a couple of times in different places that incandescent bulbs (that are designed to run on AC) will have somewhat shorter lifespan if run of DC due to uneven filament wear and some other reasons that I don’t remember now. And Osram says this is especially big issue with halogen lamps (that I plan to use), where lifespan may decrease to 15% of the nominal value. So how about if I leave the bulb where it is (on AC) and put an extra smaller bridge rectifier to power up that “MOSFET driver” part of the circuit? AC input of this new bridge would come directly from mains (not through the lamp), negative output would be shared with the old bridge and positive output would go to D6 (sorry, don’t have my Eagle with me at the moment). It’s OK for me to add an extra component, if only this would solve the problems you described. E.g.: http://lt.farnell.com/multicomp/2w10mg/bridge-rectifier-1000v-2a-wobm/dp/1861433

    1. whether or not incandescent lamps or halogeen lamps have a considerably lower lifespan on DC as compared to AC I do not know. But what I do know is that cars/automobiles have 12V DC AND use halogen lamps as well. So I am not sure it is an issue, but at the same time I am sure Osram knows more abt halogen lamps than I do.

      A separate feed (which the extra bridge factually will provide should circumvent many problems of the original circuit. The bridge you linked to is really more than capable to deliver the few mAmps that circuit would require.

      Good luck. Would like to hear how you fare

      1. Thanks for encouragement, I’ll follow up as soon as I have something to show. And meanwhile, about lamps, I remember somebody asked same question about how come low voltage DC lamps (e.g. automotive) are OK, and the answer was “because they are made with thicker and shorter filament.” One of the reasons I remember why DC is not good for AC-designed lamps is that tungsten filament evaporates at one end (probably negative) more that on the other. When running of AC, these sides alternate and the filament gets thinner at both ends equally. In case of DC, one end gets thinner almost twice as fast as it would on DC and thus breaks sooner. And here’s more about halogen lights: http://electronics.stackexchange.com/questions/75330/what-are-the-effects-of-ac-vs-dc-for-an-incandescent-bulb-life Now I’m not sure if it’s all really true or just a plausible theory, but if just an extra bridge will take the doubts away, that’s cool for me. Thanks again!

      2. thanks, i considered that one end theory as well, but i just am not sure if it is true. Maybe it is, maybe it isnt, I just dont know. Thanks for the info

  10. Unfortunately, it didn’t work as expected. It took me a while to realize, that connecting negative terminals of both bridges actually shorts out the smaller bridge when the MOSFET turns on, effectively exploding it and ruining some other components on the way. I disconnected these “grounds” and it kinda works, but now there is some slightly visible flickering @100% duty cycle and even more visible when doing PWM. When I increased Arduino’s PWM frequency to ~4kHz it help a bit, but it’s still flickering. When I plugged the lamps directly to mains (just to make sure my eyes are not the main problem here) I found out that they where not even running at full power through MOSFET. So I suspect that issue might still be related to not having common ground and the MOSFET or optocoupler not turning on at some half of the mains 50Hz cycle? My competence kinda ends here, I’m in a dead end…
    Schematics: http://snag.gy/OwUmO.jpg
    Proof: https://youtu.be/DDO8fDWpmNo
    P.S I also thought, that maybe the caps are not able to keep up with the power demand to drive the MOSFET, so I replaced the C2 with 660nF and C1 with 100uF, but that didn’t help at all.

    1. Well there are several issues. Not having a common ground makes the MOSFET get a gate voltage that is kinda virtual. I am sure that maybe somewhere through the bidges and the mains there is some current flowing, but as it is it gets it gate tension of 10 Volts referenced to the the ground. But as the source MOSFET isnt connected to that ground it is a completely undefined voltage. Asthere probably is some pathway through the bridges, most likely you have a fluctuating undefined Gate Source voltage. from yr video it still looks reasonanly OK but there is definitely a 50Hz flicker.
      Increasing the capacity of the capacitor isnt going to help.
      What you could do, even if just as a proof of concept: do away with the seperate bridge and put the incandescent lamp in the DC line, acciording to the theoretical ‘inbetween’ modification I discussed and see what that does.

      Just to make sure that people just superficially scanning yr post dont understand wrong: This is about a DIFFERENT circuit than I proposed

      1. I did try your recommendation and it works perfectly through the whole duty cycle, just as expected. I think it’s a super-simple yet genius workaround. It’s just that I still hope to find a non-workaround solution that would allow me to keep the lamp on the AC side of bridge and up to 100% PWM. Especially that I am going to use it mostly on halogen lamps.

        I wasn’t able to get my hands on the dimmer for a while, so I downloaded this LTSpice simulator. It turned out to be much cheaper and safer way to verify new “ideas”. Unfortunately, none of them gave me constant 10V for PWM’ing MOSFET @ 100% duty cycle and in many cases (including the one that I tried in real circuit) even at max PWM before the “power deficit” loop begins the actual current through bulb was only ~50%, as it was obvious with naked eye as well. LTSpice showed me, that there is a variable potential difference between grounds of both bridges which probably is the reason of troubles. I tried different configurations, but had no luck yet.

        Now that I’m back to my circuit I also tried the original version (only now). It works OK up to the duty cycle of ~96% (very close to authors estimation, BTW) with the MOSFET reaching stable temperature in the range of 60-70 degrees Celsius. When going above 96% the “power deficit” game begins: lamp starts to flicker a bit, gets a little dimmer and transistor starts heating up, etc.

        Also, I found out that this circuit (in any configuration) can handle only low frequency PWM’s. ~500Hz was OK, 1kHZ was so so, and anything above 4kHz was not usable (lamp is either fully on or off). Intuitively, MOSFET should be able to handle such frequencies, so maybe the optoisolator is too slow? Will try to read the specs, maybe even understand something. Incandencent lamp @ 500Hz would probably be OK for the eye, but there’s an audible hum up to 75% PWM.

        Anyway, thanks for taking your time to bother!

      2. I am happy that workaround worked. and thanks for your feedback. The specs of circuits in this range make it a bit of a coin toss regarding a MOSFET or IGBT being better or not. Tou may find this article interesting. I would think that a MOSFET as well as an IGBT would be able to handle 4kHz. Oddly I couldnt find any info on cutt-off frequency in the 4n25-28 datasheet, nor that of the 4n32-33

        To avoid that other readers understand it wrong: This workaround is for a DIFFERENT circuit than i was proposing

    1. That is indeed correct albeit that abt half a Watt should theoretically ve sufficient. It is always good to have a bit of a larger dissipation capacity.

  11. It is also good idea not to leave optocoupler’s transistor base floating (it has some capacitance so it wont shut until it is discharged (not vital in slow operation mode) and also could be susceptible to EMI noise) and tie it to power ground with i.e. 100-200kOhm resistor.

    1. I haven’t really had that problem, but it definitely is a good precaution.
      Just a warning to those reading this: Put that resistor between Digital pin of your microcontroller and the Ground of your microcontroller DO NOT ATTACH TO THE HIGH VOLTAGE ‘GROUND’

      1. In this application its probably ok to leave it floating, if pwm frequency does not exceed couple of kHz. You definitely don’t want to connect high voltage side to signal side, so probably its best to leave base in the air (although i connected it through 100kOhm resistor to emitter w/o blowing anything up)

      2. I didnt think you would blow anything up.Just wanted to make sure that people with less experience dont connect the resistor to HV 🙂

  12. Another thing I was thinking of – is it ok to switch on the transistor when there is no current flow (during zero cross)? I red somewhere something about quasi-saturation losses in this case. Can it be the source of the problem “dragan” had? Easy solution to this is to put another capacitor acros +/- leads of the rectifier bridge. (I have encountered same problem, will try my theory when I replace dead igbt)

    1. I am not sure if it will be. if yr pwm frequency is higher than 50Hz it will not help and if it is lower than 50 Hz it is close to strong flickering already

  13. One last thing (I promise), current configuration of the divider r1-r2 in ideal conditions (phase voltage ~310v) provides base of the igbt with ~19v, it is really near the absolute maximum V(Ge) rating of the igbt used in current schematics (20v), but power grid is not an ideal place, under/over-voltages is pretty common thing (not talking about sudden spikes). So it would be good to protect base of the igbt somehow, clamping 12v zener in parallel to the R2 against base over-voltage, and small inductor in series after r2 probably – against spikes (although it will be hard to chose its value to effectively filter out input spikes of the grid without to much of trouble provided by its own spikes during on/off transition)?

    1. indeed, configuration is always a bit difficult with a pulsating DC voltage. The 310 Volt is in fact peak voltage. A zener would perhaps be a solution. 12 Volt may be a tadd too low for some IGBT’ s so maybe a 15 Volt might do better.

      As said the 310 volt is peak, with the average voltage being 0.637 x Vmax

      1. yep, but C1 is pumped to the max phase voltage (input pwm freq and capacity of the c1 affects – will c1 be charged to the max or not, but as usual in electronics lets assume the worst case scenario). As for myself, I solved problem without modifying the schematic by replacing IGBT with a slight cheaper MOSFET STP10NK60Z with clamping zener inside (btw, even though i have this mosfet in an insulated to-220 package on a small ~10w heatsink, on a 200w load the heatsink to the touch is not even slightly warm).

      2. Pavel, in principle it can be done with a MOSFET as well as I discussed in the article. Reason for me to go to an IGBT is because in general they are seen as better switches, but the voltage range in which this circuit works makes it a bit of a draw. I wouldnt dare say the IGBT is better in this case. Please be carefull touching the heatsink, even though yr mosfet is insulated 🙂

  14. Thank you so much for this, I didn’t really understand the technical part but it seems that old design will overheat and have flicker problems, if am getting things correctly

    Here I have a problem with new design, which is that non of lamb terminals is connected directly to AC source, while in normal home, 1 terminal is connected directly to Neutral line through wall and other terminal is accessible through switch. I mean I can only access 1 lamb terminal in home and thus can’t apply modification you suggest. Is there any other design that will work without flickering or overheating and still solve this problem? Thank you so much.

  15. Hi, thank you so much for this

    May I ask if there is any circuit that works with no problem and still uses only 1 terminal of lamb while other is connected to AC source directly? In normal home application, 1 lamb terminal is already connected to Neutral line through wall and it is not accessible easily (at least not in where I live), while we can only access the other terminal through lamb switch in wall, what is the solution for this? Thanks in advance.

    1. the traditional TRIAC dimmer is in fact in series with the lamp and uses two wires. In fact it can replace a switch

      1. The traditional TRIAC dimmer circuit doesn’t work well with me, I tried it on an arduino and it works great, then I tried it on ESP8266 module but lamb keeps flickering every few seconds, I chased software and found out that each time ESP detects zero cross and tries to fire an interrupt it takes some time, maybe because it tries to handle WIFI connection via interrupts also and this makes GPIO interrupt delayed to a number between 10 – 200 uS, I believe this (somehow random) delay makes lamb flicker!
        Using an arduino beside ESP module takes a lot of size that is not available inside wall in switches box, and WIFI connection is needed by default

        I tried something, which is buying a ready dimmer from market (it has a simple circuit of triac, diac and potentiometer for control) and tried replacing potentiometer with LED and LDR with shrink tube around them, then provide LED with PWM signal. This worked but the relation is highly nonlinear besides that if am on low PWM, lamb lights then within less than a minute it starts to dim more and shuts off, not sure why but maybe it is because of LDR non linearity? Like even with same lux value it still changes resistance since LED is feed with PWM?

        Any help in this project will be appreciated, and if I can contact you on Skype I will be thankful, I believe you are an expert in the area thus I will need your help in few things, will pay for that!

        Thank you

      2. so the traditional dimmer DOES work, it just doesnt work wel on your ESP8266 setup. So before we go any further , please let me know exactly what it is you are building. Is it based on Arduino or ESP8266

      3. Thanks for your reply, in fact am making a project that require further help than just posting comments, if I can know how to contact you we can work this out on Skype for example, am looking for paid help. How can I contact you please? My Email is xxxr@yahoo.com

        As an answer to your question, am trying to build my project on ESP8266, programming that using Arduino IDE, I got everything working (Am a very good programmer, but not that much good in electronics, this is because I studied IT not engineering). What am trying to do is to surprise my boyfriend by making our home lights controllable from mobile phone via internet, I made user interface and android program beside PHP server pages and programming ESP8266 with static IP address beside port forwarding (so basically I made all IT stuff work just great), but am having little problem in electrical circuit, as explained before, traditional triac works well with Arduino but flickers light with ESP8266 module which I wish to use because ESP8266 should handle TCP/IP packets which delays hardware interrupt and causes unstable output, at same time I don’t have access to both lights wires (only one), and small size needed for control device.

        Let’s sum this up:
        I shall use ESP8266 to make size small
        I have access to 1 wire only for light
        I can’t use interrupt based techniques

        So I wish to have a PWM based dimmer that works with 1 wire and does not overheat or cause problems

        Thank you so much!

      4. you are not really asking for the moon now do you? 🙂
        my skype is out. i will mail you

      5. No am not asking for the moon, just few stuff I need in electronics and will pay whatever it costs to make them! Simply I need AC DC converter that output 5V 1A continuous without heating, minimum ripple and very small in size, beside dimmer I discussed before and little consulting about some electronics

        Anyway am not sure why email does not appear fully, it writes xxx not sure why, here is my email: may dextar @ yahoo .com (without spaces)

        Thanks again

  16. Thank you for this tutorial. I wonder if I could control a 300w ceramic lamp with it. I tried with a similar diagram (the first or the seconds diagram of your tutorial I think) and a irf830. It started to burn and didn’t work.

    What you you think?

    1. yes you can if it is indeed a purely Ohmic resistive load.
      There is only one reason why an IRF830 (or any component for that matter) would burn: if it is pushed beyond its limits.
      I presume you are on 230 Volts, so your lamp draws about 1.3 amps and that should be no problem for the IRF830 as that can take 4 amps (at 25 degrees). Now when the temperature rises to say 100 degrees, it still can take almost 3 amps.
      However, the maximum power dissipation is 74 Watts and the RDSon is 1.5 Ohm. So when fully on the FET will dissiptae I² * R=2.5 Watt when fully OFF The Powerd dissipation should be close to zero so that is all OK
      However, when the temperature rises so does the RDSon to about 2.5 Ohms leading to a dissipation of 4.2 Watt.
      So that all is still OK,
      But if you have used the first or 2nd circuit, then you have used circuits that I warned about and that I just used as illustration of possibly problematic circuits:
      FETS make good switches but they make bad resistors. As I explained in the article, when switching a MOSFET on and OFF, if that doesnt happen fast there is a distinct moment in which the resistance of the FET goes from RDSon till endless. If this doesnt go fast enough the dissipation in the FET increases significantly.
      At the moment it is around 43 ohm the dissipation is approaching 74 Watt (for sake of ease I leave out that ofcourse the current goes down too, but you catch my drift I presume).
      Eventhough that is above the max rating, maybe for a brief moment that is not so bad, but if you use PWM (I think 500Hz for an Arduino), those small moments add up and the chip gets warmer (thermal resistance is around 60 degrees per Watt)
      The warmer a mosfet becomes, the lower its max ratings.
      Now the speed of switching doesnt depend on the frequency of the PWM, that just determines the number of times a MOSFET is switched.
      The speed is a combination of the MOSFET itself and the hardware it is in.
      The 830 is not a particularly fast MOSFET, but the circuit isnt really fast too. I will explain:
      The first circuit has two problems with regard to speed: the fact that the MOSFET actually shorts the voltage that is used to feed the gate and the larce RC constant feeding the gate.
      The second circuit only has the latter problem.

      So if one looks at that second circuit (the one without the great big red cross through it), one can see that there is a capacitor that is kept at 10 Volts with a zener. The moment however that there is a pulse on the optocoupler, that capacitor will provide the Vgs but is also discharged through the 22k resistor. So after 48mS the Voltage will have dropped to 37% of 10 Volts which means that in that 48 mS the Vgs dropped, increasing the resistance of the FET and thus increasing the Power dissipation and thus the temperature.
      Sure, the capacitor is being charged again via the two 33k resistors, but they form a larger RC time and it takes 145mS to charge up till 63% of 6 Volts.
      This means that during switching the Vgs is below the nominal 10Volts for a considerable period of time, leading to increased dissipation and junction temperature.

      Now someone will say, yes but when switching at a 500 Hz cycle the period is 2mS so there just is no time for the capacitor to drain till 37%. True, but even at a 5% drop (Vc=Vs*e⁻⁽t/RC⁾=10*e⁻0.04 =9.6) the resistance increases and thus the dissipation and thus the temperature.
      Once that goes up to 150 degrees, the max current is 0 and your MOSFET pops

      I didnt specifically mention the power derating (but defacto used it in my narrative), but it is about 0.6 Watt/degreeCelcius.
      That means that for each degree of temperature rise above 25degrees you need to decrease the dissipation with 0.6 Watt.
      So suppose your junction temperature is at 100 degrees that is an increase of 75 degrees and thus a need for 45 Watt less dissipation.
      So at that temperature your FET can only dissipate 74-45=29 Watt at a current of 1.3 Amp a mere Rds of 17 Ohm already would push the 830 out of its limits.

      1. Thank you for your answer. I haven’t had time yet to test the latest diagram, but I think I will have it this weekend. I am in Europe, so 220v and, in fact, I am using an arduino. I am sorry, I am not very fluent at english and I don’t completely understand your last couple of lines. Do you mean I won’t be able to make it working? Those electronic knowledge scape to my understanding although I think I more or less understand all of it.

      2. Paul. happy to be of service. Nothing wrong with your english. You asked about the Osram parathom right? back in december? I meant that i do not think it will work with this pwm dimmer but i think it will ork with my other circuit that is triac based

      3. I can’t answer to your comment, I don’t know why. Actually I am the other Paul, I asked some months ago about controlling a ceramic lamp about 300 watts with this dimmer design and the pwm output of an arduino. You gave a long and well detalied explanation. I tried to post my previous comment as an answer of yours, don’t know if you see well or I did it wrong 😦 I can’t answer to your current comment , maybe the coincidence of the names is mixing somethings here…

      4. ah yes. sorry, my bad.
        Yes I indeed gave kind of an extensive answer. What I tried to do is to explain/calculate what could have caused your FET to burn in using the circuits I used as example of how not to do it.
        The Most important thing in handling FET’s is speed of switching. every moment the gate of a FET is between 0 Volt and optimal gate voltage, the drainsource connection acts as a resistor rather than a switch.
        Now that doesnt mean you have to increase the PWM frequency, preferably not even, it all has to do with how fast the Vgate can be at its optimum. That is mainly determined by the powersource and the various RC constants that power source meets on its way to the gate.
        In my circuit the main RC constant is formed by the gate capacitance of the MOSFET and the 100k resistor. For the 730, the gate capacitance is 700pF. So to be on the safe side lets take 5RC for the capacitor to fully charge so that is 5×100.000×700*10⁻⁹ = 350uS. So your pwm could go to approx 2800Hz without entering in the saturation zone of the MOSFET.
        The Arduino PWM frequency is some 5-600 Hz I think so you wont have any problems there.
        Instead of a 100k, probably a 50 k would be OK too. That would cut your rise time in half to 175uS.
        It also means that the 100uF capacitor is likely grossly overdimensioned. A 10uF is probably more than enough
        No need for you to answer the earlier comment.. as you are the other Paul my earlier reply was totally irrelevant

      5. I just tested the last diagram. My capacitor just blew up. Well, it exactly created a fog in my room. I have one 100 mu F 100v. Is it not enough? White part is “+” in the diagram, isn’t it? I have to check if I have anything else wrong but it seems to be fine. Rest of components seem ok too.

  17. I was just thinking of building this, but was wondering how long C1 would take to discharge once the power is removed, so making it safe to handle ? Also perhaps having an LED as an indicator that it’s still charged?

    1. Well you could actually calculate that. Generally, a capacitor is discharged after 5T, in which T stands for the time constant of the RC network which is R*C. Say R=105k then RC=(105*1000*100)1000000=(105*100)/1000=10500/1000=10.5 sec. Thus coming to 50-52 secs
      You could add an led with a proper seriesresistor, that would not only indicate it was still charged or not but also help in the discharge.

      As my circuit worked right off the drawing table I didnt really feel the need to handle it, but it is always a good idea to be careful.

      1. Perfect, so I’m looking at about 50 secs, great and thanks for the reply.

      2. Indeed. Yet it is always good to be careful. I have gotten shocks from old TV’s, hours after being switched off that definitely had smaller capacitors… but maybe bigger resistors 🙂

      3. I built the dimmer. The 100K resistor gets a little warm (on 220v AC) but is fine, and i discovered that the light flickered a bit – so i increased the clock speed on the arduino to 980Hz (was 490Hz default) – problems solved. Again many thanks ….

      4. great. thanks for letting me know. Interesting that you increased the speed, as a matter of fact the clockspeed came up in a discussion I had with a fellow DIY enthusiast about the size of the capacitor, that we think can be drastically reduced if the clockspeed (of the pwm) does not get too high. 980Hz is no problem, certainly not with the 100uF. I plan to try some smaller capacitors. maybe even a 10uF is enough

  18. Hi, great work with your design. I have previously used the Tom Giesberts design on a 100w lamp and it worked quite well but unfortunately not so well on an inductive load. I read here somewhere that your design can’t be used on an inductive load either. What about if a snubber circuit is added? Or is there some other reason it can’t be used? I’m wanting to speed control a 240v 50hz 850w universal motor via PWM.
    Thanks,
    AJ

    1. Well the problem with an inductive load is that it often expects AC. My design uses DC on the load so unless it is a DC motor it would probably not work or get damaged.
      I also have a design that uses AC and zerocrossing. Also not perfect for inductive load but it does work and probably could work even better with pulse skip modulation

  19. Hi! Thank you very much for this post!

    I have a doubt… As I could control a series of three 9W LED lights already installed in a house with phase, neutral and return with this circuit?

    Thank you in advance!

    1. Well, it depends what you mean. A Phase and a Neutral is what you need, but what exactly you mean with ‘the return’?. Do you mean you have two wires going to the LED (The Neutral and the switch) but you have both neutral and phase available in yr wall socket?
      The reply is actually simpel: if you have a phase and a neutral in yr socket and you have two wires going to your Lamp you can use this, as long as you just follow the circuit if you have any uninterruped wires (either phase or neutral) you have to cut those.

      The circuit has 4 connections: Neutral and Live and 2 for the Lamp.
      As long as you have that, without any of those 4 wires being shared, you can use this.

      Having said that, this circuit is not suitable for all LEDs.
      LEDs that are directly connected to the mains usually have some electronics built in that doesnt respond to PWM

    1. yes, I know the board and at 15 usd it is not specifically expensive. Unlike the PWM dimmer I presented here it uses zcd and a TRIAC and in that aspect it is more like the dimmer board I published earlier on this site.
      The difference is that the mpdmv4 board is processing the zcd signal itself, while on my board the zcd signal is sent to the arduino for processing.
      I therefore suspect that the board has an onboard processor like an attiny or a pic. As i can see the board originates -coincidentally?- from the same country as you:-)

  20. Hey! Thanks for this really helpful, however i want to dim a 60watt bulb from 220V source instead, will this circuit work perfectly with it too?

    1. As a matter of fact my first try was with a 60 Watt bulb/220volt and that went very well

  21. Hi, i am still new in electronics but really interested in doing this dimmer. I am using Raspberry Pi to generate PWM to the optocoupler but the bulb doesn’t have any response, the bulb can be turned on but im not able to adjust the brightness, is this due to im using Pi?
    I am using a different IGBT but i’m not sure whether it is suitable, i provide the link to the datasheet here see if you can clarify for me: http://www.infineon.com/dgdl/irgp20b60pdpbf.pdf?fileId=5546d462533600a401535655a487243e
    If those suggested above are not the issues, can you do me a favor see if i connected anything wrongly on by breadboard? I would appreciate it very much!

    1. Sorry about your problems. I looked at your pictures but based on those I really dont dare to say the connections are or are not OK.
      Your IGBT should work, although it is not ideal.
      Now you say the bulb can be turned on. but that is not the work from the Raspi as the dimmer will normally be full on if no signal on its entrance.
      So please do the following, but be very careful as you are working with live high voltage
      1-Connect nothing to the entrance of the circuit and plug it in. The light should go on full
      2-unplug it, connect 5 Volt to the entrance and plug it in the grid again. It should be fully OFF

      Please do this and let me know

  22. Hi, would it be possible to just duplicate the IGBT and driver and put them in parallell behind the same single diode bridge to be able to dim two lights with just one diode bridge?

    1. yes. See that diodebridge just as the PSU. Make sure though that you have a decent strength diodebridge if you up the wattage

  23. Hi, would it be possible to duplicate the IGBT and driver circuit and put them in parallell behind the same diode bridge to be able to dim two lights with just one diode bridge?

  24. Hi again, sorry for the double post last time..
    What voltage rating would C1 need to have? I assume it doesn’t need to be X2-rated since the largest X2 available for purchase at farnell/element14 is 47uF and it’s huge and expensive..

    1. Indeed, no need for that being an X2. Mine is either 350 or 400 Volt, I forgot and I think it cost a dollar.
      nevertheless, I am quite sure even a smaller capacitor say 50uF would do.

      1. Thanks again for the quick reply!
        What do you think of this modification to the circuit to allow a regular small cheap 25V capacitor to be used and also to incorporate short circuit protection for IGBT:s?

        After doing some rough, uneducated calculations and guesstimations of the energy needed to open the MOSFET/IGBT and the discharge rate of the capacitor through R4 and into the MOSFET/IGBT gate I feel it would work but I’m not as good at this as you so I would love to hear your thoughts!
        R4 is intentionally chosen large to give the MOSFET/IGBT a soft turn-off to minimize spikes & EMI.
        R5, D5, D4, R6 and Q2 are for automatic turn-off at short circuit / overcurrent (from this appnote https://goo.gl/7QmYrl) but I’m not quite sure what values should be used.. I was thinking maybe R5 100K, D4 7.5V, R6 100K?

      2. Lars, sorry for late reply but somehoww yr message arrived in my spambox, but I think i already answered yr questions in a posting that did arrive

      3. Indeed you did! Thanks! I somehow often manage to double post on your blog, sorry for that..

  25. Thanks again for the quick reply!
    What do you think of this modification to the circuit to allow a regular small cheap 25V capacitor to be used and also to incorporate short circuit protection for IGBT:s?

    After doing some rough, uneducated calculations and guesstimations of the energy needed to open the MOSFET/IGBT and the discharge rate of the capacitor through R4 and into the MOSFET/IGBT gate I feel it would work but I’m not as good at this as you so I would love to hear your thoughts!
    R4 is intentionally chosen large to give the MOSFET/IGBT a soft turn-off to minimize spikes & EMI.
    R5, D5, D4, R6 and Q2 are for automatic turn-off at short circuit / overcurrent (from this appnote https://goo.gl/7QmYrl) but I’m not quite sure what values should be used.. I was thinking maybe R5 100K, D4 7.5V, R6 100K?

    1. Before I clicked, I already knew what your modification was and ofcourse I have considerd that as well. But there is a danger for your IGBT or FET. The reason for that is that you introduce a delay in reaching the gate voltage which is R1C1. Now that may only be an initial problem because contrary to my design you are not shorting the gate voltage, but I am not sure if at a higher PWM discharge of C1 going faster than recharge becomes a factor, but R4 may contribute to that. MOSFETS and to some extend IGBT’s do not like soft turn ons as they (especially the MOSFET) act as switches. A mosfet generally has a low RDSon when fully opened. If the gate voltage is below the proper voltage it is partly opened and starts to act more like a resistor than as a swich. Consequence….. HEAT.
      So what you need to do is to calculate the rate of discharge at a high PWM through the Mosfet/igbt and 4n25+R2+R4 and compare that with the charge rate through R1. As long as R1 can keep up with it you are good
      R1 being 5 times bigger than R4 that already gives you a handycap.
      Now add to that that C1 will also discharge through D5/R5 and the IGBT and it will do that quite fast as it is basically a short to ground (well ofcourse there is a Vce of about 2 volts). I am no expert on IGBT’s and I am not contradicting the application note, but a rising Vce as a function of the Ic is correct, as it points to on state resistance, but for a high (say proper) gate voltage that is initially a very steep curve, meaning that the Vce doesnt really increase that much with a large increase increase of Ic. It is still largely linear ofcourse, until it reaches a plateau.
      That means that the dimensioning of the safety circuit needs to be rather precise or it will not work, or increase the problem. Your proposed values are basically ‘guessing’ (that is ok… often, but not here ) and they may be different for different IGbt’s and Mosfets.
      You are introducing a number of extra components that could even increase/introduce new problems, just to avoid using a ‘bigger’ capacitor.
      I am also no expert on the 4N25 but the reason I used it in its shorting function (i.e. shorting the GateVoltage, rather than interrupting the gate voltage) is because I understood that was faster and allowed the voltage on the gate to switch faster. Whether that is true, I am not sure but fact is that my MOSFET hardly gets warm. Nevertheless, your placement of the 4N25 in combo with the placement of C1 is surely interesting.

      Anyway I would first try it without the protection circuit. Switch on several duty cycles and see how hot your IGBT gets (unplug everything before you touch it)

      1. Thanks alot for your thoughts! I will give my version a try and see how it works then 🙂

  26. Will this circuit work to dim LED Christmas tree lights? They are just a bunch of LEDs connected in series with a current limiting resistor. No electronics in them at all.

    1. if they are meant to connect directly to the grid, they most likely will, if they need a transformer they will not

  27. Hey Arduino,

    I have a chandelier that is 2000W and it has only incandescent lamps in it. My mains is 230V AC. So, the load current will be around 8.7A. Assuming I use a Bridge Rectifier and an IGBT that can handle 15A and I use the Arduino inverted PWM (w/o any changes to its frequency, which is ~500Hz) to control the switching, could you please advice on the following:

    1. The IGBT heating depends only on the switching frequency (as you have also explained in one of the comments) and not on load current. So, the IGBT should be able to handle 9A comfortably, right?
    2. The resistor R1 i.e 100k – do you have any idea of its behaviour when the load current is as high as 9A? I will be using a 1W 100K resistor. Does it need to be a higher power rating?
    3. Any idea if the circuit will still be stable for 12 hours of continuous operation at such high load?
    I will, of course, be testing all of this. I’d like your views and take precautions before I connect the load.

    Thanks.

    1. 1-I think you misunderstood. The speed in which the IGBT switches from on to off state is an important factor, but ofcourse the current plays a role too. In between on and off state, the igbt has a resistance, in which heat will develop according to I^2 * R. The shorter that period is, the less heat will develop. The switching speed is an intrinsic property of the IGBT or FET for that matter as well as the circuit around it. The speed with which the IGBT switches is something else than the pwm frequency you are using. As long as your IGBT is faster than your PWM you are not adding a problem
      2-The max power dissipated in the 100k resistor is defined by U^2 / R. Now if we presume the voltage to be 300V that will come to 0.9W. So in principle the 1W should be enough, though often one would want a bit of margin.
      3 If a circuit works for 5 minutes and has a proper heatsink, it should work for hours. The longest i tried was 24 hours, but with a much smaller load. I used a FET that wasnt really hot after that.

      A last thought……this is a circuit that will do for a FET as well as an IGBT. I used both, but I would recommend a FET. Usually a bit more robust and cheaper

      Good luck

  28. Hi, I have a 230V AC input. I want to know how many stages of dimming I can show from your circuit?

    1. Apologies for my late reply, had some health issues.
      This must be one of the most asked questions. CFL? No cant.
      Dimmable LED’s yes, SOME can. They need to be the ones suitable for classic TRIAC dimmers

  29. Is there a solution of inverted PWM? And what should I do if I want to modify it to add 2 output channels?

    1. Ruby, could it be that You already had this question answered on instructables?
      Anyway, for 2 channel you just eed to duplicate everything behind the 100uF
      For inverting the the PWM you could put the optocoupler in series between the gate and the 100k resistor

    1. Voltage divider, formed by 22k 33k and 33k.
      22+33+33=88
      To be clear, that is in the Giesbers circuit the voltage ON the capacitor without the zener. It is not the voltage OF the capacitor

  30. Hi! Im somewhat a newbie in electronics, but I’m just wondering, will it be possible to use for this for the purpose of lowering the energy consumption of lights? And if it can, I would be really grateful if you can explain it to me.

    Thanks in advance 🙂

    1. yes it can, by letting the lights burn at lower intensity. But if that is your main goal, it is easier to just use lamps of a lower wattage.

      If you put in a 100 Watt lamp in this circuit and put it on full intensity, it uses 100 Watt, if at half intensity, it uses 50 Watt. With this circuit (or any circuit) it is not possible to let say a 100W lamp burn at full intensity for less than 100 Watt power from the grid

  31. hello there! thank you for this article. but i just have one question. What is the function of the Capacitor C1 and Diode D1 in the circuit?

  32. I am very pleased to be able to make an AC dimmer with the help of this article.
    And, while I was running this, I had one thing I was curious about.
    The dimmer operates as opposed to the microcontroller signal.
    For example, when executing analogWrite (), inputting a value of 0 turns on completely, inputting a value of 255 turns off completely.
    Of the components I used to make, the changes in the above circuit are 47uF (400V) and IRF830.
    How do I modify the circuit to operate the same as a microcontroller signal?

    1. you are correct. It is designed for fast switching in order not to leave the FET in resistive mode too long.
      However, if you would put the optocoupler in series with the 100k resistor yo would get the desired effect

  33. Pls help me. I make this circus with R1 = 100K 2W, R2 = 4K7 1/4w, Zener 12v 1W, opto 4N35, Mosfet IRF740, C 22uf 400V. But the R1 is very hot, I can not touch it. Pls help me.

    1. May I advise against touching it, except when unplugged and let the capacitor discharge for a while. Anyway, the max dissipated power in the R1 should be about 0.5 Watt, that shouldn’t be enough to get really hot. Are you sure it is a 100k and that you have everything connected right?

  34. Hi, I made a PCB with 4 input/output, quite sexy PCB.
    I have notice the noise it makes, I am not sure the noise coming of the bulbs? It is a filament bulb Edison style (40W). Having to put a such filter to stop the noise, have you made such filter?

    1. Hard to say where a noise comes from when I didn’t hear it, but indeed it could be coming from the lamps, especially if it has as many coils as Edison style bulbs do.
      You can try several things… could try and lower the PWM frequency (but try keep it above 100Hz in order to avoid flickering) or use a choke filter

      1. I tried all sort of things, sadly to no avail. I am hard of hearing and wear hearing aid, this is where it does interfere with the hearing aid. It is ok 2 metres away but where I put it is about 1/2 metre is annoying. The noise coming off the lamp, cable and the MOSFET. Looks like I have to stick to pure AC. I don’t think it be interfere with normal people.
        I could drop in the PCB design here for others to copy.

      2. Hi, I had loads of fun, still using the pcb but with much improve one, away without PWM, I have change it to trailing edge dimming with a zero crossing circuit. Now that doesn’t interfered my hearing aid at all. But software will have to redo everything on my Arduino. Need a bit of tweaks to do otherwise it looks flicking like old Victorian lamps (ha ha). At least mine work and thank you for your design. I still working on the R1 heat problem and thermal runaway (hint… stick a 24v psu in it).

      3. Tnx for yr feedback. Happy you found a solution. My other circuit I presume?

      4. Didn’t know you have something till I look up on your dimmer circuit, mine is with MOSFET and not TRIAC, so I have made a stable software now, trailing edge (and not leading edge as in your software) . I will add the circuit design soon after I sort out the low voltage design.

      5. Trailing edge dimming with zero detection and then using a FET rather than a TRIAC? That is a a bit uncommon but I guess it is possible 🙂

    2. Could you put a schematic here? And did you solve the problem of the reverse PWM signal.

      1. reversing the PWM is not really hard. Put the optocoupler in series with the 100k resistor

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: