# Using a PNP transistor with a NPN transistor not working as intended

I have an element represented by the two resistors in between NODE1 and NODE2.

I want to be able to open and close the circuit before and after the element, just like having two switches before and after it.

At the moment I have this schematic. (The 5 V sources with switches are supposed to represent an Arduino):

simulate this circuit – Schematic created using CircuitLab

My thought is that when SW1 is closed transistor Q3 allows the current to go through the transistor and to the base of Q1. Q1 is a PNP transistor and this would mean that when SW1 is closed, there is no current going to NODE1, just like having an open switch.

The second switch is much easier since it is after the element and I can use a simple NPN transistor to open/close it.

When I open SW1 and close SW2, I get a voltage of 11.98 V at NODE1 and almost 0 V at NODE2 which is what I am expecting.

However, nothing changes when I close SW1.

Is my schematic flawed and if so, how can I fix it to achieve my goal?

Update: Here is the updated schematic that now works.

simulate this circuit

Q1's base is always connected to 0V. When Q3 is turned on, it lets some extra current through R6 but doesn't affect Q1's base.

Instead of connecting Q1's base to Q3's emitter (bottom side), connect it to Q3's collector (top side). Also, put a resistor in series with Q1's base.

• Yeah this works! Do you happen to know if there is an easier way to do this without needing 3 transistors? Commented Mar 25, 2023 at 2:11
• @MaxenceLapatrie you are making the well-known "H-bridge" circuit (but with 3 phases, does that make it an ┠H-bridge?). The overall idea you have is fine but you will find that most H-bridges are built to make the transistors switch as quickly as possible which your circuit does not do. In someone else's experiment they had their transistors lingering on for many microseconds after being commanded to turn off, and that matters for this purpose. Commented Mar 25, 2023 at 2:46
• the other main thing to be aware of with H-bridges that if you ever have both transistors on at the same time for the same cable, they will be trying to short-circuit the power supply and one or both will probably burn out. This includes the time they linger on after you said to turn off! Commented Mar 25, 2023 at 2:50
• @MaxenceLapatrie To simplify it further, you can get rid of one of the switches and Q3 so the remaining switch controls both Q1 and Q2 at the same time. But I would heed the warnings above about using such a simple discrete BJT circuit for what you're trying to do. Usually special driver ICs and MOSFETs are used for this kind of stuff. Commented Mar 25, 2023 at 6:45
• The circuit is just fine for making something high or low or neither. The problem is that in an ESC you want to do it hundreds of thousands of times per second and with high amounts of current going through, and that means paying attention to all the details. Ideally you just buy a few chips from someone who already worked it out. Commented Mar 25, 2023 at 7:04

Problem number one, as already mentioned the the e-b of Q1 has 12V across it.

It looks to me like the base of Q2 really should go to the collector of Q3. Then, when sw1 and sw2 are closed (or the arduino pins are both high) current flows, and when they are both open (or the pins are low) the resistors are isolated, and essentially connected to nothing.