I was hoping to get some assistance with using a transistor as a switch in a circuit that I am working on. The project is to integrate a Raspberry Pi into an old Playstation 2 housing while utilizing the power supply board from the playstation and integrating the power button already existing on the PS2 case to turn the Pi on and off.

The button is a momentary push button on a circuit board and I would like to utilize the button as well as the LEDs on the small PCB. There is a switch on the back of the PlayStation that controls the mains power to the DC power supply in the PS2. When this switch is turned on, the red LED should receive power from the 12V PSU indicating that the unit is in "standby", and when the power button is pressed and the Raspberry Pi is turned on, the red LED should turn off and the green LED will be turned on.

I will use the GPIOs in the Pi to make these changes. The button PCB has a flat ribbon cable that I will use to connect the 7 pins of the button PCB. For the LEDs to function, +12V will be supplied when the PS2 power supply is turned on (from the master switch on the back of the PS2 which turns on the 12V PSU). The PCB has the LEDs and resistors already integrated.

My thought was to use a PNP transistor for the red LED on the cathode side, as it would allow current to flow through the emitter-collector when the base is 0V, which will be the normal state when the PSU is powered on. When the Raspberry Pi turns on, i can have a GPIO set to high to send voltage to the base. I am unsure if the GPIO alone can give enough voltage to turn off the transistor.

My next thought was to use an NPN transistor to actuate the PNP transistor, but I dont know if I am doing this correctly and how I should size the base resistor for the PNP (R108 in the drawing below) and even if it is needed at all.

Does this look correct and/or is there a better way to accomplish this, or could I get away with just the PNP (R108) connected directly to the Pi's GPIO? Thanks in advance!

enter image description here

  • \$\begingroup\$ The PNP transistor can only turn on if current is drawn from its base which means that it has to be pulled low. Your Q105 can only pull the base of Q106 high. Look up Darlington transistor arrangement. \$\endgroup\$
    – Transistor
    Commented Oct 28, 2020 at 21:52
  • \$\begingroup\$ It is generally frowned on cross-posting questions to different stack exchanges. \$\endgroup\$ Commented Oct 28, 2020 at 22:39
  • \$\begingroup\$ I want Q105 to pull the base of Q106 high, effectively turning off Q106. In its normal state, I was hoping that Q106 would allow current to flow when no power is applied to its base from Q105, allowing the LED to be on until the Raspberry Pi GPIO signal saturated Q105, sending power to the base of Q105 to turn it off. \$\endgroup\$
    – Farizno
    Commented Oct 28, 2020 at 23:26
  • \$\begingroup\$ I apologize about the cross-post. Im new and learning. I deleted my other post in the other stack exchange. \$\endgroup\$
    – Farizno
    Commented Oct 28, 2020 at 23:28
  • \$\begingroup\$ A bipolar transistor only conducts between collector and emitter once there is current flowing through the base-emitter junction. For an NPN that means base must be at a higher voltage than emitter, while for a PNP base must be at a lower voltage than emitter, typically by at least 0.6V. Your circuit only ever pulls the PNP's base high so there will never be any current through the B-E junction and it will never turn on. \$\endgroup\$
    – brhans
    Commented Oct 29, 2020 at 2:47

1 Answer 1


take a look on those circuits. An image is worth a thousand words, interactive simulation even more. Instead of copying circuits, try to understand them! Stay curious. Remember not to draw more than 1 or 2 mA from Raspberry GPIO - its not much, and not even close to maximum given by the manufacturer, but the fewer mili Amps the better (you have bigger margin for other pins). I copied Your circuit FYR. Remember, that in some of those circuits, if resistor values would bee too low, Your raspi might fry (12V line would force high current trough GPIO pin). Happy to help, if anything is not clear.

  • \$\begingroup\$ I'm not sure I understand. I know that I need to size the base resistors properly, I am just not sure how to lay out the circuit so that the led will be on when 12v power is available, and turn off when the raspberry pi GPIO is high. I drew this schematic in KiCad. I did not copy it. I can change it if this is not correct. \$\endgroup\$
    – Farizno
    Commented Oct 29, 2020 at 2:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.