I want to use a fan for my raspberry pi and want to switch it on and off. I have found a tutorial online which I want to summarize below:
Components:
- the 5V fan (DC motor in the image)
- 680Ω resistor
- NPN transistor (2N2222)
So the Pi's 5V pin are connected to the positive lead on the fan and the ground is connect to the transistor collector. The transistor emitter is connected to the ground.The transistor base is connected to the BCM 17 with a 680Ω resistor in between.
I'm a complete newbie, so please forgive me for the following question, but I just don't get it... maybe I'm just too stupid.
Why do I need this resistor? I need an exact explanation of what is going on in this circuit and why which component is needed.