I bought one of those very very small solenoids by adafruit. I wanted to get it simply opening and closing. I dug around on the net and I got it SORT OF working. It does click repeatedly... but it does so weakly. I need to sometimes "help" the solenoid by keeping its hammer partly pushed. I can't tell if it is maybe just a super weak solenoid. It is much more likely that I have made bad choices about diode, wiring, or transistor.  Note, I don't know if I have specified the type of transistor correctly. I don't truly know if it is N or P.

NOTE -- I don't know what kind of transistor I am using (P or N) in my real life breadboard... I made a guess here. it is black like that one :)

 

I do not think I have done it right. See description -- it is too weak and needs my help in pushing the hammer - otherwise it weakly sort of throbs without clicking open and shut. Any help oin what I am doing wrong would be appreciated!