I have designed a circuit to trigger a relay with GPIO port. I have used pin 4 for 5v as Vcc to my circuit, pin 6 for ground and pin 8 (BCM 14) as GPIO (output in this case). Further the pin 8 is connected to relay with PNP transistor 2n3906 and a diode with some resistor as in the image enter image description here

There is no problem when I connect raspberry pi with laptop usb port as power. But when I connect the system (raspberry pi along with my designed ckt) to adapter (came along with raspberry pi) the relay do not trigger. All linux thing is working. I can see the programming logic all working fine with putty. So, I want to know if there is anyone out there facing such problem, if yes or if I am doing anything wrong please suggest the solution. The only issue I see is with adapter power ( which i think shouldn't be).

  • I think you have answered your own question. The only difference is the quality of the power supply.
    – joan
    Commented Apr 23, 2017 at 9:04
  • 2
    This is a bad idea!. You are connecting 12V to the GPIO (via a diode - B-E). You almost certainly are not saturating the transistor, even if you haven't damaged the GPIO. Try a more conventional circuit with a NPN transistor.
    – Milliways
    Commented Apr 23, 2017 at 9:18
  • Sorry, I mistakenly uploaded wrong image. Now i have edited the post. I am using 5v only, and the relay is also a 5vdc type.
    – Amanda
    Commented Apr 24, 2017 at 5:40
  • 5V is not as bad as 12V, but my earlier comments still apply.
    – Milliways
    Commented Apr 24, 2017 at 6:31

1 Answer 1


Use NPN transistor like 2N2222. Connect it like in this schematic. It should work. If it doesn't, make sure the adapter provides enough current.


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.