I am trying to control a fan (dc motor) using PWM for a project. The problem is the fan is connected to power but not the arduino I think? Since the motor doesn't turn off but stays on thats what I am thinking. Attached is my schematic and my tinkercad representation:
The way you show in your diagram, if you set pin 2 to HIGH you will burn the transistor. And yes, the motor is permanently ON.
The motor must be connected to V+ and to the transistor’s collector, which must be disconnected from V+. Diode cathode should be connected to V+ and its anode to the collector, in parallel with the motor.