## A Motor which Reverse the Direction of Rotation in Alternative Presses of Switch

by realfinetime  |  in Motor Driver at  04:12

We have already seen A Push Button Switch that Turn On a Motor in First Push and Turn Off the Motor in Next Push. Here we will design a circuit with a push button switch which will rotate a motor in one push and change the direction of rotation of motor in next push.

Circuit is done as shown in the following diagram.

Components needed in the circuit

5V Voltage source  - Normally supplied from a 5V Voltage Regulator.
Pull up Resistors 1K  - 4
Push Button Switch   - 1
7473 J K Flip-Flop IC - 1
L293D Motor Driver   - 1
5V DC Motor    - 1

Complete the circuit as given above. Motor will rotate, when 5V is given to the circuit. Now press the push button switch. Motor will reverse the direction of rotation. Again press the switch. This will reverse the direction of rotation of motor again. Motor will change the direction of rotation, in each alternative pushes of push button switch.

Pinout diagram of 7473

Pinout diagram of 7473 is given below. Each 7473 has two master-slave J K flip-flips. Half portion of IC, above VCC and ground constitutes the first flip-flop and the half portion below VCC and Ground constitutes the second master-slave flip-flop. First flip-flop is used for this circuit.

Truth Table of 7473

From the truth table, we can conclude that:

1. When CLR is LOW, Q will be LOW and Qbar will be HIGH. These outputs will not change, even if the other inputs ( J, K and CLK)  change, until CLR is set to HIGH.
2. When CLR becomes HIGH, if J is LOW and K is HIGH, Q becomes LOW and Qbar becomes HIGH during the next negative transition.
3. When CLR becomes HIGH, if J is HIGH and K is LOW, Q becomes HIGH and Qbar becomes LOW during the next negative transition.
4. When CLR becomes HIGH, if J and K are HIGH, Q and Qbar will toggle in each negative transitions.
5. When CLR becomes HIGH, if J and K are LOW, Q and Qbar will remain in the previous state and is independant of the state of CLK input.

Why pull up resistors ?.

5V is given to J, K, CLK and CLR through pull up resistors. Pull up resistors helps to pull the inputs ( J, K, CLK and CLR )  to a HIGH value always. When the push button switch turns on, CLK input get grounded through the push button switch. Then, CLK will get LOW voltage.

If the same circuit is done without connecting the pull up resistors of proper resistance, when the swith turns on, power supply get shorted through the switch. High current will flow through the switch due to low resistance of the path. This may damage the power supply and gate operation will not take place.

Why push button switch ?.

Push button switch is connected in between the CLK and ground as shown in the circuit. Push button switch is most suitable for this purpose, because by default it will be in off state. A switch in off state means, CLK gets a HIGH voltage. When the switch is pressed, CLK get grounded and will get a LOW voltage. When press is released, switch will automatically turn off and CLK will get HIGH voltage.

Pinout Diagram of L293D

L293D is a popular motor driver. It is special by its high current and voltage rating. Each L293D can be used to control two motors. First motor is connected across 1Y and 2Y. Second motor is connected across 3Y and 4Y. 1A and 2A are the control pins for first motor. Similarly 3A and 4A are the control pins for second motor. Here, the circuit is demonstrated to control Motor ( M1 ) connected across 1A and 2A.

Truth Table of L293D

Direction of rotation as per the control signals is represented in the following table. Motor will rotate, if there is a voltage difference between 1A and 2A pins ( 1A=1, 2A=0 ). Motor will change the direction of rotation, if voltage difference is reversed ( 1A=0, 2A=1 ). Motor will not rotate, if there is no voltage difference between 1A and 2A ( 1A=1, 2A=1 or 1A=0, 2A=0 ).

Working of Circuit

Row encircled by a red line in the truth table of 7473 is used for this circuit. When CLR, J and K becomes HIGH, output will toggle in each negative transitions of the CLK input. Negative transition will occur when the push button switch is pressed. If the switch is pressed, CLK get grounded. Then a transition of CLK input from HIGH to LOW will occur. At this moment, if the output ( Q1 ) is HIGH, it will become LOW. Similarly, if the output ( Q1 ) is LOW, it will become HIGH. If the switch is released, CLK input will change from LOW to HIGH voltage. No change will happen to the output during the positive transition of CLK input.

In this circuit, 1A pin of L293D ( Pin 2 ) is connected to Q1 of 7473 and 2A pin of L293D ( Pin 7 ) is connected to Q1bar pin of 7473. From the truth table of L293D, we know that, motor will rotate, if there is a voltage difference between 1A and 2A pins. A HIGH at 1A and LOW at 2A will rotate the motor in one direction. Similarly, a LOW at 1A  and HIGH at 2A will rotate the motor in other direction. That is, when Q1 becomes HIGH, and Q1bar becomes LOW, motor will rotate in one direction. When Q1 becomes LOW and Q1bar becomes HIGH, motor will rotate in opposite direction. During toggling of master-slave J K flip flop, Q1 and Q1bar becomes HIGH and LOW in each alternatives pushes of push button switch.

More options:
If you want to change the direction of rotation of motor when circuit starts working, interchange the pins of motor connected to 1A and 2A of L293D.

#### 1 comment:

1. Hi, I got a question about that circuit. I want to use two dc motorc that will reverse direction of its rotation at the same time. So here's my question. Can i connect pin Q1 and Q2 from flip flop to the 1A,2A and 3A, 4A to control both motors, will it work?

## IMPORTANT NOTICE

All the circuits, published in this blog is only after testing and getting proper results in my private lab. When you try these circuits, you should check the supply voltage, polarity of components, presence of childrens nearby and shorts in the circuits. This website will not be responsible for any harm happened to you or your components caused by your carelessness.