A DC motor (Direct Current motor) is the most common type of motor. DC motors normally have just two leads, one positive and one negative. If you connect these two leads directly to a battery, the motor will rotate. If you switch the leads, the motor will rotate in the opposite direction.


Components Required:

You will need the following components:-

  • Arduino UNO
  • L293D Motor Driver IC
  • 10KΩ Potentiometer
  • Push button X 2
  • 12V DC Motor
  • 12V DC Adapter
  • Connecting wires

Circuit diagram:

Circuit design:

Circuit description:

  • As mentioned earlier, Arduino UNO and L293D Motor Driver IC are the main components of the circuit. Arduino UNO acts as the main processing part of the circuit. A button and a potentiometer are used to control the direction of rotation and speed of the motor respectively.
  • Hence, a button is connected to Pin 13 of Arduino for driving the motor in forwarding direction and another button is connected to Pin 12 of Arduino for driving the motor in reverse direction with the other terminals of both the buttons connected to ground.
  • A potentiometer i.e. the wiper terminal of the pot is connected to analog input pin A0 of the Arduino UNO. The other terminals of the potentiometer are connected to 5V supply and ground respectively.
  • L293D is a 16-pin IC available in the dual in-line package. As it is capable of driving two motors, we’ll see the connections that are needed for driving a single motor. In that,
  • Pin 1 of L293D IC is used to enable the driver channels 1 and 2 i.e. inputs of motor 1. It is an active high pin and hence it is connected to the 5V supply.
  • Pins 2 and 7 of L293D are inputs of drivers associated with motor 1. They are connected to Pins 11 and 10 of Arduino UNO respectively.
  • Pins 3 and 6 of L293D are the output pins of first driver channel. They must be connected to the motor we are going to control.
  • Pins 4, 5, 12 and 13 of the L293D IC are ground pins.
  • The remaining connections with respect to L293D IC are the power supply pins. L293D Motor Driver IC needs two types of power: one for its internal operations and other for driver channels that drive the motor.
  • Pin 16 of L293D IC is the supply pin for internal operations and is connected to a 5V supply. Pin 8 of L293D IC is the supply for driving the motor and is connected to a 12V supply.

Working process:

  • Two buttons are used in this project, one each for forward and reverse the direction of the motor. The two buttons are connected to Pins 13 and 12 of Arduino which are internally pulled-up (using code). The other terminals of the buttons are connected to ground and hence when the button is pressed, the microcontroller detects LOW (logic 0).
  • The output of the POT is an analog signal and hence it is connected to an analog pin of the Arduino. Based on the analog voltage value from the POT, the speed of the motor is varied.
  • For this to happen, we need to use the concept of PWM in the circuit. The inputs to the motor driver IC must be in the form of a PWM signal and hence are connected to Pins 11 and 10 of Arduino respectively, which are capable of generating PWM signals.
  • When the system is powered ON, Arduino waits for the button to be pressed. If the forward direction button is pressed, the Arduino drives input 1 of motor driver IC (Pin 2) with PWM signal and a logic low to input 2 (Pin 3). Hence, the motor starts rotating in forwarding direction.
  • Similarly, if the reverse direction button is pressed, Arduino drives input 2 (Pin 3) of L293D Motor Driver IC with the PWM signal and input 1 (pin 2) of L293D is given a logic low. Hence, the motor starts rotating in reverse directions.
  • The speed of the motor in either direction can be controlled using the POT as it controls the duty cycle of the output PWM signal.


  • This circuit, where a DC motor is controlled using an Arduino UNO, can be used in applications like Arduino based robots, speed as well as direct control of DC motors, etc.
  • The circuit shown here controls a single DC motor but can be extended to control two motors with independent speed and direction controls.