Electrical – BSS138 mosfet not for level shifting


i want to build a constant current source to drive an LED like the one in the image below. I want to use a BSS138 N-mosfet transistor which is mainly used in logic level shifting. My question is if i can use a transistor like this or is it used only for level shifting? Will this be able to dim the led according to the potentiometer voltage? In simulation it worked just great but i wanted to get a second opinion.

Thank youenter image description here

Best Answer

Yes, it will work fine. The BSS138 needs about 2.5V Vgs to be sure of reaching 20mA. I get that from the Vgs(th) voltage of 1.5V maximum (1.3V typical) to get 1mA. You need 20mA (1V across 50 ohms) so refer to Figure 5 and adjust for possible unit to unit variations and add some safety factor. The resistor needs 1V, so that's 3.5V.

The LMV342 output, even with a 10K load to 2.5V, will swing to within 40mV of the +5 supply over the entire temperature range, so you have almost 1.5V to spare.

The other worry is that the capacitive load may cause the op-amp to oscillate. In this case the capacitive load appears like around 40pF (maybe a bit more because of small Miller effect due to changes in the LED Vf with current) with 50 ohms series with some of it. Figure 30 indicates the op-amp with virtually no resistive load can handle 100pF without going unstable, so you're okay, but not a lot of margin.

enter image description here

By the way, your premise that the BSS138 is primarily used for level shifting is not correct. It's a general purpose small logic level MOSFET, used in a great many applications. Here are the data sheet suggestions:

enter image description here

Your application does fall outside of that range of applications because the MOSFET is used in a linear mode rather than switching.