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 PNP transistor to operate a DC motor. It will provide the motor with the necessary power.
Connect the wires between the PNP transistor, the motor, and the Arduino, as shown in the image below.
Connections from the PNP transistor:
• PNP emitter pin → Motor first wire
• PNP base pin (middle pin) → Arduino pin 3
• PNP collector pin → Arduino GND pin
Connections from the motor:
• Motor first wire → PNP 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.