0
\$\begingroup\$

I am currently working on a project where I need to control three 25mA LEDs with a 12V power source. The control signal is coming from an Arduino, which only provides a 5V logic level.

My plan is to use a BSS84 P-Channel MOSFET for high-side switching. I need to do high side switching because the end product is 48 groups of these LEDs which need to be able to be dimmed all together using the negative side, but individual LEDs need to be able to be turned on/off while others need to maintain the same brightness. The source of the BSS84 will be connected to the 12V supply, and the drain will be connected to the LEDs (each with their appropriate current-limiting resistors).

To accommodate the 5V logic level from the Arduino, I'm thinking of using an NPN transistor (like a 2N3904) for level shifting. Here's the proposed setup:

  1. NPN transistor (such as 2N3904): Connect the collector to +12V, the emitter to the BSS84 gate, and the base to the Arduino output through a current limiting resistor.

  2. Current limiting resistor: This resistor is connected between the Arduino output and the base of the NPN transistor. It limits the base current of the NPN transistor. A typical value can be 1k to 10k ohms.

  3. Pull-up resistor: Connect a 10k ohm resistor from the BSS84 gate to the source (+12V). This ensures that the BSS84 is off when the NPN transistor is not conducting.

  4. BSS84 P-Channel MOSFET: Connect the source to +12V, the drain to the LEDs (and their series resistors), and the gate to the emitter of the NPN transistor.

With this configuration, when the Arduino output is low (0V), the NPN transistor is off and the pull-up resistor pulls the BSS84 gate to 12V, turning it off. When the Arduino output is high (5V), the NPN transistor turns on, pulling the BSS84 gate to ground and turning it on.

Does this sound like it would work as expected? I want to make sure I've got everything right before I proceed. I find transistors a bit confusing so any feedback, advice, or suggestions would be greatly appreciated.

Thank you in advance for your help.

enter image description here

\$\endgroup\$
3
  • \$\begingroup\$ Draw a schematic of your proposal. The connections of the FET and BJT sound wrong, but if you draw a schematic we can see more clearly what you're talking about. \$\endgroup\$
    – Hearth
    Commented Jun 25, 2023 at 17:29
  • \$\begingroup\$ Yes, i realized i may have gotten something wrong there and it might be clearer with a schematic, updated now, took a while to draw up. \$\endgroup\$ Commented Jun 25, 2023 at 18:16
  • \$\begingroup\$ Working, but would be nice if a human can confirm :) falstad.com/circuit/… \$\endgroup\$ Commented Jun 25, 2023 at 18:29

1 Answer 1

2
\$\begingroup\$

The picture seems correct, but your wording is wrong. In the picture, you have the collector connected to the gate, emitter collected to ground, and base connected to the Arduino, which is the correct way. The original question wording doesn't match the picture. Otherwise, all the connections in the image look correct and reasonable to me, just always double check the current through the LEDs.

\$\endgroup\$
10
  • \$\begingroup\$ Yes i just realized i got the wording confused but the picture is the propsed circuit. Can i use a 10K resistor for the base to the Arduino instead with an MMBT3904? With 1K the current is 4.3mA according to CircuitJS and with 10K only 438uA and it would be nice not to draw 4.3mA off 48 pins on the Arduino. Datasheet google.com/… \$\endgroup\$ Commented Jun 25, 2023 at 18:34
  • 1
    \$\begingroup\$ You can increase R1 -- a v. reasonable forced beta would be 10, s (given 5V & 12V), making R1 47k Ω would be reasonable. However R2 would attenuate the signal -- so move R2 to the LEFT side of R1 -- and also make it 47 kΩ \$\endgroup\$
    – jp314
    Commented Jun 25, 2023 at 18:53
  • 1
    \$\begingroup\$ Yes, here's how to analyze it: For the gate to be at ~ 0 volts, we're going to have to sink 1.2 mA from that pull-up resistor. With a 10k NPN base series resistor, we can put about 430 uA into the base of the BJT. But the base node will be at ~.7 volts so the 10 k pull down on the base will steal 70 uA, leaving you with a total base current of 360 uA. On page 3 of the MMBT3904 datasheet, for a collector current of 1.2 mA, we have a current gain of about 70. Therefore, the base current needed to drive 1.2 mA is 1.2 mA / 70 = ~17 uA. You're way above that so 10k is a reasonable value. \$\endgroup\$
    – cEEa
    Commented Jun 25, 2023 at 19:04
  • 1
    \$\begingroup\$ Thanks a lot, i think i will try it with 47k even as suggested above as that (90uA) is still way above the required 17uA. \$\endgroup\$ Commented Jun 25, 2023 at 19:50
  • 1
    \$\begingroup\$ Just ground it. All you need to modulate the brightness is to control the led current. All the BJT is doing is turning on and off the mosfet, it doesn't have any of the led current flowing through it. We want the emitter of the BJT to be at 0 volts overall to make sure things work as expected, and it isn't responsible for the PWM behavior at all. \$\endgroup\$
    – cEEa
    Commented Jun 26, 2023 at 3:37

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.