How do transistors work in conjunction with motors?

I'm currently on project #9(Motorized Pinwheel) of the Arduino Starter Kit's Projects book which involves the use of a DC(spinning) motor in conjunction with an Arduino, and the book im using states that motors typically require more current that what the Arduino can provide, and that the Arduino can only provide 40mA, which is much less than what most motors require to do work.

However, the book states

Transistors are components that allow you to control high current and high voltage power sources from the low current output of the Arduino


Motors require special consideration when being controlled by a microcontroller.Typically the microcontroller cannot provide enough current and/or voltage to power a motor.Because of this, you use transistors to interface between the two.

I've done some googling and know the basics of how transistors works (e,g doping, n-type and p-type) but i don't see why attaching a transistor to a circuit/microcontroller that outputs less current that the motor requires magically makes the motor works.

I would really appreciate any clarification and/or explanations.

A transistor can control a large current flowing from collector to emitter with a small current flowing from base to the emitter.
The arduino can only supply a small current so you use the transistor to amplify that small current so it is large enough to drive your motor.

Think of the transistor as a switch. The thing doing the switching on a normal switch would be your finger. What's being switched, is the mains power in your room light. The supply is there, you merely switch it on by jabbing the lever on the switch.

In your motor circuit, the supply to the motor is there all along, at say 12V and able to provide say 5A. The supply goes through the load and is connected to one leg of the transistor (the Collector of an NPN) and needs to go out the other side of the transistor (the Emitter of an NPN). If the transistor is a switch, then your finger is the Arduino data line. Instead of physically throwing the switch, the Arduino sends a high on the data line to the transistor 3rd leg (the Base) which switches on the connection inside, so the motor supply can go through the transistor.

Have a read of this page:-

Thanks for replying mike and jinbo! Your answers really helped clarify the questions i had! XD