I'm trying to get some basic circuitry figured out for a project. I have a 24V fan with a 24V power source that I would like to control via an Arduino UNO. My knowledge of how transistors work is very limited. I have some PN2222 transistors in a kit and was wondering if I could use this to control the fan. I've attached a super basic circuit diagram. When the digital output is zero, I'd like the fan to be off and when it is 5V I would like it to be on.
What is the fan current running, or a link like the del datasheet.
Look for a Logic Level MOSFET to control the fan. a MOSFET can carry a lot more current than a 2222 which you may need for your fan. Also, make sure it is a logic level device which means the datasheet specs the device at 5V at the gate. Something like the IRL550N. The 'L' designates a logic level devices vs. the IRF... series.
A 2n2222A is a low power signal transistor. It can power a very small fan but not with a lot of margin.
In such an application where you want to have Q1 either fully ON or fully OFF the rule of thumb is to have the base current ≈ 1/10th of the fan current for fully ON.
The base current as you have drawn it is not controlled. (i.e. current from the Dout to ground through the base emitter junction).
A typical voltage drop across the base emitter is ≈ 0.5V to 0.7V depending on the base current.
If you have a 5V Arduino the Digital output is ≈ 4.7 to 4.8 volts. There needs to be a resistor between the Dout and the base of Q1.
Estimate base resistor =
assume the fan current is 0.10 amp so our base current goal is 0.01 amp. We could probably get by with a lower base current but we will stay with the rule of thumb.
R=E/I = (4.8 - 0.5) /0.01 = 430 ohms this happens to be a standard 5% resistor value. If you had a 470 ohm it would work as well.
Now this transistor is working within its limits but without a lot of design margin. If you have one already, use it. But if you have to go purchase something consider the MosFet mentioned above.
The 2N2222 should work OK if the fan current is about 350mA or less, what IS the fan current? Post a link or brand name / part number.
No base resistor equals smoke......
Replace the 5V supply voltage on this drawing with 24V.