Electronic – Why is the PNP transistor used in this circuit

bjtcharge-pumpdigital-logictransistors

Why are there PNP transistors here?

enter image description here

from: https://www.youtube.com/watch?v=5_uYE4EWSKY&t=884s&ab_channel=SparkFunElectronics

This shows a charge pump circuit that will be controlled via the digital pins of a microcontroller.
Why does it use 3 transistors each? Wouldn't 2 NPN's each give the same output?
like this:

enter image description here

More specifically, can I replace the PNP transistor with an NPN transistor(as shown in the above schematic)?

(I am an amateur in electronics, so please forgive me if this is a dumb question -_-; )

Best Answer

The D1 signal (presumably 5 V logic level) is switching a 12 V circuit.

enter image description here

Figure 1. The output supply is 12 V.

The PNP transistor will turn on when the base is pulled low and the emitter-collector voltage, VEC, will drop to about 0.2 V meaning that 11.8 V will be available on the output.

enter image description here

Figure 2. Q3 is working in emitter-follower mode.

The NPN, Q3, of Figure 2 is working as an emitter-follower. The highest output voltage you can get is VD1 - 0.7 V. If D1 is driven by 5 V logic that means that you can only get 4.3 V out maximum.

... can I replace the PNP transistor with an NPN transistor?

Nope!

enter image description here

Figure 3. The next problem is that there are no base resistors.

Without base resistors on each transistor Q4 and Q6's base-emitter junctions act as diodes connected to GND. These will clamp the D1 and D2 voltages to 0.7 V preventing Q3 and Q5 from ever turning on. D1 and D2 will only be able to switch between 0 V and 0.7 V and whatever is driving them could possibly be damaged due to the high current drawn through the base-emitter junctions.