# logic circuit to control a DC motor

#### J7NF

Joined Mar 12, 2016
18
I need to use 2 push button switches to control a dc motor, such as when I press sw1 then sw2 the motor will be on. If I press again sw1, the motor will be off and if it is followed by a press to sw 2 the motor will start again. Any help in this issue ???
Especially what are the logic gates used in this circuit and how they are connected to the 2 switches and the motor ?

#### shteii01

Joined Feb 19, 2010
4,644
Truth table, where?

#### Marcus2012

Joined Feb 22, 2015
390
I'm assuming these are momentary switches? You could use a 556 timer with each switch representing the trigger and reset of each individual 555 in bistable configuration. Using these with a XNOR gate you'd get the correct truth table you'd need

The problem then would be keeping the motor inactive initially. You could use a DPST momentary on the primary switch to deactivate a pull up circuit for one of the XNOR inputs. However this element would have to have no impact on consecutive pushes or at least a complementary switching pattern.

Last edited:

#### shteii01

Joined Feb 19, 2010
4,644
I'm assuming these are momentary switches? You could use a 556 timer with each switch representing the trigger and reset of each individual 555 in bistable configuration. Using these with a XNOR gate you'd get the correct truth table you'd need

View attachment 102359

The problem then would be keeping the motor inactive initially. You could use a DPST momentary on the primary switch to deactivate a pull up circuit for one of the XNOR inputs. However this element would have to have no impact on consecutive pushes or at least a complementary switching pattern.
I think I was wrong. They need state diagram more than truth table. The description goes:
State 1: 11 (but they are not pushed together, so some kind of latching is needed) ( motor on)
State 2: 01 (switch 1 unlatched) (motor off)
State 3: 00 (motor on)

Is it ok for me to say that I want to be a simpleton and I just want to use a uC?

#### Marcus2012

Joined Feb 22, 2015
390
I think I was wrong. They need state diagram more than truth table. The description goes:
State 1: 11 (but they are not pushed together, so some kind of latching is needed) ( motor on)
State 2: 01 (switch 1 unlatched) (motor off)
State 3: 00 (motor on)

Is it ok for me to say that I want to be a simpleton and I just want to use a uC?
Yeah a uC could be used to good effect here. Of course I would have no idea how to do that lol Suppose it just depends on the OPs skill level there and if there are any other circuit considerations. Are these literally the only two buttons on the device?

#### J7NF

Joined Mar 12, 2016
18
I think I was wrong. They need state diagram more than truth table. The description goes:
State 1: 11 (but they are not pushed together, so some kind of latching is needed) ( motor on)
State 2: 01 (switch 1 unlatched) (motor off)
State 3: 00 (motor on)

Is it ok for me to say that I want to be a simpleton and I just want to use a uC?

this is the correct state table that you have mentioned, but I couldn't applied it correctly to the circuit. I have used NAND gates to form SR latches. This is ok with sate 2 and 3 but the problem is in state 1, that the motor will start directly if you push button 2 only and in my case I need to push Sw 1 then Sw 2 to operate the motor

#### J7NF

Joined Mar 12, 2016
18
I think I was wrong. They need state diagram more than truth table. The description goes:
State 1: 11 (but they are not pushed together, so some kind of latching is needed) ( motor on)
State 2: 01 (switch 1 unlatched) (motor off)
State 3: 00 (motor on)

Is it ok for me to say that I want to be a simpleton and I just want to use a uC?

#### Attachments

• 16 KB Views: 13

#### J7NF

Joined Mar 12, 2016
18
Yeah a uC could be used to good effect here. Of course I would have no idea how to do that lol Suppose it just depends on the OPs skill level there and if there are any other circuit considerations. Are these literally the only two buttons on the device?
yes, they are the only 2 buttons used in the circuit

#### absf

Joined Dec 29, 2010
1,948
Perhaps the attached circuit is what you want. The 74LS74 uses 5V while the motor is using 10V.

If you want to use the same voltage < 15V for both logic and motor and the inputs are active High, you may use 4013 instead.

allen

#### J7NF

Joined Mar 12, 2016
18
Perhaps the attached circuit is what you want. The 74LS74 uses 5V while the motor is using 10V.

If you want to use the same voltage < 15V for both logic and motor and the inputs are active High, you may use 4013 instead.

