Introduction: AC PWM Dimmer for Arduino

Picture of AC PWM Dimmer for Arduino

Before you decide to build this, you may want to have a look at acolomichi's design as well

Warning: this project uses deadly voltages, as well as a sizeable capacitor to store these deadly voltages. Even after you disconnect the circuit from the grid, the capacitor still can give you a jolt to remember!!

Over 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. This design is on Instructables as well.

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.


At first glance, the Giesberts circuit 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 the 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 230x1.4=330V The average rectified voltage is 230x0.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 giesberts3

The 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

Step 1: AC PWM Dimmer: IGBT or MOSFET

Picture of AC PWM Dimmer: IGBT or MOSFET

But as I was changing the design, I 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-11

The IRG4PC30 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.


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


Reader acolimitchi pointed out to me that if you add the zener, the 6k8 resistor isnt really necessary anymore, which is true, so the circuit becomes like this:


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. Another one that worked quite well is the relatively cheap IRF 730. 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 adviseable.

I couldnt embed a video, but you will find it here. It is a 60 Watt lamp. The slight flicker you may see when the lamp is turned up, is an artefact. It is caused by my cellphone camera trying to adapt to the changing light intensity

Conclusion: stick to the MOSFET, they are on average 4 times cheaper than IGBT's

Bridge rectifier. I used a 1 amp 400 Volt DIL pack 0.25 euro
Diode 1n4001 or 1N4007 0.10 euro
Capacitor 100uF 350-400 Volt 1.36 euro
resistor 100k 0.5-0.6 Watt (actually it dissipates abt 480mW max) 0.12 euro (play it safe with a 1 Watt resistor)
resistor 6k8 1/4 Watt 0.10 euro
Zener 15 Volt 0.5 Watt 0.08 euro
MOSFET IRF730 or STP10NK60 0.58 euro
Optocoupler 4n35 0.25 euro
Resistor between 330ohm-470ohm (possibly even 1k dpending on the Optocoupler) 0.10 euro

So, alltogether at single piece retail prices the cost is 2.94 euro

Step 2: AC PWM Dimmer for Arduino: Thoughts

Picture of AC PWM Dimmer for Arduino: Thoughts

Without any input signal the lamp will burn at max.

If you notice that When writing a zero PWM value to the circuit the lamp burns a bit less than when you switch off the Arduino, that means that the 4n35 is still opened a bit. Play around with t470 Ohm serial resistor, maybe you need a higher value.
The 100uF 400 Volt can be quite big. A 50 uF may work as well and maybe even a smaller value. However, you do not want the value to be too small thus as not to be able to deliver enough voltage for the Gate of the MosFet in fast switching.

Should you wonder if perhaps you can use a capacitor of a lower voltage -say 25 Volt- and connect that over the zener/6k8 resistor in order to replace the 400 Volt one... maybe that will work, but the 4N35 will make it lose its charge almost instantaneously and due to the large RC time (remember, there is 100k resistor) it might not have time to fully recharge again. At least it will make keep the MOSFET in its resistive phase longer, leading to extra heat development.

The Arduino has a PWM frequency of about 500 Hz. That is ample enough. My guess is that around 100 would be more than enough. The Attiny85 delivers I think 280 Hz on its PWM pins. Software ofcourse can always elevate that if necessary.

This dimmer is not suitable for inductive loads

This dimmer does NOT need zero cross detection.

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


GuelW (author)2017-11-14

Hello @diy_bloke, first of all thanks for sharing your knowledge, this is a great circuit, built it in my board and it worked just fine, however what I really wanted is to control my ac ceiling fan, and you've mentioned in the article that this circuit is not for inductive loads, I'd like to ask you if there's anything in this circuit I could change so that I can control an inductive motor? I see your circuit is based on DC, I've thought about placing the load in the AC line rather than the DC one, but I don't know what this can cause as I'm not an expert, also my house runs over 110-127ac instead of 220ac, I'd appreciate if you could point me out to any direction which would help me in accomplishing my goal, in the meantime I'll keep looking for others ac dimmer circuits, yours was what most grabbed my attention as it's very simple in comparison to others I've seen, sorry if my English was not clear enough, I'm not a native speaker, cheers from Brazil.

diy_bloke (author)GuelW2017-11-18

