I have been trying to create a DC motor controller that can do numerous actions with just the use of one button.

Basically when I click it has to go on way, when I click again it has to stop, and again it has to go the other way and vise versa only using one button. I've been attempting this with a D-FLIP-FLOP, but I have encountered multiple problems along the way that have me thinking new ways to solve it. Any ideas to this silly, but funny problem?

  • 3
    \$\begingroup\$ Seems like a job for a small microcontroller. \$\endgroup\$ Feb 22, 2019 at 11:43
  • \$\begingroup\$ Yes. Solve it using a microprocessor \$\endgroup\$
    – Huisman
    Feb 22, 2019 at 11:44
  • 1
    \$\begingroup\$ You can also differentiate between short press and long press, double click etc. using only that one button. \$\endgroup\$
    – Huisman
    Feb 22, 2019 at 11:46
  • \$\begingroup\$ I don't want to do it with a microprocessor. Takes all the fun out of it \$\endgroup\$
    – Kritix
    Feb 22, 2019 at 12:44
  • 2
    \$\begingroup\$ 2 bit counter (4 different modes) - logic gates (decoder) - power amplifier (h-bridge) \$\endgroup\$
    – R.Joshi
    Feb 22, 2019 at 13:39

1 Answer 1



simulate this circuit – Schematic created using CircuitLab

Figure 1. A CD4017 decade counter with reset on Q4.

How it works:

  • On each press of SW1 the outputs switch sequentially on Q0, Q1, etc.
  • Q1 is wired to your forward control and Q3 is wired to your reverse control. When Q0 or Q2 is on the motor is off.
  • When Q4 is reached it pulls the reset pin high and resets the count.

Problem: on power-up the counter could be at any state including > 4. A solution to this is shown in my answer to Power circuit with a push button. Alternatively you can feed the reset pin via diodes connected to Q4, 5, 6, 7, 8 and 9 to force a reset should the device power up in one of those states.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.