A transistor is a device that can be used as a switch. It is made from a special material and has at least three terminals for easy connection to an external circuit.
In this tutorial, we will learn how to use a NPN transistor to operate a DC motor. It will provide the motor with the necessary power.
Connect the wires between the NPN transistor, the motor and the Arduino, as shown in the image below.
Connections from the NPN transistor:
• NPN emitter pin → Arduino GND pin
• NPN base pin (middle pin) → Arduino pin 3
• NPN collector pin → Motor first wire
Connections from the motor:
• Motor first wire → NPN collector pin
• Motor second wire → Arduino VCC pin (5V)
After uploading the code to your Arduino board, you will observe the motor turning on and off every one second. You may modify this period by changing the value in the code for the delay function and trying out various outcomes.