Find types and capacity requirements of various components.

Hello
Trying to run a 3v motor with an arduino. I have spent some time figuring out the following circuit and what the components do:

My guesses:
Transistor: digital switch. Control amount of current being supplied to the motor from the arduino PWM pin.
Resistor: reduce current to the transistor 'base' pin.
Diode: prevents reverse current whenever motor powers down.

Fairly confident that I have got the hang of it.
But I do not know how to calculate and find the types and values the components should be...

Transistor: PN2222 - a common bipolar type suggestion. Also saw a guy using a MOSFET type. Couldn't make sense when reading about different transistor types .
Resistor: Reduce the input (3v from arduino) to transistor's base pin voltage requirement ?
Diode: No idea. Haven't read about it yet.. I feel a 'simple' /or 'regular' diode put in the proper direction should do the job..

I am fairly new to all this. Any help on figuring out transistor types ? And other numbers ?

Thanks a lot!

Firstly. You will not be able to drive the motor from the 5v pin. It will not supply sufficient current.
You need to drive it from a seperate 5v source. Don't forget the common ground.
You would be a lot better off using a MOSFET.
The diode is use as a fly-back diode, and needs to be able to carry the motor current. It's purpose is to dump the reverse current generated when an inductive load (motor or coil) switches.
Fof

Hi, check this tutorial it explains everything

Despite the fact that the 5V pin can supply 400mA without any problem, in general, I avoid connecting loads on the board. Use an external battery source instead.

So I need a npn transistor. How to figure out the resistor value between PWM pin and base lead of the transistor ?

Taking as an example this DC motor

and assume that the motor spins without any load then its no-load current is 70mA (this is the collector current).

This is the datasheet of NPN2222 transistor

https://eu.mouser.com/datasheet/2/308/pn2222-d-1196047.pdf

Remember that the allowed flow current from collector to emitter is based on the base current
and the current gain beta(β) otherwise called amplification factor is the ratio of collector current to the base current.

The datasheet says that the saturation voltage between collector end emitter is specified for a beta of 10 for 150mA collector current. For 70mA collector current you can use 7mA base current and a base resistor 5V /7mA = 714Ohms (choose a resistor close to this value).

In case you wish to run your motor with some load (max loaded current form the datasheet is 250mA) then you have to recalculate the resistor based on both base and collector currents.

Also, check this application note

@Nikosant03 :smiley: An answer I was daring to hope for ! THanks

I ended up with 220 Ohm resistor.

Calculation: 220 Ohm Resistor between the transistor ( BC547 ) and a 3V motor . Measured resistance between the motor terminals is 18 Ohm, which brings the current to 160 mA . So collector current should 160/10 = 16mA
So 3V/16mA = 180. Added the nearest resistor I had = 220 Ohm

The motor runs with speed control. Pretty sure my calculations / fundamentals are off somewhere...

About having resistors depending on load. What if the load changes when running ? Would that require a more complex circuit ?

Measured resistance between the motor terminals is 18 Ohm, which brings the current to 160 mA . So collector current should 170/10 - 16mA
So 3V/16mA = 180. SO added a 220 Ohm resistor