if you want to use this for inductive loads then factually your only option is to place it in the AC line.
It still might not be the best circuit as it is not switching the motor on the zerocrossing so you may induce a lot of noise on the powerline.
The other problem that you will have is that with placing it in the AC line, you are in fact reducing the power to the trigger circuit of the FET so on occasion it may not get into full saturation and have a high RDS. In that case you basically have a resistor in series with your fan, leading to quick overheating.
In fact you would have all the problems that I described with the circuit of Giesberts
127 Volt in it self should not be a huge problem, though you may want to reduce the 100k resistor a bit
Nothing wrong with your english, no worries

AlexanderG143 (author)2017-11-13

Nice circuit @diy_bloke! I would build it with a TRIAC based circuit but my input signal is PWM and I cannot change that, so I ended up on this page. I need to build 4 of them, each controlling a 40W incandescent bulb.

I have 2 questions: Since my bulbs have a rather low power requirement, is there anything you would change to make it more safe?

Also for safety reasons, I modified it to be a normally open circuit (no Arduino signal => lamp off) since the circuit will be powered 24/7.

Would you add some fuses or thermal cutoffs to make the circuit safer and if so, where?

diy_bloke (author)AlexanderG1432017-11-14

Alexander, the power of th lamps isnt really anything that determines safety, so i cant think of any changes on that aspext.

A fuse can be put anywhere in the supply line, either in the AC line or t the DC line.

I have not tried myself but supposedly people have put the optocoupler in series with the 100k resistor to reverse the action

PouryaMec (author)2017-11-05

Sorry,diy_bloke regarding comments,which circuit you and love_evidence writing about because I still need a circuit that work with 500w lamp.

PouryaMec (author)PouryaMec2017-11-06

And Is there any way to instruct a dimmer with triac and moc3021?

love_edevice (author)2017-10-16

I used a regular incandescent.

diy_bloke (author)love_edevice2017-10-17

OK, just to make sure I tried again with the STP10NK60 and a 500 Watt lamp, works well, yes gets fairly warm after say 20 min but nothing serious.
Then I tried again with a 730, works well too, gets hotter but nothing to worry about

diy_bloke (author)love_edevice2017-10-16

then i must say i am getting at the end of my rope, did you measure if indeed you are feeding the lamp with DC?, not presume but actually measure?

love_edevice (author)2017-10-16

Thanks for your help.

I already checked my circuit several times and my breadboard circuit is same to the circuit I sent you before. It is different from just using KBU810 and SF56 instead of DB107 and 1N4007. I used the version with Zener diode and checked that the resistors of the voltage divider worked properly. The voltage divider and Zener diode provided correctly 15V to the gate of IRF730.

When put in a 500W lamp, the IRF730 is so hot that it can not be touched by hand. I also know that the IRF730 can guarantee enough current for a 500W lamp, but strangely it continues to fail.

So I bought the STP10NK60ZFP (35W) and connected it to the circuit instead of IRF730. At this time, the dimmer circuit worked properly. But likewise, the heat is great. Even though it provides 10A current.

It is really strange. Is there a problem with the 500w lamp?

I know that you tested your breadboard with 500w lamp and your circuit worked without a problem.

Could you send me the circuit you tested with 500w lamp. I can't really find any problems in my circuit.

diy_bloke (author)love_edevice2017-10-16

it is the same circuit, albeit that I have the series resistor in the anode rather than the cathode.
I tested with a 500 Watt halogen lamp (didnt have an incandescent lamp) and yes the 730 gets warm but not extremely hot.
What kind of 500 Watt lamp are you using? regular incandescent?

love_edevice (author)2017-10-13


I am very sorry to take your time often. But I have something to inform you.

I removed the 4n35 from the circuit and tested with a 500W lamp. The lamp was fully on, but IRF730 was burned immediately. At that time the gate voltage is 0V.

In the previous experiment, 4n35 was removed and the 100w lamp was connected. So the IRF730 did not fail.

I think there is another problem in my circuit except for 4n35.

I removed only 4n35 from my circuit and connected 500w lamp.

Help me again.

diy_bloke (author)love_edevice2017-10-14

dont worry, thats fine.
Sorry to hear that.
But something I do not understand. How can the gate voltage be 0Volt when you remove the 4n35, it should be at full voltage, completely opening your mosfet. At that moment it is able to deliver 4.5 amps.
I suggest you recheck your circuit

love_edevice (author)diy_bloke2017-10-14

That's problem.

Before connecting the lamp, the gate voltage is 15V.

First I connected 100W lamp, then the gate voltage is 15V.

But after connecting the 500W lamp, immediately the gate voltage is 0V and IRF730 is broken.

diy_bloke (author)love_edevice2017-10-16

