The DC motor is widely employed in Robotics and electronics projects due to its popularity. To regulate the speed of a DC motor, there are multiple approaches available. In this particular project will employ the PWM method for controlling the motor's speed.
In this tutorial, we will learn how to control the motor speed with a potentiometer and an Arduino, using the PWM technique.
Connect the wires between the LDR and the Arduino and the LED as shown in the image below.
Connections from the Arduino to the breadboard:
• Arduino 5v pin →breadboard 5v line
• Arduino GND pin →breadboard GND line
Connections from the Rotary potentiometer to the Arduino:
• potentiometer GND pin → Arduino GND pin
• potentiometer out pin → Arduino A0 pin
• potentiometer VCC pin → Arduino 5V pin
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)
Once you’ve uploaded the code to the Arduino board, you will find that you can control the motor speed with rotating the potentiometer.