user29025: I am trying to hook 12V RGB Led Strip (LTROP SMD 5050 RGB LED Light Strip) to a NodeMCU unit. I know there are many different tutorials on this and I am very new to wiring and electric circuits.
I used BUZ91A n-MOSFETs and 150 Ohm resistors for each of the RGB channels, and the board is using it's own power supply via usb.

I use very simple code to check if the setup works:
#define REDPIN D3
#define GREENPIN D1
#define BLUEPIN D2

#define FADESPEED 5     // make this higher to slow down

void setup() {
  pinMode(REDPIN, OUTPUT);
  pinMode(GREENPIN, OUTPUT);
  pinMode(BLUEPIN, OUTPUT);
  Serial.begin(115200);
  Serial.println("Finished setup");
}


void loop() {
    analogWrite(REDPIN, 800);
    analogWrite(BLUEPIN, 1020);
    analogWrite(GREENPIN, 400);
    delay(100);

  Serial.println("Finished loop");
}

I suspect nothing works because NodeMCU and the LED are using different power sources and the fact they have common ground doesn't seem to be everything required.

user28768: So now we finally know the reason is MOSFET's threshold voltage is too high. The solution is to drive the gate with NPN transistor (you can use BC547 or 2N5551 or similar). You have to connect it's collector to 5 V and it's emitter to GND. Put 10k or 100k resistor between 5 V and the collector, connect the collector to MOSFET's gate and GPIO to the base of NPN transistor. Put some resistor between GPIO and the base of the transistor, maybe 4k7 or similar.
Note:
HIGH from GPIO will switch off the LED strip and LOW will switch it on.
Another solution is to use MOSFET with lower threshold voltage.
EDIT:
If you want to avoid adding NPN transistor you can use NTD5867NL MOSFET which has max threshold voltage 2.5 V so it will for sure work with 3.3 V at the gate but is rather expensive (about $4). Much better solution is adding cheap NPN transistor.
EDIT:
Here is the schematic:

simulate this circuit – Schematic created using CircuitLab
EDIT:
Here is the correct wiring:


29025: <p>I am trying to hook 12V RGB Led Strip (LTROP SMD 5050 RGB LED Light Strip) to a NodeMCU unit. I know there are many different tutorials on this and I am very new to wiring and electric circuits.</p>

<p>I used BUZ91A n-MOSFETs and 150 Ohm resistors for each of the RGB channels, and the board is using it's own power supply via usb.</p>

<p><a href="https://i.stack.imgur.com/glO4Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/glO4Q.png" alt="my wiring"></a></p>

<p>I use very simple code to check if the setup works:</p>

<pre><code>#define REDPIN D3
#define GREENPIN D1
#define BLUEPIN D2

#define FADESPEED 5     // make this higher to slow down

void setup() {
  pinMode(REDPIN, OUTPUT);
  pinMode(GREENPIN, OUTPUT);
  pinMode(BLUEPIN, OUTPUT);
  Serial.begin(115200);
  Serial.println("Finished setup");
}


void loop() {
    analogWrite(REDPIN, 800);
    analogWrite(BLUEPIN, 1020);
    analogWrite(GREENPIN, 400);
    delay(100);

  Serial.println("Finished loop");
}
</code></pre>

<p>I suspect nothing works because NodeMCU and the LED are using different power sources and the fact they have common ground doesn't seem to be everything required.</p>
 28768: <p>So now we finally know the reason is <strong>MOSFET's threshold voltage is too high</strong>. The solution is to drive the gate with NPN transistor (you can use BC547 or 2N5551 or similar). You have to connect it's collector to 5 V and it's emitter to GND. Put 10k or 100k resistor between 5 V and the collector, connect the collector to MOSFET's gate and GPIO to the base of NPN transistor. Put some resistor between GPIO and the base of the transistor, maybe 4k7 or similar.</p>

<p>Note:<br>
<strong>HIGH</strong> from GPIO will switch <strong>off</strong> the LED strip and <strong>LOW</strong> will switch it <strong>on</strong>.</p>

<p>Another solution is to use MOSFET with lower threshold voltage.</p>

<p><strong>EDIT:</strong><br>
If you want to avoid adding NPN transistor you can use <strong>NTD5867NL</strong> MOSFET which has max threshold voltage 2.5 V so it will for sure work with 3.3 V at the gate but is rather expensive (about $4). Much better solution is adding cheap NPN transistor.</p>

<p><strong>EDIT:</strong><br>
Here is the schematic:</p>



<p><img src="https://i.stack.imgur.com/gGXyS.png" alt="schematic"></p>



<p><sup><a href="/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fgGXyS.png">simulate this circuit</a> &ndash; Schematic created using <a href="https://www.circuitlab.com/" rel="nofollow">CircuitLab</a></sup></p>

<p><strong>EDIT:</strong><br>
Here is the correct wiring:
<a href="https://i.stack.imgur.com/fFeKK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fFeKK.png" alt="enter image description here"></a></p>
