Short version: if I needed to drive a MOSFET from mains AC, that will be switching (PWMing) mains AC as well, and needed to do this "fast and often"* how should I derive the power to drive it's gate from the same mains AC?

  • Fast = turning the MOSFET on or off as fast as it allows = sourcing/sinking as much current to/from gate as is it reasonable = 1+ amp per mosfet (IRF830).
  • Often = PWM frequency of in the range of 20-30kHz.

Long version: I am making a kind of sine wave dimmer for incandescent bulbs and for this I need to drive two MOSFETs (gates and sources tied together) that will PWM-switch mains AC. Everything will be packed tightly in a closed box, so I figured that switching MOSFETs on/off as fast as possible should keep them as cool as possible. I also thought I must use gate driver because my attiny (PWM source) cannot source/sink as much current as the MOSFETs are ready to accept. The only power supply that I got is mains AC and I need to step it down to ~12V to drive the gates and provide reasonable current so I can switch them "fast and often" in 20-30 kHz.

Initially I was thinking about capacitive PSU, but all schematics that I've seen were for very low currents. I didn't take chances designing my own, as I wasn't sure if it is feasible at all (for much higher currents that is).

Then I tried it with SR087, but the 100ma that it provides wasn't enough.

Now I am thinking of getting a open-PCB-type SMPS that gives me 500ma and use it to drive the gates. Something like this, for example. What I am not sure, is can I connect it's ground to the rectified ground from mains AC. I suppose I could, as the SMPS output is floating, but I guess there's only one way to find out. Here's a rough diagram:


It does not include optoisolated UART to attiny and filters that I have yet to figure out how to design. And 1k gate resistor is not neccesary 1k, I'll try to keep is as low as possible with the final choice of gate drive PSU.

Or is there any other way to drive MOSFETs from mains AC @10V+ and at least several hundreds of miliamps?

Thanks a lot in advance!

General info: I have very basic and limited knowledge in electronics and circuit design and no formal education. I do, however, understand all the risks associated with mains AC and take it with a healthy level of paranoia.

  • 1
    \$\begingroup\$ I really can't wrap my head around your circuit diagram. \$\endgroup\$ May 2, 2016 at 21:43
  • 1
    \$\begingroup\$ Incandescent lamps have a long thermal time constant and work quite well with 100 or 120 Hz "PWM" using triac dimmers. Can you explain your application and why you need such a high frequency? Flicker causing problems with high speed video? At those frequencies you're going to run into problems with RF emission, etc. The more info you give, the better the answers. \$\endgroup\$
    – Transistor
    May 2, 2016 at 21:47
  • 1
    \$\begingroup\$ @transistor Perhaps he meant florescent lamps. \$\endgroup\$
    – Demi
    May 2, 2016 at 21:53
  • 1
    \$\begingroup\$ You don't need current to keep a mosfet on (only BJTs have that issue), you only need enough current to charge and discharge the gate capacitance so the average power needed is tiny (Fsw*Qtotal = average current or 38nC*30kHz = 1.15mA average), the mosfet symbol has no direct connection to the drain or source because it's a voltage controlled (not a current controlled) device \$\endgroup\$
    – Sam
    May 3, 2016 at 0:01
  • 2
    \$\begingroup\$ You really want to place that current measuring shunt between the sources of the two mosfets while grounding one end of the shunt, or your ATtiny ADC inputs will be subjected to the full wrath of mains voltage when the MOSFETs turn off. \$\endgroup\$
    – jms
    May 3, 2016 at 1:37

1 Answer 1


The following is somewhat conceptual with details "yet to be dealt with".

The AVERAGE gate current is much lower than the peak.
For a given Capacitance C charged to V volts the energy required is 0.5 x C x V^2. This must be charged and discharged F_PWM times per second so
Power = f/2 x C x V^2.
For C = 1 nF, C = 10V, f = 20 kHz
Power = 20,000/2 x 1E-9 x 10^2 = 1 mW mean
At 10V that's 0.1 mA mean with a CC charger or 0.2 mA mean if you "waste" half the charge energy due to the voltage ramp.

If you fed this from 300 VDC the power is VI = 300 x 0.2 mA = 60 mW.
ie if you use a zener clamped reservoir capacitor and feed it via a resistor from rectified mains peak at 300 VDC and allow suitably more than 0.2 mA

Here D1 C1 provide an ~= 300 VDC source.
R1 R2 nomunailly float C2 at half V_C! when not clamped to some other poit, but their main function is to form an effective CC (constant current) feed to C2 and to allow C2 D2 to be driven to whatever voltage is required by the driver. Z2 clamps C2 to whatever voltage is desired.


simulate this circuit – Schematic created using CircuitLab

Somebody queried your 20 kHz PWM frequency. My mean current calculations assume either that this is the "PWM frame rate" with the FET being driven on or off once per frame (= effectively phase control) OR that the frame rate is much lower and that the PWM level can change at most once every 1/20 kHz = 50 uS.
IF your PWM completes a complete 256 level PWM signal in 50 uS with multiple on/off transitions in this period then a much higher gate drive current is needed and this scheme is not suitable.

In practice you can probably use a much lower frame rate


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.