As the title says I am trying to control a solenoid with a raspberry pi. I am currently using an npn transistor (will post link with parts at the bottom) however I am having a hard time getting it to work. The collector is at 12V and the gate is controlled by the raspberry pi gpio pin (runs at 3.3V and 16mA (this is the max amount I believe)).
Attached is a picture of a circuit I used to verify my solenoid circuit. It is essentially the same except that it has LEDs and that it runs on 3V instead of the 12V for the solenoid. Unfortunately I do not have any pictures with the solenoid. It would look roughly the same except that the two positive legs on the solenoid replace the LEDs and the single ground wire is hooked up to the negative row on the breadboard.
This verification circuit works perfectly, but the solenoid circuit does not. I have read online that MOSFETs can also be used as a switch, would this be better? In the case that it is, I would like to try to get the NPN transistor to work as I would rather not use more money.
Any help is greatly appreciated.
I have included a diagram of what my solenoid circuit looks like. For reference on the transistor labeling, as I am not sure what is common. B - base (gate) C - collector E - emmitter