Using transistor as a switch

I have a 37v LED panel and a IRF540n transistor. I want to use the transistor as a switch, but I don't want to burn down my Arduino. I have a few questions I can't seem to figure out the answer to.

  1. Do I need to put a resistor between the Arduino and the gate of the transistor? If so, is it because in order to protect Arduino from short circuits, but normally it doesn't need to be there? doesn't the gate only 'give out' electricity?

  2. How to know how big of a resistor to put between the gate and Arduino? does it depend on the other device's power or there's just a general resistor I can use in all cases regardless if I power 10v device or 40v device?

  3. The LED panel doesn't have the 'shell', where do I put the ground wire coming from Arduino to?

Thank you for your time.

Use the logic version, IRL540. What is a shell? Use the Q7 example Replace the relay with the panel: You will not need D9


Thanks! There's no way I can use it with 'IRL540'? I also have 2n3904 transistor, can I use that instead? I'm trying to learn about electronics, but I've been stuck on this for the last 4 days.

Do you have a link to the panel? .

Do you have a link to the LED panel. How are you supplying the LED panel. Does it have some sort of inbuild or external current limiting.

Non-logic fets need 8-12volt gate drive. Arduino only has 5volt available. If you use the IRF540, you run the risk of not fully switching the mosfet 'on', maybe resulting in overheating. Two resistors are usually used between Arduino pin and gate. A 10k resistor from Arduino pin to ground to keep the gate firmly grounded during Arduino bootup. And a ~220ohm resistor between Arduino pin and gate, to limit current during switching (the gate acts as a capacitor that has to be charged/discharged). Leo..

I have a 37v LED panel and a IRF540n transistor.

Is that correct or did you mean 3.7 volt?

Actually, Wawa meant IRF540 - the IRF540 (the "L" indicates Logic level, "F" indicates a standard part) requires about 10 volts on the gate to fully turn on (saturate), the IRL540 can be driven into saturation around 5v (which is what the 5v Arduino can put out). The resistor is to limit the current trying to be sourced from the Arduino into the gate of the MOSFET - steady state of a MOSFET gate requires no current, but it is also a capacitor and turn on/off creates a surge trying to charge/discharge the gate capacitor hence the resistor to limit the current. A side effect of the resistor though is to slow down the turn on/off times - at low switching speeds, that is not a big deal but if you are using it at fairly high frequencies with PWM, then it is spending significant time in the linear region which will cause overheating if not on a heat sink.

Actually, Wawa meant IRF540

Yes, typo. Corrected.

Thank you for the answers.

The LED has an 37v adapter attached to it, I simply want to turn the LED on without burning the Arduino. I have no idea what's the Amp amount in the chain, since I don't have any stickers on the adapter or any identificators. I will take Wawa's advice on the resistor values and hopefully everything will go fine and I'm not gonna burn my little Arduino down. Been stuck with this for the 5th day, drives me crazy!!

Would a modification of Q8 in the diagram with LEDs replacing the motor, eliminating D10 and using his 2N3904 (Vceo = 40V) for Q9 not work? I don’t understand R21 from Q9 base to +5V though.

R21 is for power up disabling of the FET.

Since the OP is using 37v it is outside the range of Vgs max of +-16. Perhaps a 12v zener gate to GND (source) could be used but it sounds like the OP has limited components.

If the supply was 12v things would be OK.

TNX for the explanation, please ignore my ignor-ance. :confused:

FYI, you should stop calling the IRF540 a “transistor”. It is not a BJT. It is a mosfet. Just as there are NPN and PNP BJT transsistors, there are N-channel and P-channel mosfets. BJT transistors are CURRENT driven , mosfets are voltage driven. A BJT “transistor” requires a base resistor or you will damage the device the first time you power it up (usually). Mosfets do not require base resistors because they are not current driven devices. Sometimes mosfets need a pulldown resistor from the base to GND but this isn’t a general rule. I’ve used many mosfets without Gate pulldown resistors and never had any issues. It sounds like your application would work with N-channel mosfet to sink the load current. Don’t use that part if you need to operate in the linear region though. Choose a different mosfet for something like that. An IRF730A works in the linear region . If you just need a switch then the first part is fine.


The field-effect transistor (FET) is a transistor that uses an electric field to control the shape and hence the electrical conductivity of a channel of one type of charge carrier in a semiconductor material. FETs are also known as unipolar transistors as they involve single-carrier-type operation.

What can I say ,? I still vote for "Fet". Let's just say it isn't the kind of transistor that needs a base resistor.

But, may need a gate resistor ;)

I agree FET (but what does the "T" stand for in the FET???) Tube - that must be it - some sort of vacuum Tube :)

Field Effect Tube :o

I give up.

Just having a bit of fun 8) Buy you a beer next time we meet. .