Electrical – Help choosing a transistor to drive an LED strip from a Raspberry Pi

transistors

I'm sure this is a very simple question, but as a (near) complete beginner in electronics I would really appreciate a little help in choosing a transistor to switch a 5v LED strip from a 3V RPi GPIO pin.

The background is that the LED strip (20 x 5050 LEDs) provides illumination within a nestbox that contains an RPi and a camera, and I need to switch these lights on and off over a day/night cycle, and I may also run the lights at a lower brightness using PWM.

I have measured the current draw of the section of LED strip that I intend to use in this project at ~260mA (5Vdc), which will be powered by the RPi 5v rail. My understanding is that this should be OK with the 2A power supply I am using.

I can, apparently, run up to 16mA from the 3v GPIO pin I intend to use for switching the LED strip.

Now my question, which is, in a broader sense, how does one go about choosing the ideal transistor? I've spent much of the evening browsing parts lists and there seem to be plenty that would do the job – e.g. something like the MPSW55, with Ic of 500mA continuous and a current gain of 50 – 100 x. There seem to be many, many transistors that "fit the bill", but the data sheets also contain many values which I am unsure about. Are there any other values that I need to look for when choosing a transistor for a project, or can I safely assume that if my headline figures are met (and voltage ratings etc are high enough – which they all are for my needs), that the transistor will work?

Further to the choice of resistor, I have also tried to calculate the value of the resistor that I will need between the 3V pin and the base. Based on a 3V output, 0.7V drop across the transistor and, say, 6mA target (50x gain for 300mA), this gives an ideal value of 383 Ohms. Does this sound correct?

Thanks for reading!

Best Answer

Do you care if you switch on the high side or the low side? Because if you switch on the low side, a logic-level N-channel FET will interface directly to the 3.3V GPIO of your Raspberry Pi. It will have lower IR drop and thus have less thermal dissipation than a transistor.

A 2N7002 will handle ~200mA by itself. Use two or three in parallel and you have more than enough current to handle the LED strip, and then some. These FETs are very, very cheap. Bonus: no gate resistor needed normally.

schematic

simulate this circuit – Schematic created using CircuitLab

Or, use a single, higher-current FET like the NDS351N (1.1A).

If you want to use high-side drive you will need to translate the switching voltage up. In this case, a different circuit would work:

schematic

simulate this circuit