I am trying to control a 12V and 24V LED inside a push button like the one below.

I have tried with transistors and today with mosfets.

Problem: I cant make the LED fully turn OFF and ON as it would when applying directly the 12V or 24V power source to the LED directly.

(I have two versions of the pushbutton LED, 12V and 24V and I would like to learn how to design the different circuit for each to control them)

I have measured the LED consumption when feeding:

  • 12V directly and the current is 3mA
  • 18v its 5mA

I have tried the following n channel mosfets:

  • IRLML2502 smd
  • 13NM60N

These are the buttons: enter image description here

I have tried this link schematic and various others, but the LED always stays dimmed on and will not make much diference on the gate voltage change. I have also tried this schematic without the 27ohm resistor I have also tried it without resistors I have also tried it with only a pulldown 10k resistor

Driving LED strip from microcontroller

enter image description here

My only though is that the LED is not a plain LED as I can drive it with a 12V without additional resistor. I measured the resistance of the LED terminals and its Mohms, so I guess no current flows when joining LED + mosfet. Anyway, there must be a way of doing this right.

Additionally, I would like to control it via a 3.3V or 5.0V arduino output. All tests so far have been done with 5V

  • \$\begingroup\$ It sounds like you've perhaps got your FET's drain and source pins backwards and are driving the LED continuously through the body diode in the transistor. The body diode in the IRLML2502 has a Vf of 1.2V, so that would explain why it looks dimmer than when you drive it at 12V directly (you'd essentially be driving it at 10.8V) \$\endgroup\$
    – Polynomial
    Sep 29, 2017 at 22:14
  • \$\begingroup\$ You also mentioned 24V LEDs - the IRLML2502 has a maximum Vds of 20V which means you cannot drive 24V through it. The 13NM60N has a much higher Vds max (600V) and would be suitable, but the gate threshold can be as high as 4V so you wouldn't be able to drive it directly from 3.3V logic (5V would be fine though). \$\endgroup\$
    – Polynomial
    Sep 29, 2017 at 22:19
  • \$\begingroup\$ @Polynomial A subtle reading of the OP suggests to me that the OP also tried BJTs before trying NMOS. Normally, I'd wonder if this means to look elsewhere. But I suppose if the OP has no clue about pins, then who knows? \$\endgroup\$
    – jonk
    Sep 29, 2017 at 22:22
  • \$\begingroup\$ @jonk I tend to just go straight for the derpiest possible cause of a problem because that's likely where I'd have fallen foul too, before I had the experience to quickly recognise the fault conditions. \$\endgroup\$
    – Polynomial
    Sep 29, 2017 at 22:24
  • \$\begingroup\$ Thank you Polynomial for your time and your help. I really appreciate it as I was able to learn and make it work. \$\endgroup\$
    – Serge
    Sep 30, 2017 at 14:36

2 Answers 2


Based on your schematic which should work wonderfully , there can 4 issues.

  1. The mosfets aren't suited to logic level control.

  2. You didn't wire it as shown.

  3. The mosfet are damaged.

  4. Your code is wrong.

If you wire the led and mosfet to power and tie the gate to ground, does it turn off? If you tie it to 3.3V via a 1k resistor does it turn fully on? What is the resistance of drain to source when gate is at 3.3V?

You can avoid mosfet issues, replace it with a standard small signal npn transistor, like a 2n3904. 1k base resistor is enough art your load current.

  • \$\begingroup\$ IRLML2502 is a logic level drive MOSFET (you can fully turn it on with a Vgs as small as 2.5V). I guess 2-3-4 option are likely to be the cause. \$\endgroup\$
    – next-hack
    Sep 30, 2017 at 6:25

Thank you for all of you who did try to help me and offered good answers. Indeed if someone is asking in a place like this is because he is doing something wrong and does not know what it is, it might be dead easy or difficult but help is needed , so thank you Passerby, next-hack and Polynomial.

See my setup in the picture attached. After a fresh start with a new mosfet, new wiring and clean table it works! I believe the problem was:

  • The mosfet Drain and Source were connected as P-Ch so I had it the wrong way, and eventhough I reversed it, I damaged it. All tests after this were useless.
  • At some point I connected the mosfet the right way, however as the part was damaged I did not see any difference which confused me even more.

I need to check now with another smd n-ch mosfet that has a Vds of more that 24V.

btw, the code was ok (just blink LED sketch). ;)

Some pictures for anyone who might need help in a similar situation. The power supply on the top left dc jack is supplying 12V. The consumption is around 20mA which are mainly due to the Arduino Nano running the blink example sketch.

enter image description here enter image description here

  • \$\begingroup\$ So I can use only a mosfet or I need the resistors? \$\endgroup\$
    – user228257
    Aug 7, 2019 at 8:44

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.