I have a project that requires a fan to keep the Pi cool due to the terrible ventilation. It's a 5v 0.6w fan. So I thought I could use this wiring here:
Instead of 12v it would be 5 from a UBEC, and that same UBEC would also be powering the raspberry pi through the GPIO. Would this work? If so, for the transistor do I use an NPN or PNP? I have a PN2222A. Lastly, how do I find which resistor to use for the base of the transistor.