I am trying to build a dimmer for these bulbs: G4 LED Bulb 30 Watt Equivalent Bi-Pin LED Disc JC Side Pin 12V-24VDC Low Volt CRI85 300 Lumens
I have managed to make one using Arduino uno and a Mosfet and a Potentiometer.
this works reasonably well. My question is how can I build a dimmer which mimics the dimming action when I connect the LED bulb directly to a bench power supply and adjust the voltage? This gives me a very smooth dimming action with no flicker. I can increase the voltage slowly from zero and get seemingly infinite control. The Arduino by contrast does dim but with occasional flicker at low voltages. Also the current drawn seems to increase as I turn the dial and then decrease slightly when near the 12 volt limit.
Is there another way to build a dimmer to achieve a smooth curve? I have tried adding capacitors to the circuit and adjusting the code etc. but it doesn't really improve.
It is switching all the time, oscillating, to pump the needed current.
You can PWM it with a frequency of about 300Hz, and it should work. But maybe it will flicker in some circumstances, because you are disturbing the switching regulator. I don't know if this is what you already tried. Otherwise try it, with a logic level mosfet before the bulb, or after.
You could also try to mimic the voltage regulation of your bench supply, with another variable switching regulator, but maybe would be over killing.
Or you could try to manipulate the current regulator circuit in the bulb. Probably the IC has a feedback pin to adjust the current. I did it once to control one 3W led and it works smoothly, but you have to study the circuit and hack it a little bit, maybe also over killing.
Yup, get rid of the LED driver that's on the backside of your LED assembly. Replace it with something like a picobuck PicoBuck LED Driver - COM-13705 - SparkFun Electronics This can be PWM-dimmed across a wide duty cycle range. You may find you need to use a fairly low PWM frequency (<500Hz) to get smooth dimming at very low duty cycles.
Of course, instead of literally getting rid of the driver on your current LED assembly, it's a whole lot simpler to just buy a PCB with some LEDs and no driver. There are plenty of 3W LED beads soldered to a star-type metal-core PCB that you could use.
As you found out, they are - to an extent.
There's always a limit to how smooth you can dim at very low light levels. It's a bit technical to go into this, but the LEDs you're using aren't really designed to do this particularly well. They're aimed at interior lighting applications where it's probably OK to dim down to something like 10% without having to go below that. If you want smooth dimming down to 1% or even less, things tend to get a bit more complicated.
That was DC dimming. Apparently these LEDs tolerate being DC-dimmed fairly well. If you dim them with an Arduino, you're basically turning the power on and off very rapidly (PWM). This tends to create a flicker effect due to interference between the onboard LED driver trying to start up and the Arduino cutting power off.
Sadly, making a DC-dimmer on the basis of an Arduino is rather inefficient because you end up burning the energy that's not used by the LED in the form of heat in the switching transistor, so it's generally not a good idea. An approach involving something like a PicoBuck is more elegant and efficient.