No the motor is now connected to the collector, as proposed by various users and as described in the cirquit from cjdelphi. If you read my previous posts you'll know that I now use the setup from cjdelphi. I don't want to use a relay also I think for this the transistor should be sufficient. What would be better with a relay? Ill take your advice about the resistor tho.
True. Ill read the post.
I read your posts, but wasn't sure if you had moved the motor to the collector
and had increased the value of the base resistor. Both are necessary and sufficient to operate the motor from a Raspberry Pi output.
The only reasons I can think of to use (or need) a relay is (1) if one of the motor leads is grounded and you therefore can't attach the motor between the +5 V rail and the collector of the 2N2222 transistor or (2) the motor draws more current than the transistor can safely provide. Since you have already moved the motor to the collector, clearly (1) is not applicable. It is unlikely that (2) is applicable either because you have operated the motor for awhile without burning anything up.
The increased value for the base resistor is essential to limit the base current in the forward-biased base-emitter junction. This base current is what will drive the transistor into saturation, resulting in just a few tenths of a volt drop from collector to emitter. But if you try to drive the base from a voltage source using too small a value of base bias resistor (10 Ω is waaaay too small) the base-emitter junction will dissipate too much power and will melt. Helps to have a goodly supply of inexpensive transistors on hand to play with.
It will take you a few days (maybe weeks) to read through all the comments of the BJT resource thread, and it may be (will be) confusing until you do some independent research, but I think it is a good place to start. Best way to learn about transistors IMHO is to do what you are doing now: experiment, measure, and keep notes of what works and what doesn't work. Add on the theory as you go and as your understanding increases. If you get stuck trying to understand a concept, come back here with questions and someone will try to answer them. It helps to have an inexpensive multi-meter to measure voltages, currents, and (out of circuit) resistances. Simple algebra will solve most problems so, if you don't already know, learn how to use Ohm's Law and Kirchoff's Laws to predict how circuits will behave.
Hop