OK I see you used the zener. Please check something else as well, can you measure if your diode bridge is connected correctly and that indeed you have DC on your lamp!

love_edevice (author)2017-10-14

That's problem.

Before connecting the lamp, the gate voltage is 15V.

First I connected 100W lamp, then the gate voltage is 15V. At this time lamp is fully on.

But after connecting the 500W lamp, immediately the gate voltage is 0V and IRF730 is broken.(of course I removed 4n35 from the circuit)

diy_bloke (author)love_edevice2017-10-16

ok, so just to get it staright. When you removed the optocoupler and put in a 500 Watt lamp the IRF730 burned out? Even though the gate was at 15 Volt.
Honestly I cant really wrap my head around it The IRF 730 when fully open should be able to get 5.5 amps. Even if it is hot it still can deliver 3.5 amps and in short bursts even 22 amp.

When you use a 500 Watt lamp the current is around 2 amps (when on 230 Volt). There shouldnt be a problem at all.
When fully open the RDSon is 1 ohm so it would develop 2 Watt in warmth and that should not be a problem, definitely not instantaneous.
There are several (remote) possibilities:
There is a fault in yr circuit. Not the circuit as drawn, but as you built it, but I think you already checked an double checked it.
The IRF730 has a max Gate voltage of 20 Volt, so 15 Volt is getting close but still shld be room enough. Also, then I wouldnt expect only the 500 watt to be a problem.

Please do the following: check if the resistors of your voltage divider have the proper value and are connected properly.
Also, did you use the version with a zener diode?

love_edevice (author)2017-10-12

What do you mean "Did you actually fully read my previous 2 comments?"

diy_bloke (author)love_edevice2017-10-13

I meant exactly that, as from yr replies I sometimes got impression you hadnt read something

love_edevice (author)2017-10-12

Hi, Thanks for your help.

I tested my circuit removing 4n35 and lamp was fully on.

I always read carefully your instruction. But I have something to tell you.

I connected pin 1 of 4n35 to the output of NodeMCU without the series resistor, but I connected pin 2 of 4n35 to ground through a 330 ohms resistor.

I think this resistor takes a voltage of 2V that you worry about.

I know your circuit also is configured like this.

diy_bloke (author)love_edevice2017-10-13

ah ok, so you do have a series resistor.
Anyway if the Lamp is fully on with the 4n35 removed and your IRF730 does not show any signs of burning out, the problem is around the trigger circuit.
I suggest you get a new 4n35 and then try first with an arduino, just a simple analogWrite loop.

love_edevice (author)2017-10-12

Hi diy_block,

Did you find really the problem?

If you are right, I will appreciate to you.

I will send you my code.

But I am worried that my code will confuse you because there are many features in my code that I have not mentioned to you.

Please let me know when you finish the checking about my code.

diy_bloke (author)love_edevice2017-10-12

Please read this carefully. I get the feeling sometimes you are not fully or not accurately reading my replies and I find myself repeating a lot so please read this carefully.

For one thing, you didnt make the circuit according to instructions. It would have been helpfull if you had said that in the beginning: You left out the series resistor, you shouldnt.The 4N35 has a forward voltage of 1.3 Volt, the nodeMCU has an output voltage of 3.3V (ideally). Therefore the circuit had to dump 2 volts somewhere without a series resistor to do it in.

This can have several consequences: your optocoupler desperately tries to keep the voltage at 1.3, while yr nodeMCU desperately tries to keep it at 3.3V.

The result is a large current. The GPIO pin can only deliver 12mA. When the current rises above that, the voltage may droptill zero and the logical pinmight get damaged. If the GPIO pin cannot sustain the HIGH, the optocoupler might shut down again, or worse, only open a bit, sending the TRIAC in resistive mode.

In the meantime your NodeMCU could be damagedand even yr 4N35 could be damaged (dont think so though).

So here is what I want yo to do:

Remove your 4N35.
Replace the burned IRF730

Add the 500V lamp
Plug in to the grid

Your lamp should by fully on right now. Confirm it is.

Remove power. give the capacitor a bit of time to discharge

insert the 4N35 (preferably a new one)

if you have a spare arduino, please do the following:

add a 330 ohm seriesresistor as in my circuit.

Try dimming with a 5Volt arduino.

If that works.. replace the 330 ohm series resistor with a 270 ohm (330 will probably work but wanna make sure)

try with your nodeMCU, preferably using a simple analogwrite statement in a loop.

diy_bloke (author)love_edevice2017-10-12

