2
\$\begingroup\$

I want to create a circuit to drive some LEDs with PWM. The circuit consists of a PMOS switch at the high-side and the gate driven by the MCU PWM pin that is configured open-drain. The LEDs have current limiting resistors. My question is regarding the procedure in order to calculate these resistors values.

I have heard that in order to maximize the LEDs lifetime, it is generally considered a good practice to operate the LEDs at the 50 % of their forward current.

The LEDs have 3 V forward voltage and 150 mA forward current. The PMOS source terminal is connected at 3V3, so the circuit is supplied with that voltage. What would be the best approach for selecting the resistors values? I am thinking to operate the circuit at 50 % duty cycle and 1-2 kHz frequency.

enter image description here

\$\endgroup\$
7
  • \$\begingroup\$ You can't drive the gate with open drain pin. Best to use Ohm's law for determining resistance, but with 3.3V supply and 3.0V LED you have almost no margin for tolerances. Why do you need PWM anyway if you want to run it always at 50% duty and at 50% of the rated current? \$\endgroup\$
    – Justme
    May 15 at 17:27
  • 3
    \$\begingroup\$ edit the question and draw your schematic, it'll help us help you. \$\endgroup\$
    – Aaron
    May 15 at 17:49
  • 1
    \$\begingroup\$ What are the LEDs for, just visual indication to a human or driving a light pulse down an optical path? Under what ambient light conditions? \$\endgroup\$ May 15 at 21:11
  • 1
    \$\begingroup\$ @FabioBarone the leds are used in a dark closed chamber that contains an experiment. The luminescence is need to capture a photo of the experiment with a camera \$\endgroup\$
    – irag10
    May 15 at 21:19
  • 2
    \$\begingroup\$ So probably not much light is required. Suggest try 10% of max rated forward current, see if photos are ok with that. LEDs are surprisingly bright under these conditions \$\endgroup\$ May 15 at 21:21

4 Answers 4

1
\$\begingroup\$

In addition to the OP:

the LEDs are used in a dark closed chamber that contains an experiment. The luminescence is need to capture a photo of the experiment with a camera.

My advice: don't bother with PWM and run the LEDs with a constant forward current at about one-tenth of their rating. Set this current by adjusting R1 in your schematic. Test by taking photo & confirming results are acceptable, adjust R1 as required. 10% of current rating should mean LED lifetime of well over 10 years.

I recommend avoiding using PWM in an experimental situation due to risk of electromagnetic interference, EMI. LEDs can be a significant source of EMI when driven by PWM; this risk drops to almost zero when driven by constant current.

\$\endgroup\$
0
\$\begingroup\$

You have a few things going on, potentially, with your drive circuit. But without a schematic, I'll leave that alone for now.

As for the LEDs, lifetime is all about heat. Which is related to \$If\$, but other factors like heat dissipation/sinking and cooling (fans) also come into play. It all depends on how much heat you can get out of them.

You switching frequency is a good starting point to avoid seeing the flicker.

How to pick the resistors is simple circuit calculations (ignoring PFET drop): \$If = 100mA,\$ \$Vcc=3.3V\$ so
\$Vcc-Vf=0.3V\$
\$\frac{0.3V}{100mA}=3Ω\$

Now including PFET drop, you need to subtract the \$Rds_{on}*If\$ from the \$0.3V\$.
Assuming 20mΩ for \$Rds_{on}\$
\$\frac{0.3V-(.02Ω*0.1A)}{0.1A}=2.98Ω\$

You can see why we like FETs, they don't dissipate a lot of power when they are on, compared to other tech. Mechanical relays will beat them, but you can't toggle them at 1-2kHz for very long. :)

\$\endgroup\$
0
\$\begingroup\$

There are multiple problems.

Don't use open-drain output with pull-up resistor to 3.3V. The rising edge is slow. Simply use push-pull output. You can leave the resistor to keep signal high when MCU is booting.

Also PWM is usually not used when filming or taking photos, due to the problems of how the photo exposure is not synchronized to the PWM cycles. For best results, use constant current dimming.

It is also weird to use a PFET being used. It does not matter much, but in this circuit, either PFET or NFET can be used, and while modern PFETs may be equallu good, it would be simpler to use an NFET for low side switching, and use higher voltage for LED supply.

