I want to switch on 5V when switch is connected to 12V. I have been using relay to do this, but I am wondering if I can use NPN transistor or something similar that is cheaper and smaller than a relay.

This is the logic i am going for: enter image description here

Version 2:

enter image description here

  • 1
    \$\begingroup\$ yes, you can. a MOSFET is probably better for switching (cooler, lower current, less waste), but a BJT will work given the currents are within spec. BJTs care about current. \$\endgroup\$ – dandavis Apr 3 '18 at 1:27
  • \$\begingroup\$ All the NPN i checked on digikey all have Max Base, emitter Voltage of 5V. Do you have any recommendations? @dandavis \$\endgroup\$ – ABHISHEK Shah Apr 3 '18 at 1:36
  • \$\begingroup\$ that's fine, it's a confusing spec you shouldn't worry about for the application you describe. note that the base resistor divides the current anyway (with another "resistor" sized to bring (1/hfe)*IC current down to .7v), so there won't be 12v on the base. I would use an IRFZ44N... \$\endgroup\$ – dandavis Apr 3 '18 at 1:54

Yes you can:


simulate this circuit – Schematic created using CircuitLab

Some considerations though:

  • With NPN transistors, you can't switch on the high side unless the base is a higher voltage than the emitter. If you're using 12V, you shouldn't have a problem with this

  • NPN (and PNP) transistors look like a diode from the base to the emitter. If you try to drive it without someway to limit the current, the transistor will be destroyed. In the circuit below, R1 limits the base current to about 1/10 of what can flow through through the load resistor, placing the transistor firmly into saturation. This means that the transistor is on about as much as it can be, so it will have only a small voltage drop (~0.3V) across it.

  • \$\begingroup\$ So my load (R_L) requires 5V and 250mA. So Vout will go to ground? Current to base will be (12-0.3)/27K = 0.43mA? If gain is 100 times, it will get me a maximum of 430mA? I just need 250mA so sounds like it will work perfectly. Please confirm I am talking sense \$\endgroup\$ – ABHISHEK Shah Apr 3 '18 at 1:46
  • \$\begingroup\$ Ah, you had a 1k resistor there so I calculated based on that. You want to keep the base current about 1/10 to 1/20 of the collector current. So that would make the base resistor \$\frac{12}{.250*.1}=4.8k\$ \$\endgroup\$ – C_Elegans Apr 3 '18 at 1:52
  • \$\begingroup\$ Yeah my apologies. Was not sure how to show load. It took 1K resistor by default. My worry is that the datasheet for 2N2222A says that Base emitter voltage max is 5V, and we are applying 12V, am i not reading it correctly? \$\endgroup\$ – ABHISHEK Shah Apr 3 '18 at 1:55
  • \$\begingroup\$ Oh and if you're doing a high side switch (5v -> npn -> load -> ground), you need to calculate the resistor with \$R_B=\frac{Vcc-5-0.7}{I_B}\$, as the base will need to be above 5V for the transistor to turn on. If you don't do this, the transistor may not enter saturation and behave like a small resistor in series with your load, wasting power and generating heat. \$\endgroup\$ – C_Elegans Apr 3 '18 at 1:55
  • \$\begingroup\$ The supply is 12V, but the resistor will have a large voltage drop across it, so the base will only be about .7V or so above the emitter. It's like a diode, as long as you have something to limit the current, the diode will only have its forward voltage across it, no more (simplified example). \$\endgroup\$ – C_Elegans Apr 3 '18 at 1:57

Of course you can, just look for a 12V Enchancment transistor on e-bay. Mofset transistor: 1)Enchancment:More VBase more I between source and drain 2)Deployment:More VBase less current between source and drain https://www.ebay.it/itm/IRLR3802PBF-Transistor-N-MOSFET-unipolare-HEXFET-logic-level-12V-84A-88W-TO-252/322342748233?hash=item4b0d200049:g:cRgAAOSwCGVX7X7k


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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