• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Switching 5V and 12V on Arduino

Not open for further replies.


I've got a circuit I'm building to program a EPROM using an arduino. The schematic I found uses a npn and pnp transistor to switch vpp between 5V and 12V.
Trying to understand why a npn and pnp transistor are both used?

So when pin3 is high, 12V is on vpp. When pin4 is high, 5V on vpp.

I've added the schematic on the right, just using just a npn transistor. Won't it accomplish the same thing?



Well-Known Member
Most Helpful Member
The single transistor is working in "emitter follower" mode; the emitter will always be no more than 0.7V lower than the base.

With the base running from a 3.3V or 5V logic circuit, the emitter will only rise to 2.6 or 4.3V, not 12V.
That configuration has good current gain, but zero voltage gain.

The two-transistor circuit uses the first transistor to apply base current to the second transistor. The second (PNP, in "common emitter" mode) has it's emitter connected to the +12V supply and it's collector will be able to switch up to very near 12V.

That circuit is not well designed, it should also have a moderate value resistor, eg. 4k7, connected between base and emitter on each of the PNP transistors, to avoid problems with any slight circuit leakage currents.

Edit - info on transistor operating modes:
Last edited:

dr pepper

Well-Known Member
Most Helpful Member
The 12v switching part of your schem is a voltage regulator not a switch.
Not open for further replies.

Latest threads

EE World Online Articles