I have been studying transistors and decided to try my knowledge in my lab to find out that nothing works as I thought it would..
I had a small lamp 12V and a handful of 2N3904 transistors, along with a 12V DC power supply.
Attached to the base of the transistor was a pin from my Raspberry Pi, along with a 150 ohm resistor to provide ~20 mA of current. The rest of the transistor was wired as the picture.
However, as soon as I plugged in the power supply, the lamp lit! Even though no current was passing through the base. I tried flipping the transistor around, to see what would happen, as as expected the lamp wouldn't light.
I switched out the lamp with a small solenoid (SparkFun ROB-11015), but now nothing happened while toggling the GPIO pin. I switched out the transistor thinking I fried it, but still nothing... am I missing something?
From what I understand, as long as there is enough current running through the base to saturate the transistor, it should allow current to pass from the power supply to the load. When the transistor is not saturated, the circuit is open.
As an aside, from multimeter readings the GPIO pin is a steady 3.3V and the solenoid draws ~500 mA initially and stabilizes at ~140 mA when wired directly to the power supply.