PCA9685 + MOSFET - PWM MR16 Led Downlights

Hi All,

Long time lurker, first time poster, and a little green when it comes to electronics :slight_smile:

I have a little problem that is confusing me and I am hoping someone may be able to provide some direction.

Overview:

I have a basic circuit (Arduino controlled), that outputs a PWM signal, this connects to a PCA9685, which in turn connects to a N-Channel MOSFET (FQP30N06L), which has a 12 volt power supply (DRP012V100W1AA - DIN Rail power supply) feeding an MR16 12v Led.

The circuit has a resistor (10k) between the gate and source on the MOSFET, the led and power are on the drain, with the source grounded (and the other end of the led also connected there).

All seems to work nicely - I do not have a scope, but the voltages seems to flow nicely up and down when I measure with a multimeter, and overall the led seems to dim and get brighter as would be expected ..

.. but ..

When I drop the PWM cycle down the led gets dimmer, then does a sudden drop in brightness, and then doesn't fade down all the way to nothing ..

My initial thought was the pulse frequency - so I have dropped this to 100Hz, no change. Then I started thinking it may have to do with the led power driver - do I need one or not - but after some reading I concluded that standard downlight leds already have a driver, so current shouldn't be a problem. Then I wondered if the led I had wasn't dimmable - tried some different ones - no changes .. and the fact it does actually dim overall seems to indicate that it is dimmable.

I will post an actual circuit later - just need to draw it up - its all on the breadboard at the moment :slight_smile:


(slight mistake - its not PWM coming from Arduino, but I2C)

My guess is that I am forgetting something silly (a resister between the LED and the mosfet?).

Anyhow, if anyone can suggest an avenue of investigation, it would be VERY much appreciated.

Thanks & kind regards,
Jake.

MR16 LEDs already have a switched mode constant current regulator in them, so they aren't really suitable for external PWM dimming. You best bet is to buy the LEDs and the regulator board separately. Most of the regulator boards are based on a chip that has an external PWM input, which you can usually tap into.

Appreciated, but I am not really intending to build my own downlight leds - don't get me wrong .. it would be rather fun XD .. but considering the volume I will need for my little project, I feel this is probably best left to the mass producers :slight_smile:

I should also mention that I have had these leds dimming quite nicely using a DMX dimmer (which uses PWM according to its specs).

Also, I am a little unclear as to why the regulator board inside the MR16 LED wouldn't play nice with PWM (there must be something, otherwise they would't sell dimmable / non-dimmable leds) .. my understanding of PWM is that it is like flicking the switch rather quickly, with a varying amount of delay between turning it off and then back on again .. overall it doesn't limit the current to the device, etc. .. so assuming the driver can keep up, shouldn't it just work?

Thanks & kind regards,
Jake.

For those interested - I think I have figured out what the problem was ..

I was using 'delay' after I set each PWM cycle level - this seems to have been causing some problems .. not sure why, but when I changed it to use the 'currrentMillis', etc., setup it started becoming responsive to lower PWM cycles .. I can only guess that it was impacting the I2C communication in some way.

I now have a pulsing MR 16 12 volt LED running of the circuit mentioned above .. the drop to 0v still feels a little sudden, but I know this is controllable now (did a test with manual control via serial and was able to gentle turn the led to 0).

If anyone knows why this may be, please do say as I would love to understand what is going on .. also, any feedback on the circuit would also be appreciated.

Thanks & kind regards,
Jake.

Hi Jake
In dimmer control circuits, it is usual to use a look-up table, and use the value in that to set the brightness of a lamp.
This is because all lights including LED's don't have a linear response to the PWM level against brightness

i.e. 0% (0) would be off 100% (255)= full on but 50%(128) s unlikely to be half brightness more likely 40% brightness and as it gets 'darker' so the linearity gets worse .
Also works at the top end; setting 80% PWM maybe much nearer 100% brightness something like 85+% brightness..

The look up table has a series of values that represent the PWM value for each brightness required, and will give he illusion of a 'linear' brightness as you fade in up and down.
The look up table is an array of values that convert the brightness level either 0-100 or 0-255 and as an example, and convert it to a value to use for the PWM value.

Dimmer - Wikipedia this is for tungsten lamps often used in theaters
Empirical LED Dimming Curve a forum discussion

I hope this may be of some help.

BR
Graham

I am doing some work on this, the idea being to control complete house lighting thus removing the requirement for a licenesed electrician, and a educated person can install a customised lighting system that fits the way we live not the way the builder has always installed lighting.

My theory on this is straight forward, the standard MR16 we can buy of the shelf will always most likely be COB variety, this way the manufacturers can control the current to the LED's and thus its lifespan. There seems to be two factors controlling sales of LEDs at the moment, colour of the light and the economics (efficiency). As efficiency is related to lifespan I would not expect manufacturers to diverge from COB anytime soon.

So how does it work right now this dimming? Well its crude and by turning the power to the LED MR16 on and off with controlled Mark /Space ratios we can limit the energy available to the MR16. The side effect of this is the internal capacitors and the resilience of the COB to the change in supply energy (usually we will describe it as voltage, however the current 'ramp' can be important.)

When the power is 'cut' by using the arduino and a FET for example, the current supply to the MR16 is quickly going to drop to zero. The COB will have some internal capacitance to allow the electronics to operate correctly for a short time period, but due to the higher current of the LED, it wont belong before the MR16 goes off altogether. By applying the voltage again from the Arduino the COB can then start to operate correctly again and deliver current to the LED. This takes time and thus the dimming effect becomes apparent.
The problem here now is that at some point there simply may not be enough energy for long enough time period in the cycle to get the COB operating. This is the dimming cutof point. Different MR16 units will have different cutoff points. I havent tested many different units so far so no idea how much this will change with different brands.

I dont think this is a massive problem, as when I dim lights I tend to prefer only 2 or 3 dim levels, there is no point in having any more static dim levels for the way I live. The ramp is important for it to look good, but this is easy to deal with when using PWM. Subjective level of the dim is the hardest part as what is dim in a movie theatre is not dim in a corridor that you walk down. I think when you consider that only 2 or three dim levels aree required, most of the issues of COB just dissapear and they become a great alternative to halogens. When complete I extpect my system to pay for itself in one electric bill. Thats more cost effective than installing solar!

Hello all,

Great thread and info!

I'm an arduino and all things electrical newbie so please bear with me...

I'm trying to do something similar, I have an 6X6 array of hanging g4 bulb (1.5w @ 12v) fixtures (pic attached)

They currently are driven by two 30w LED drivers switched by a standard decor 120v switch.

I am trying to design a system in which each bulb would be individually addressed so I can make light patterns and / or choose to light either upper or lower half of the lights...

What I've come up with so far is using a remotely controlled (possibly bluetooth) Arduino feeding 3 PCA 9685 boards like these: Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface [PCA9685] : ID 815 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits...

What I don't know is how to boost the voltage to 12v (And possibly have a top wattage available of 3w to each socket) with full PWM after the 9685 boards...

Any help or thoughts would be greatly appreciated! :smiley: