Electrical – Can i switch npn transistor using 12v

12v5vrelayswitchestransistors

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

Best Answer

Yes you can:

schematic

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.