For the original question, just use Ohm's law for calculating resistance. The problem is, with 3.3V supply and 3.0V LED, and maybe 100mA of current, you end up with 3 ohm resistor. Due to small difference of only 0.3V over the resistor, a small change in resistance or LED voltage due to manufacturing tolerances makes a large diffrence in the current.

If possible, use a higher supply than 3.3V, an NFET for switching, push-pull output for faster swiching, and for photography, use linear constant current supply and just trigger the LED on.

\$\endgroup\$
0
\$\begingroup\$

Sadly, there's no easy answer to your question, since 3.3V is too close the diode's forward voltage of 3.0V. To see why this is a problem, take a look at powering the LED directly from a fixed supply voltage:

schematic

simulate this circuit – Schematic created using CircuitLab

On the left I use a 3.3V source, and on the right the supply is 5V. In both circuits the LED develops 3.0V, and the remainder must appear across the resistance. This is how we calculate the resistance: the difference between the supply voltage and LED voltage must be across R1 (or R2), according to Kirchhoff's Voltage Law. We can then use Ohm's law to calculate the resistance required to pass some desired current (10mA above), given this potential difference across it:

$$ R = \frac{V_S-V_{LED}}{I} $$

For our two resistors R1 and R2 above, this works out to be:

$$ \begin{aligned} R_1 &= \frac{3.3V-3.0V}{10mA} = 30\Omega \\ \\ R_2 &= \frac{5.0V-3.0V}{10mA} = 200\Omega \\ \\ \end{aligned} $$

Imagine what would happen if the supply or the LED's forward voltage were to be slightly different, both of which are likely. This would alter the voltage across R1 (or R2), also changing the current that flows. The amount by which current changes will be proportional to the fractional change in voltage. For example, a 0.1V change in the voltage across R1 (left, with a supply of 3.3V) would represent a change of \$\frac{100mV}{300mV}=33\%\$, whereas that same 0.1V change across R2 (right, 5V supply) would be only \$\frac{100mV}{2V}=5\%\$.

In other words, the smaller the voltage "headroom" (difference between supply and LED voltages), the larger the variation in LED brightness you will experience, when there are slight changes or differences in voltages anywhere.

Also, for a photography application, PWM will cause issues with exposure not being synchronised with LED on and off cycles, and so PWM is not recommended.

I think you require a better solution, an analogue one, in which LED current is continuous, and the supply is greater than 3.3V. I'm pretty sure you will find a 5V supply somewhere in the system, which will do nicely:

schematic

simulate this circuit

This is a voltage-controlled constant current sink, variable from 0 to 190mA, and that current will be drawn via whatever load is connected between +5V and the collector of Q1. It employs an op-amp in a closed loop to regulate current very precisely, in proportion to applied potential \$V_{PWM}\$.

In this case the load is three LEDs and their ballast resistors R5, R6 and R7, which are present to help distribute current equally via the three paths, to mitigate differences between LED characteristics. With \$V_{PWM}=+3.3V\$, total current \$I\$ will be 190mA, which will result in \$\frac{I}{3}=63mA\$ in each LED.

Because of the limited supply voltage, you should keep those ballast resistors as large as possible, without having them develop too great a voltage. I aimed to keep the voltage across them under about 0.6V at maximum current (which is about 60mA through each):

$$ R_{BALLAST} = \frac{0.6V}{60mA} = 10\Omega $$

Output current \$I\$ is controllable with a DC voltage applied to node PWM, between 0V and +3.3V. This can also be a 3.3V PWM signal from your MCU, which will be low-pass-filtered by C1, to produce a fairly smooth DC equivalent.

Using a constant current like this will have the benefit of causing that current to take whatever path is available. If an LED should fail, the set current will be equally divided between the remaining two, resulting in approximately the same power output from those two LEDs, that was provided by all three before.

If you use PWM, there will be a small "ripple" in output brightness, but it will be tiny compared to the blatant full-on/full-off of pure PWM control, making it far more suitable for photographic applications.

If you require more maximum current (or less), then change R4 according to this:

$$ I_{MAX} = \frac{890mV}{R_4} $$

\$\endgroup\$

Your Answer

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

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