Auto-reversible DC motor with speed and rotation control

Ashutosh M. Bhatt is M.Tech in embedded systems. Currently, he is a lecturer of electronics and radio engineering at Government Polytechnic, Jamnagar, Gujarat


DC motors are widely used in different machines, mechanisms and motion controls in manufacturing and processing industries. In these machines, it is often required to control speed, direction and the number of rotations of the motor. Some applications require only motor speed control, some only rotation control and some only direction control. Many applications require control of two or all three parameters. Some examples are:

1. To release the thread (or wire) of desired length from a bobbin, it is required to rotate the bobbin for a specific number of rotations. Also, there is a need for controlling the speed at which the thread is released.

2. In a coil-winding machine, it is required to make a specific number of coil turns. This is done by rotating the motor for a specific number of rotations. Also, it is required to vary the motor speed to speed up/down the operation.

3. In a conveyor belt application, to move the object to an exact distance, it is required to rotate the motor for a desired number of rotations.

4. In an automatic storage and retrieval system, it is required to rotate the motor clockwise and anticlockwise to move up and down, or left and right. Also, the motor has to be rotated for a desired number of rotations to reach a specific position.

5. In a robotic arm, to pick and place an item, it is required to rotate the motor clockwise and anticlockwise for a desired number of rotations. Speed control is also required for slow or fast operation, accordingly.

There are many more examples and applications where it is required to control speed, direction and rotations of a DC motor.

Auto reversible DC motor control project

This project is an auto-reversible DC motor that automatically reverses when it completes the desired number of rotations. It is an example of a closed-loop control system that utilizes feedback loop. It counts the actual number of motor rotations and gives feedback to the system. The system compares a set of rotations with actual motor rotations, and when these match, it reverses the motor.
It can repeat this operation in a continuous loop if repeat mode is selected. It also controls the speed of motor from 10 to 100 per cent.

The motor starts with 10 per cent speed and gradually attains the selected speed as it completes three to six rotations. Also, when the motor reaches the last six to ten revolutions, the speed gradually decreases, and for the last two rotations it becomes 10 per cent. This speed control is used to precisely stop the motor at the desired number of rotations point and for smooth operation.

The project utilises an ATmega16 microcontroller to control the DC motor, an LCD display to show various parameters and an opto-interrupter sensor to count motor rotations and provide feedback. The author’s prototype, including motor-sensor arrangement, is shown below.

Author’s prototype with motor-sensor arrangement
Author’s prototype with motor-sensor arrangement

Circuit and working

Circuit diagram of the auto reversible DC motor control is shown below. It is built around opto-interrupter module MOC7811(IC1), ATmega16 microcontroller (IC2), 16×2 LCD (LCD1), motor driver L293D (IC3), 12V DC motor (M1) and a few other components.
Four push-to-on button/tactile switches (S1 through S4) are connected to port C pins PC0, PC1, PC6 and PC7 of IC2, so that when a button is pressed, it gives a high logic (1) input to the corresponding pin. These switches are used for various settings to control the motor, including up, down, enter and rotation.

Circuit diagram of the auto reversible DC motor control
Circuit diagram of the auto reversible DC motor control

LCD1 is connected to port A and port D of IC2. Its data pins are connected to port A, and the control pins EN and RS are connected to PD0 and PD1, respectively. LCD1 displays the number of rotations and speed of the DC motor.

Port D pin PD7 and port B pin PB3 of IC2 drive the DC motor through motor driver chip L293D. These pins are connected to input pins 2 and 7 of the L293D, and output pins 3 and 6 of the L293D are connected to the motor (M1) terminals.

PB3 and PD7 are PWM output pins. PWM output on these pins will vary the speed of motor. Also, when PB3 generates PWM, PD7 is off and the motor rotates in forward (clockwise) direction, and when PD7 generates PWM, PB3 is off and motor rotates in reverse (anticlockwise) direction.

Opto-interrupter sensor MOC7811 consists of an IR LED and a phototransistor. The internal IR LED is forward-biased to keep it continuously on. A current-limiting resistor (R1) of 330-ohm is used to limit the current flowing through it. Output of the phototransistor is given as input to the base of transistor T1 that is connected in switch mode. Final output of the sensor circuit is taken from collector of T1. This output is given to external interrupt 0 input pin PD2 of ATmega16.


Please enter your comment!
Please enter your name here