# Precision Current Sink for LED Modulation

I one of my first designs, I am attempting to simulate a high precision optical transmitter using an LED by varying the brightness in linearly with the incoming signal. The input signal is BFSK, either 30kHz or 50kHz, and ranges from 0V to 5V.

The LED's brightness varies linearly with forward current. For this purpose, my goal is to have 20mA forward current when the input is 0V an 80mA forward current when the input is 5V.

To do this, I've referenced this guide for higher current LED modulation:Linear Current Modulators for high-power LEDs. My circuit implements the same precision current sink. My circuit is shown below: To get the value of R5, I chose that the resting LED current (2.5V input) should be at 50mA (between 20mA and 80mA). Therefore,

2.5V=(0.050A)R_5 -> R_5= 50 Ohms

This brings me to my first question: At 5V, the forward current, using a 50 Ohm resistor, would be 100mA, not the desired 80mA. How can I properly set the 20mA-80mA range using only R_5?

I believe that, theoretically, the input voltage (green) and forward current through the LED (blue) should both resemble a sine wave since the input is AC. However, the output I get is different as shown below: It looks like the forward current does not rise above the designed 50mA. Looking at the opamp's noninverting input (blue) vs. the opamp's output (green), the output gets limited at 3.5V: This overall operation of this circuit deviates from what I expected since the output gets limited instead of varying linearly. What can I add or change about this design to achieve linearity?

According to the LM324's datasheet, its common mode input voltage can only reach as high as 1.5V below VCC and its output voltage can only go as high as 1.5V below VCC: Any one of the following changes will fix the problem:

1. Set $$\R_5\$$ to a lower value so that the input only needs to be 3.5V (or less) to produce an 80mA output.
2. Replace the LM324 with an op amp that is rail-to-rail input and output.
3. Power the LM324 with a supply of at least 6.5V.
• Thank you very much! I missed these parameters and it does make sense that the input would have to be less than 3.5V. I've powered it with 9V since that will also be available in this system and the output looks great! – Jacob Abramow Jan 2 at 16:32
• @JacobAbramow Happy to help! – Null Jan 2 at 16:59
• This can easily be made to work with an LM324 with some small modifications to R5 and input R's for offset and gain and no change to Vdd – Tony Stewart Sunnyskyguy EE75 Jan 2 at 18:52
• @TonyStewartSunnyskyguyEE75 Indeed, suggested fix #1 is to modify R5. Each fix is standalone, so the LM324 would be used in fix #1 with VCC = 5V. – Null Jan 2 at 19:04
• But that does not solve the offset with 5~0 in and 20 ~80mA out – Tony Stewart Sunnyskyguy EE75 Jan 2 at 19:06

The LM324 datasheet specifies the output voltage max as Vsupply - 1.5V, so given your 5V power supply, 3.5V out (max) is exactly what you would expect. The LM324 should be able to drive the MOSFET at low frequencies, although the gate is a capacitive load so stability can be an issue.

You will do better using a rail-to-rail output opamp, although even those don't get all the way to the 5V output in your circuit.

The LM324 is powered from 5 volts and is being driven by a voltage source centred at 2.5 volts with a positive peak taking it up to 5 volts and this is your basic problem. The LM324 does not have an input voltage range that is close to the positive rail. Additionally, the LM324 cannot produce output voltages that are sufficient to drive the MOSFET at the peak current you want.

my goal is to have 20mA forward current when the input is 0V an 80mA forward current when the input is 5V.

This is not going to happen with a 50 ohm source resistor because, with 80 mA flowing, the voltage across it is 4 volts and this totally eats into the maximum voltage that can be produced by the LM324 of about 3 volts when powered by 5 volts. It still has to turn on the MOSFET by having the gate maybe a volt higher than the source so, think again about using this op-amp on such a limited supply. If you powered it from (say) 8 volts, you would be in with a shout.

At the other end of the scale, the circuit you have will produce virtually 0 mA when the input is at 0 volts so, if you require an offset you need to ensure that your input signal doesn't fall below 1 volt.

The circuit has a simple transfer function when operating comfortably within the positive supply rail - output current is V1/R5. simulate this circuit – Schematic created using CircuitLab

This will work after you know LED Vf at 20~80mA to compute R's