I am not too savvy with electronics so I apologize in advance for any major ignorance on my part. I am trying to use a transistor (listed in the title) as a digital switch for my Raspberry Pi 4 to control. Here is the circuit diagram.

Circuit diagram

Here is a picture of how I hooked up the circuit:

Circuit picture

I inserted an LED in the circuit (the 5mm one that comes with an Arduino board) and it is always on. I am using an adapter that I found laying around as the power source. It reads 12V, 1.5A on the back. I would like to only have the LED turn on when the base terminal is given the proper voltage. The LED should be off when the Raspberry Pi is not providing any power to the circuit. Am I not understanding something? Should I be using different resistors? Thank you for any help!

  • \$\begingroup\$ Well for one your emitter and collector are swapped. If that's actually what happened, it's likely your base-emitter junction is acting like a zener, and your rpi input is sinking current. \$\endgroup\$
    – Hearth
    Mar 12, 2021 at 1:52
  • \$\begingroup\$ I realize that the arrow on the transistor and the LED collide but I used a 5V power source with a 330 ohm resistor between the power source and the LED in this configuration and the circuit worked as expected. Would this still be a problem? \$\endgroup\$ Mar 12, 2021 at 1:56
  • \$\begingroup\$ That makes me even more certain that this is the problem. Swap the collector and emitter, your transistor's hooked up wrong. \$\endgroup\$
    – Hearth
    Mar 12, 2021 at 1:57
  • \$\begingroup\$ I attached the wire that went to the collector to the emitter and the wire that went to the emitter to the collector. I turned the LED around also to allow current to flow through it but I still get the same problem. Did I misunderstand what you said? \$\endgroup\$ Mar 12, 2021 at 2:02
  • \$\begingroup\$ The LED? I'm not sure what you mean by turning the LED around, everything other than the transistor should be the same. \$\endgroup\$
    – Hearth
    Mar 12, 2021 at 2:50

1 Answer 1


The Part Number you have given tells that it is an NPN transistor. But the way you connected the circuit seems incorrect.

In a switch configuration of NPN transistor, the emitter is usually connected to the ground and the collector is connected to the power source.

The emitter section is identified with the help of the arrow mark marked on the pin in the schematic. The direct opposite section of the emitter is the collector section.

Since you did connect the base of the transistor correctly with the Raspberrypi I hope that you are clear on the base side of the transistor.

The picture below is drawn as you did.

enter image description here

Picture A depicts that your Raspberrypi is not supplying anything to the transistor and the led is in an OFF state.

Picture B depicts that your Raspberrypi is supplying power to the transistor and the led is in an ON state.

To add more, I suspect the resistor value you have chosen and connected in the collector section of the transistor. The resistor connected there is to limit the current flow for the LED to glow on. If you did the calculations correctly, leave it. If the current flow is higher than the LED need, it will burn the LED and you will see no result from it.

Have a nice day!

  • \$\begingroup\$ Thank you! I will try that out right now. \$\endgroup\$ Mar 12, 2021 at 4:09

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.