Transistors – Correct Way to Use an NPN Transistor to Disable a Push Button

npnpnptransistors

I'm using the Raspberry Pi's GPIO to display some information in a LCD (using I2C) and to enable the usage of a few buttons to navigate through the LCD menus. There's another button, the one I'm having some trouble, that will work as a power-on button.

The problem is: You can power up a Raspberry Pi (3 B+, at least), by shorting pin 03 with ground (which is what I'm doing with the power-on button and works wonderfully), *BUT, this is also the SCLK pin that is needed by the I2C shield to work. I can just let both of them connected, but if someone presses the power on button while the Pi is on, it will reset the LCD and maybe crash the service that sends data to the LCD.

How I tried to solve: Pin 13 (TXD) goes high when a Raspberry is on and that it goes low when the Pi is halted. So I used a PNP transistor where Pin 13 is connected to it's base and when this pin is high (3.3v), it will be able to "turn on" the transistor. This transistor is the one that will be connected to the base of our NPN transistor, while this NPN transistor connector pin will be connected to GND and it's emitter to our switch, which is connected to Pin 03. By doing this, I expect the negative potential between GND and NPN transistor's VBE to be able to make this NPN transistor to be turned off. And when the pin is low (1.5v), it won't be able to "turn on" the PNP transistor which will keep our NPN transistor on it's normally open state and will let the power on button work. There's also a transistor which was used solely to decrease pin 13's voltage.

So.. here's the schematic (the board that I'm creating will be an intermediary one between the Pi and my I2C shield, that's why I'm using a connector instead of other parts):

schematic

Does it all makes sense? Is this a good way to solve this problem? I've simulated it on Multisim online simulator and it seems to work, but it seems a little bit strange for me.

Best Answer

Pin 13 (TXD) goes high when a Raspberry is on and that it goes low when the Pi is halted. You can power up a Raspberry Pi (3 B+, at least), by shorting pin 03 with ground.

The left one drives pin3 to 0.2V, while the right one drives to 0.6 + Pin13.

schematic

simulate this circuit – Schematic created using CircuitLab