Hello. I am trying to build a circuit that controls a 12V fan from the teensy 3.2 using a PN2222A transistor. My goal is to eventually control fan speed using pwm. For now the teensy is simply outputting 3.3V. I have run the circuit in multisim with a 12V lamp and the system worked. I have also got the system to work using an Arduino's pwm output to the base of the transistor. Whenever I use the teensy, however, it fails for some reason and the fan does not run. I have attached below the schematic (which is from multisim and contains a 12V lamp instead of a fan), a photo of my breadboard, and a photo of my code. I know the fan works because when it runs when I directly attach it to 12V. The transistor datasheet can be found here. If anyone has any suggestions please let me know.

Click image for larger version. 

Name:	Screenshot 2021-06-03 180807.jpg 
Views:	36 
Size:	75.1 KB 
ID:	24971

Click image for larger version. 

Name:	IMG_0003 (1).jpg 
Views:	39 
Size:	34.3 KB 
ID:	24972

Note that while it's not pictured the main power supply is supplying the power rail of the breadboard with 12 VDC.

Click image for larger version. 

Name:	Screenshot 2021-06-03 181201.jpg 
Views:	16 
Size:	32.7 KB 
ID:	24973