I am trying to make a simple circuit to control an IKEA LED strip (VATTENSTEN, 1.5W @ 5V) with an ESP32 (for use with ESPHome).

For this, I am using a BS170 MOSFET to control the circuit, and it works great when turning it on, achieving full brightness.

However, when I turn it off, the LED strip is still lit (albeit incredibly dimly). I have tried changing the transistor in case it was faulty, but I got the same issue.

Here's the schematic. From what I've gathered, it should work. Granted, I don't know much about this, and it's very likely I'm just missing something incredibly obvious.


simulate this circuit – Schematic created using CircuitLab

I've checked with a multimeter, and the gate does get pulled low, so that's not the issue.

  • 1
    \$\begingroup\$ What you drew should not even work at all. There is no common ground between ESP and FET. \$\endgroup\$
    – Justme
    Sep 24, 2023 at 19:09
  • \$\begingroup\$ I forgot to draw it there, but the ESP32 is plugged into the same circuit. Will update the drawing. \$\endgroup\$
    – pta2002
    Sep 24, 2023 at 19:14
  • \$\begingroup\$ What's your wiring alike, what is the power supply, a cheap ungrounded mains USB adapter perhaps? The FET is a poor type as it barely turns on at 3.3V on gate, but it should still turn off properly. As the LEDs are extremely sensitive for any leakage current, maybe it's just capacitive coupling. What if you put a 10k resistor in parallel with LED wires, i.e. an extra load for the FET? These things like capacitive coupling due to wiring can't be seen in any schematics. \$\endgroup\$
    – Justme
    Sep 24, 2023 at 19:58
  • \$\begingroup\$ It's fairly shoddy wiring, mostly solder bridges on a perfboard PCB (though fairly short ones). It's being powered by a OnePlus charger. I'll try adding the resistor and see if that changes anything! \$\endgroup\$
    – pta2002
    Sep 24, 2023 at 20:20
  • \$\begingroup\$ You really should put a single-transistor converter from 3.3V to 5V on the transistor input. \$\endgroup\$
    – sx107
    Sep 24, 2023 at 20:21

1 Answer 1


There should be a gate pull-down resistor of 10k to 100k, but since the ESP output should be push-pull it should still turn off the FET. The resistor should still be there to protect the gate while handling.

If there is any series resistance etween the pin and the gate, the pull-down resistor should solve.

The FET may be defective.

The ESP pin may be defective.

The software may be inadvertently turning the pin from an output to an input instead of pulling the output low..

  • \$\begingroup\$ There's no resistance, checked with a multimeter. I had a previous version with a 10K pull-down resistor on the gate and it didn't help (in fact, it made it dimmer when it was on, but the same when off). I guess I just have a defective batch of transistors (or maybe they're fake)... I have some 2N3904s lying around, I guess that should work too. \$\endgroup\$
    – pta2002
    Sep 24, 2023 at 19:42
  • \$\begingroup\$ Checking with a multimeter between the source and drain, it says there's an 8K ohm resistance when it's off. I'm not sure if this is normal \$\endgroup\$
    – pta2002
    Sep 24, 2023 at 19:46
  • \$\begingroup\$ Remove the MOSFET. Measure the output voltage on the pin. If there is a voltage then there is something wrong with the ESP or the software. \$\endgroup\$
    – RussellH
    Sep 24, 2023 at 19:47
  • \$\begingroup\$ Resistance measure in circuit is not very illuminating. Remove the FET and measure the resistance from drain to source. \$\endgroup\$
    – RussellH
    Sep 24, 2023 at 19:49

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.