I'm trying to make my LED strip fade-in and fade-out by using Raspberry-pi 4, unfortunately for me, I am not an electronic expert. Every tutorial I saw so far was for RGB LED strips and I have a single-color (3000 K) LED strip with just 2 pins (+ & -).
I have:

  1. LRS-50-24 datasheet
  2. 30N06L datasheet
  3. 4m LED strip single color (3000K) 24V
  4. Raspberry Pi 4 enter image description here

My question is how to connect the MOSFET and the LRS-50-24 to the PI in order to control the fade-in/out by GPIO python code?

Appreciate any help


1 Answer 1


I take it that you'd be using the GPIOs PWM function to generate pulses to toggle the LEDs quickly on and off to control the light level.

You can connect the gate (G) of the FET to a GPIO. The source (S) to the negative output of the power supply and the led strip between the positive and the drain (D).

Of course you'll have to connect the negative terminal of the power supply also to the GND of the Raspberry Pi.


simulate this circuit – Schematic created using CircuitLab

I've added an optional resistor (R1) in the schmatic that will discharge the gate if the GPIO is in high-impedance state or disconnected. This prevents the FET from staying "switched on".

Another optional resistor (R2) limits the momentary current when switching the FET on or off. (See comments).

Also worth mentioning is that the FET you've chosen (FQP30N06L) has low enough gate threshold voltage (VGS(th)) that it probably will work ok with the Pi for this application. Certain other FETs with higher VGS(th) might not work at all. For example this 30N06L from Unisonic possibly won't.

  • 3
    \$\begingroup\$ Can you add a schematic? The OP is very unsure and new to the subject. The schematic tool here is a breeze to use or you can add an existing diagram if relevant, just not a giant photo of a sketch. Thanks, will happily upvote if fixed. \$\endgroup\$
    – TonyM
    Mar 6, 2021 at 17:01
  • 1
    \$\begingroup\$ It will be great if you could add schematic @TrayMan \$\endgroup\$
    – Omri
    Mar 6, 2021 at 17:34
  • 1
    \$\begingroup\$ @AndrewMorton Why would you add a resistor? To reduce EMI? I suppose that might be sensible, if the leads are long. I could add it to the schematic. Sure, a BJT to drive the FET would work (to handle higher VGS(th)), but is a bit more complicated and might not be necessary. I'd rather recommend using another device entirely. \$\endgroup\$
    – TrayMan
    Mar 6, 2021 at 19:08
  • 1
    \$\begingroup\$ @Omri That's hard to say. If the gate voltage is too low, the FET doesn't conduct very well. Can you drive the FET gate directly with, say, 4.5V or 5V instead of the Raspberry Pi to test to see if the LEDs light up properly like that? If the problem is too low voltage from the GPIO, you'll need a driver circuit for the gate. Also, you should've been able to at least turn the LEDs off with the other FET. If they turned on with the other FET, it should've been fine with that. \$\endgroup\$
    – TrayMan
    Mar 7, 2021 at 10:44
  • 1
    \$\begingroup\$ @Omri The gate doesn't really affect the voltage in any way, so you should be able to measure 0 and 3.3V even with the FQP30N06L, unless it's broken. FDN337N would be good, but it's in an SMD package. I couldn't find any good ones with integrated driver circuits, but if you need a driver, the circuit looks like this: arduinodiy.files.wordpress.com/2012/05/fet2.gif except you can use 5V from the Pi instead of 12V. Perhaps someone will write another answer with that circuit. \$\endgroup\$
    – TrayMan
    Mar 7, 2021 at 12:24

Your Answer

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

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