View attachment 102382
allen
Ok thank you, I will try this

#### J7NF

Joined Mar 12, 2016
18
Perhaps the attached circuit is what you want. The 74LS74 uses 5V while the motor is using 10V.

If you want to use the same voltage < 15V for both logic and motor and the inputs are active High, you may use 4013 instead.

View attachment 102382
allen
I have tried this configuration using 7474 and it has worked, but still I have the problem at state 1 where if I press SW 2 directly the motor will be on and in my project it is required to press sw 1 then sw2 to operate the motor, so the motor should not operate directly when press sw 2.
Any help regarding this issue ??
and what about using 7476 the JK flip-flop instead of the 7474

#### Marcus2012

Joined Feb 22, 2015
390
I'm still testing it but I think this would do the trick. Uses a 7473 negative edge JK.

The resistor value are just arbitrary at the moment and would depends on the supply voltage/current for the motor

FYI I bridged the 5V and 9V rails here unintentionally I've fixed it in my next diagram

Last edited:

#### absf

Joined Dec 29, 2010
1,948
I'm still testing it but I think this would do the trick. Uses a 7473 negative edge JK.

View attachment 102408

The resistor value are just arbitrary at the moment and would depends on the supply voltage/current for the motor
In this circuit, while the motor is running and you press SW2 again it would stop. Pressing SW2 again it would start the motor again.

But if you remove the wire between ~Q to J of !C1b, then it should work as what the TS requested.

Allen

P/S: does it work if the motor is connected to the emitter of the transistor?

#### Marcus2012

Joined Feb 22, 2015
390
In this circuit, while the motor is running and you press SW2 again it would stop. Pressing SW2 again it would start the motor again.

But if you remove the wire between ~Q to J of !C1b, then it should work as what the TS requested.

Allen

P/S: does it work if the motor is connected to the emitter of the transistor?
The jumper is only there to match potential between J and ~Q it doesn't make difference if it's removed. You are right though in the fact that a second press of SW2 will deactivate the motor but a third press will not reactivate it unless SW1 is pressed again first. I'll keep think about how to adjust that. The motor is connected to the emitter.

#### J7NF

Joined Mar 12, 2016
18
Thank you for your efforts, also I am thinking in using two 7474 D-flip flop as SR, by connecting D and clk in each one to the ground. Any idea how to connect the two 7474 to each other and to the circuit, to obtain the required states mentioned before.

#### Marcus2012

Joined Feb 22, 2015
390
Now this version will come on when you press SW1 then SW2 and will only deactivate on another press of SW1 BUT will only reactivate when SW2 is then pressed so on etc... That was what you wanted correct?

EDIT Problems resolved see below

Last edited:

#### Marcus2012

Joined Feb 22, 2015
390
Here you go I figured it out in the end, probably worth checking of course . Just required some feedback from the second JK and a different initial state. This will now follow your required state diagram. Bear in mind this uses momentary (push to make) and not latching switches and you still need to determine your resistor values for the pull ups and base resistor and what NPN would be appropriate. Not sure what voltage (or current draw) your motor is but these TTL ICs need a 5 volt regulated supply so if your supply is higher than that for you motor you can just put a 7805 regulator in for the logic. You might also want to consider a general power switch further upstream in the circuit just so the power to the logic etc. isn't always on, unless you want it to be of course .

Last edited:

#### J7NF

Joined Mar 12, 2016
18
Here you go I figured it out in the end, probably worth checking of course . Just required some feedback from the second JK and a different initial state. This will now follow your required state diagram. Bear in mind this uses momentary (push to make) and not latching switches and you still need to determine your resistor values for the pull ups and base resistor and what NPN would be appropriate. Not sure what voltage (or current draw) your motor is but these TTL ICs need a 5 volt regulated supply so if your supply is higher than that for you motor you can just put a 7805 regulator in for the logic. You might also want to consider a general power switch further upstream in the circuit just so the power to the logic etc. isn't always on, unless you want it to be of course .

View attachment 102423
Thanks, this what I want. I will try the configuration that you have provided and see if it works

#### J7NF

Joined Mar 12, 2016
18
Thanks, this what I want. I will try the configuration that you have provided and see if it works
If I am using the 7476 Jk any idea where to connect the PR of each one, and I connected the C the same as the 7473's