Trying to control the speed of a DC Motor (MFA 918D100112/1 found on https://www.rapidonline.com/mfa-918d100112-1-gearbox-motor-100-1-4mm-shaft-12-24v-37-1224) using PWM pin on Arduino connected to the base of an npn BJT (2N3904 https://www.onsemi.com/pub/Collateral/2N3903-D.PDF). This is the proposed circuit:
I am not sure of the resistor values to choose. As I understood correctly R2 is used as a weak pull down resistor for when the base is floating, and R1 is used to ensure a Vbe is 0.7 V for saturation when the Arduino pin supplies 5 V. R3 is used as a current limiting resistor in order not to fry the transistor.
How do I choose the right values for the resistors? I hope I have understood the theory correctly.