Dimming G4 12v AC led blubs using PWM issue

Hi All, I'm working on a lamp that i'd like the bulbs to fade up when turned on. I need to use consumer replaceable bulbs - like this dimmable 12v G4

I've tired using a IRFZ44N Mosfet and PWM on pin 9 with the example 'fade' sketch with no success. the bulb just stays fully on. How can I get them to dim? any advise would be most appreciated!

Many thanks, andy

If it's on all the time even when PWM is zero, then you have a wiring error.

In case that it's connected correctly and it's on all the time from a low PWM percentage to 255, you are seeing the issue that the LED *bulb contains constant-current circuitry that will do what it can to keep the LED brightness constant. In this case there isn't anything you can do.

Maybe a cheaper "dumber" bulb will work.

// Per.

Are your bulbs advertised as dimmable? Raw LEDs are "current controlled" and they don't run from a regular constant voltage power supply, so LED "light bulbs" have a built-in constant-current/controlled current power supply.* Some are dimmable and some are not. i.e. There are some LED blubs that work between something like 80 and 260VAC with no change in brightness.

Dimmable AC LED bulbs are designed to work with regular [u]AC phase-control dimmers[/u]. Those will probably work by varying the AC voltage but that's not how they are intended to work.

If you have a "raw" LED you can use a variable constant-current (i.e. controlled current)
[u]LED power supply[/u]

  • With regular little LEDs we use a series resistor to control the current but this is inefficient so high power LEDs (1W or more) normally use a switchmode constant current power supply.

cheers guys. the bulbs are advertised as dimmable and look like they contain constant-current power supply.

looks like i'll have to find an alternative. thanks for your assistance!


Don't give up just yet. I'm not saying for certain that what you are trying is possible but I would expect that you have a good chance of success. I have 8 large(ish) white LED ceiling lamps that were supplied with separate switching current sources to power them. I tried putting a MOSFET into the DC circuit between the supplies and the lamps and driving it with PWM. It worked without any problems, been like that for 5 years now. I can dim them as much as I like.

Please post a schematic of the circuit you tried. Also, what frequency PWM are you using? Mine is working at about 300Hz.

Hi Perry. I've attached the diagram. In fact drawing it gave me an idea of connecting the negative of the 12v supply to the Arduino negative. Amazingly the bulb started fading up and down!
Thanks to you all for discussing the issue. Sometimes just talking though the issue can be enough.

You seem to have swapped source and drain of the fet.
The middle pin goes to the bulb, and the pin on the right goes to ground.

The IRFZ44 is not a logic level fet, and shouldn't be used with Arduino's 5volt logic.

This might help.

Tom.. :slight_smile:



I've attached the diagram. In fact drawing it gave me an idea of connecting the negative of the 12v supply to the Arduino negative. Amazingly the bulb started fading up and down!

Common mistake of people new to electronics. They are called 'circuits' because there has to be a complete circuit from one power supply terminal, through all the components, back to the other terminal. If you don't connect the 0V of one power supply to the 0V of the other then where is the circuit for any connection between the two parts fed from different power supplies?

Now re-build it taking into account what you have learnt and the advice from Tom and Wawa.

Thank you all for your input and taking the time to explain the error of my ways!.
I am happily fading LEDs and look forward to integrating the led into the lamp hardware. All the best Andy