checking yr code right now. Did you actually fully read my previous 2 comments?

love_edevice (author)2017-10-12

Did you receive the circuit?

I send it again.

diy_bloke (author)love_edevice2017-10-12

yes, just to make sure send me your program. But I think I already may have an idea where the problem is

diy_bloke (author)love_edevice2017-10-12

yes received it but I presumed indeed it was akin to the one in the instructable

love_edevice (author)2017-10-12


Did you find anything wrong in my circuit?

I directly D5 pin (this pin is arduino'pin) connected to pin 1 of 4n35 without the serial resistor.

diy_bloke (author)love_edevice2017-10-12

That is good to know. That might be the cause, as your GPIO pin might not be able to sustain the current without a seriesresistor

love_edevice (author)2017-10-12

Ok, Thanks.

I can send all my files. First I will send you the schematic file made by me.

Please check the file and let me know wrong things.

If there is no any issues, I will send the arduino code.

I will wait for your reply.

Thanks in advance.

love_edevice (author)2017-10-11

I am using NodeMCU(esp8266-12E).

I put 5V on the entrance of the circuit (pin 1 of 4n35).

Then the gate voltage is 0V and the lamp is off.

Of course, it is for 100W.

I set the PWM frequency to 500Hz because when PWM frequency is high, we can see that that ON/OFF pattern suddenly becomes one brightness.


I used D5 pin (GPIO14 pin) of the NodeMCU as PWM output.

Please help me.

diy_bloke (author)love_edevice2017-10-11

Can you do one more measurement.... instead of 5volt, can you put 3V on the input of the circuit and then measure the gate voltage?

love_edevice (author)diy_bloke2017-10-11

Of course.

I already measured gate voltage with putting 3.3 volts in the circuit.

Then the gate voltage is 0 volt.

diy_bloke (author)love_edevice2017-10-12

dont overlook my earlier reply to your comment, just adding something here: Somehow I start to suspect the triggering of the 4N35. To get it into saturation, ideally one needs 10mA. The NodeMCU can deliver that. However with a forward voltage of 1.2 Volts there is 2 volts left over the 330 ohm resistor which comes to 6mA. Perhaps that is just a tadd too little, eventhough I have seen other people use a nodeMCU with 330 ohm and it is working for me as well.

What value are you using for that series resistor?

When you are ready/willing to try, I would propose the following:
Totally remove your 4n35 from the circuit, add a 500 Watt lamp and plug it in. If my suspicion is right, it should just be on without problems. If that is the case, I suggest plugging the 4n35 back in again and try with a 5 Volt arduino

If that goes well: use a 270 ohm resistor or maybe a 220 ohm, although that is pushing it very close to the max of 12mA the GPIO pin can deliver

diy_bloke (author)love_edevice2017-10-12

ok thanks. In that case I am rather puzzled why your IRF730 would fry at 500 Watt. For a moment I thought maybe the nodeMCU pin wasnt fully opening the optocoupler, and thus driving the FET in resistive mode, but apparently that is not it. The NodeMCU pin doesnt supply the full 3.3 Volt, thats why I asked to put 3 Volt on it, but I dont think that really makes a difference. I styated the series resistor as 330-470 ohm... but for the nodeMCU I would certainly choose the 330 Ohm value.
Honestly I am a bit baffled, I have had my recent breadboard version, with IRF730 running at 500 Watt for maybe 10 minutes (which is longer than your immediate burnout) and it gets a bit warm but nowhere near anything worrysome. Did have a small heatsink attached but I do not think that made the difference.

As a last resort, can you send me your program? just wanna make sure there are no unexpected issues there

diy_bloke (author)love_edevice2017-10-11

ah ok, somehow I had in my head you were using Arduino. I think pin 5 and 6 of the arduino do not always go to full zero on PWM and I was thinking maybe your optocoupler stays open.
As said, I put a new circuit together with a 730 and that happily does dim 500 Watt steered by an Arduino. I will try that on an ESP.
The only reason I can think of when it is working on 100 and it burns on 500 Watt that somehow your IRF730 is driven into resistive mode

PouryaMec (author)2017-10-11

Hi diy_bloke,

Thanks for your great comments. I used this below link for make my project and I changed some components, finally I got good result for about one hour and more with this changing to control 400-500 watts lamp , so I want to improve this range to over 500 watts and none of the circuits in this website and Revisited version couldn't help me except this circuit.I put the components which changed to improve this circuit.

IGBT(FGH40N60) with heat sink ----> BUZ41A

12k ohm (5Watts) -----> 33K ohm

PC817 -----> 4n35(one of components which effect to heating transistor)

1.5K ohm ------> 22K ohm

diy_bloke (author)PouryaMec2017-10-11

Thanks for your feedback. The BUZ41A is in fact a MOSFET which I think is a better choice over an IGBT and as it allows 4.5 Amp.
The circuit you refer to is actually a modification by me from the original Giesberts circuit and I purely made that as illustration of how it could be improved. I am happy it worked for you, eventhough I never actually built that particular circuit

PouryaMec (author)diy_bloke2017-10-11

This circuit that you mentioned (modification of Giesberts) is similar to your below circuit with few differences in it. In this link you just added cascade amp before mosfet and rejected 220nf capacitor from circuit.However I built this project too and I didn't sense any change in output efficiency.It means, if you reject cascade amp from that, you have similar response without that.

And about IGBT, it was more resistant than any mosfets in confront to over heating (about 150W).

diy_bloke (author)PouryaMec2017-10-12

correct, the modified Giesberts circuit was just an intermediate (theoretical) step towards my simpeler circuit. One of the reasons I have chosen for the position of the optocoupler is that the switching would be faster, thus minimizing the time the mosfet would be in resistive mode. Same reason why I had chosen the capacitor to be over the High voltage supply line, rather than a capacitor over the gate (RC time and stuff like that)
I didnt add cascade amp. the link you give is from Colomitchi.
When I was reading up on IGBT's vs MOSFETS, it seemed that the demands of my circuit were more or less at the cross section of using a MOSFET or an IGBT. Both should be OK. Pricewise the MOSFET was a better choice and though I forgot what IGBT I tested, I didnt see much difference. However, I didnt do a durability test with the IGBT. I am sure it performs well also.
Anyway, thanks for your feedback. I am happy that it is working for you

love_edevice (author)2017-10-10

Thanks for your kindly explanation.

Now I'm understanding your words: "The 7 Volt that you measure is not 7 volt, it is the average of 0 and 15. Volt, Your meter is too slow to hop between 0 and 15 volts."

Becuase I set the PWM frequency to 500Hz, I couldn't measure the 0 and 15 volts. And my meter pointed 7V or other value between 0~15V.

Am I right?

But I have a requisition to tell you.

Although my knowledge of your circuit was not correct, I changed the brightness by correctly configuring your circuit and changing the duty cycle.

Of course, when at a 100w lamp.

Why did the IRF730 burn when I connected the 500w lamp?

I think that the IRF730 is enough for a 500W lamp as you know.

I have to know the reason of burning of 500 w lamp.

I hope you to help about this.


diy_bloke (author)love_edevice2017-10-11

Yes, that is how I explained it.
Anyway, with yr 730 problems, as stated before: if it works at 100 Watt I see no immediate reason why it shldnt at 500 Watt.
The 730 can take 5.5 Amps so that is enough for 500 Watt.
It does have a relatively high RDSon but that shouldnt be a real problem.
One piece of information I asked but didnt get yet... if you put 5 Volt on the entrance of the circuit, then what gate voltage do you get?
Another question: you say you set the PWM frequency to 500Hz. Why and How did you do that? Why not use the default PWM frequency of the Arduino?
Which pin are you using?

love_edevice (author)2017-10-09

Hi diy_bloke,

Thanks for your help.

I am using NodeMCU(esp8266-12E) that supports PWM signal of a 3.3V level to dimmer circuit.

As I change the duty cycle of the PWM signal from 1024 to 0, the gate voltage varies from 0 to 15V. The gate voltage of 7V was also obtained by controlling the PWM duty cycle.

Therefore, the brightness of the lamp changes at this time.

I thought the dimmer circuit would work like this.

In fact, when I plugged in a 100W lamp it worked well at various brightnesses.

"but it should be regulated with a PWM signal, not with a 7 Volt signal."

I don't understand this.

How to change the brightness without the changing of the gate voltage?

Controlling the PWM signal is changing the duty cycle, which later changes the gate voltage.

I know that the duty cycle of the PWM signal will control the optocoupler to induce a change in the gate voltage, and the brightness of the lamp will change later.

If my knowledge about your circuit is wrong, I have to find the other way to change the brightness of the lamp.

My ultimate goal is to change the brightness of the lamp randomly over time.

I want you to help my project for me.


diy_bloke (author)love_edevice2017-10-10

"How to change the brightness without the changing of the gate voltage?"
With PWM. The gate voltage is only 15 Volt or 0 Volt, nothing in between

The regulation is not with voltage but with PWM: That causes an ON or OFF.
I already explained in previous comment that the ON/OFF when done fast translates to different brightness.
The 7 Volt that you measure is not 7 volt, it is the average of 0 and 15
Volt, Your meter is too slow to hop between 0 and 15 volt
So you control the brightness with a PWM signal with varying dutycycle. It is
the variation in the dutycycle (with a high enough frequency) that makes the lamp brighter or dimmer.
If the frequency of your dutycycle is low, you will see the individual ON and OFF but if you increase the frequency (just the frequency, not the dutycycle) you will see that that ON/OFF pattern suddenly becomes one brightness.

Same as with any lamp on AC: because of the sinewave the intensity of the lamp varies, but because of the 50Hz frequency you do not see the change but
rather just one light level.

So if the frequency of your dutycycle (again, just the frequency, nit the dutycycle itself) is high enough (the Arduino is I think at 500Hz or something) the ON/OFF changes into one brightness level.
If you then start changing the PWM that one brighnesslevel will vary between off and full on

Hannes85 (author)2017-10-10

Hey diy_bloke. Which code are you running on the ardiuno?

diy_bloke (author)Hannes852017-10-10

for this circuit?
analogWrite(pin, value)

love_edevice (author)2017-10-09

Hi diy_bloke.

I am always thankful for your help.

I first separated the Arduino from the circuit and experimented. At this time, the gate voltage was exactly 15V and the lamp was brightest.

But my ultimate goal is to control the brightness by changing the PWM period. So that the MOSFET must work safely in the intermediate state, including fully open and close.

In other words, the gate voltage of the Mosfet should be randomly changed from 0 to 15V.

I think the IRF730 burns because it does not maintain the gate voltage at 15V and it is at an intermediate value.

Therefore, the IRF730 behaves like a resistor and breaks while generating very large heat.

In fact, I put a gate voltage of about 7V controlling PWM duty cycle, and MOSFET was very hot.

If the IRF 730 must be open or closed at all times, it can not be seen as a dimmer.

Can I fix this if I use STP10NK60Z?

My purpose is to control the brightness of 1000W lamp safely.

I want your valuable help.

diy_bloke (author)love_edevice2017-10-09

well that is basically what I have been telling you: The gate voltage should either be 15 volts or 0 volts. it should not and never be 7 volts.
I am not sure where you get your 7 volts but your gate should be at 15 or 0. ON or OFF.
I understand your purpose, you want to dim and thats what this is a dimmer, but it should be regulated with a PWM signal, not with a 7 Volt signal.

"If the IRF 730 must be open or closed at all times, it can not be seen as a dimmer."
Obviously you have no idea how this dimmer works or what PWM is.

The intention is that your lamp is OFF or ON, but at such a high speed that your eyes see it as more or less brightness of the lamp. A proper PWM signal fully opens or closes the Optocoupler
It makes no difference in the workings if you use an IRF730 or an STP10NK60Z, they are both MOSFETS, they work the same. The only difference is the load. 1000 Watt might be pushing it a bit for the 730, but the STP should be able to handle 4.5AMPS

I still have no idea how you manage to put 7 volts on the gate, are you sure that is not an average voltage?
I just made this dimmer again quickly on breadboard, with an IRF730 and it just works as it should, So before you blow up more MOSFETS, please check the gate voltage when your arduino sends a constant 5 Volt to the input of this circuit

love_edevice (author)2017-10-07

Thanks for your help.

But I think that circuit hasn't mistake because it works well with 100W lamp.

I already measured the gatevoltage. It is over 1~15V.

If I use STP10NK60, I have to use amplifier because input capacity is big.

Do I have to use amplifier right?

diy_bloke (author)love_edevice2017-10-07

don't overlook my extensive reply from a few minutes ago, just wanted to say I understand what you are driving at with your 'I need an amplifier?'
However... you don't. The circuit of colomitchi is a different circuit, he is dealing with an RC time that is defined bu the input capacity as well as his R8.
My circuit is especially built for fast switching. When the optocoupler closes the RC time is practically zero thus the input capacitor is discharged practically directly.

About This Instructable




Bio: I am a physician by trade. After a career in the pharmeceutical world I decided to take it a bit slower and do things I ... More »
More by diy_bloke:Working With the Funduino W5100 Ethernet Module.Uploading Data to ThingSpeak With MQTTAdding an MCP23017 I/O Extender to Arduino or ESP8266
Add instructable to: