momentary pushbutton to 3-way toggle

Discussion in 'General Electronics Chat' started by kgstewar, Sep 12, 2012.

  1. kgstewar

    Thread Starter Member

    Apr 5, 2012
    151
    6
    Hi all, I am trying to turn a momentary pushbutton into a three-way toggle switch. First push - lights left LED; second push - lights the middle LED; third push - lights the right LED; fourth push - back to the left LED, etc.

    I assume this can be done with a flip-flop, but I'm such a noob, I'm not sure which to use or how to set this up. Any help greatly appreciated!

    Kevin
     
  2. Dodgydave

    Distinguished Member

    Jun 22, 2012
    4,974
    744
    Last edited: Sep 12, 2012
  3. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Actually, it would take a minimum of two flip-flops. You are describing a state-machine that has three states. Two flip-flops potentially can make a state machine that has 2λ2= 4 states. In your case, one of those is not useful, so you can think of the state machine of having only three, called 0,1,2,0,1,2,...

    Note that the solution described above using the 4017 decade counter (ten states) effectively shortens the normall counting sequence from 0,1,2,3,4,5,6,7,8,9,0,1,... to 0,1,2,0,1,2,...
     
  4. kgstewar

    Thread Starter Member

    Apr 5, 2012
    151
    6
    That makes sense re: the flip-flops. I need a flip-flop-flup. Looks like the 4017 solution is pretty simple.

    Thanks!

    Kevin
     
  5. Dodgydave

    Distinguished Member

    Jun 22, 2012
    4,974
    744
    Connect the reset pin 15 to pin 10, and it will count to 3.
     
    Last edited: Sep 12, 2012
  6. kgstewar

    Thread Starter Member

    Apr 5, 2012
    151
    6
    Thanks! Perfect solution.

    Kevin
     
  7. kgstewar

    Thread Starter Member

    Apr 5, 2012
    151
    6
    I should connect pin 7 to pin 15 so that it counts 0,1,2,0,1,2, etc., correct? Or by connecting pin 10 to reset will it cycle through and make pins 2,4,7, go to high in a repeating sequence? Thanks!
     
    Last edited: Sep 12, 2012
  8. Dodgydave

    Distinguished Member

    Jun 22, 2012
    4,974
    744
    yes, i got the wrong output;)
     
  9. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    You will have to debounce your switch to prevent multiple pulses when you depress and/or release the switch. Since the 4017 has a Schmitt trigger on the clock input, you can use a simple circuit like this. It will clock the 4017 when you release the switch. If you want it to clock when you depress the switch, swap the switch and resistor, or use a normally-closed switch.

    Note: The TI CD4017 has a Schmitt trigger clock input. Other mfr's parts may not.
     
Loading...