3 way latching switch (Or "ternary flip-flap-flop")

Discussion in 'The Projects Forum' started by SimL, Jan 15, 2016.

  1. SimL

    Thread Starter New Member

    Jan 15, 2015
    7
    0
    Hi,

    Last year I built a simple SR latch circuit (with two NAND gates) to switch between two pair of speaker with relays, in my home studio. The latch circuit activated a relay + a LED in the pushbutton switch.

    It works really well: when I press the first pushbutton, it lights up, and the audio signal is routed to the first set of speakers via relays. When I press the second pushbutton, it lights up and turns off the first, and the audio signal is routed to the second set of speakers. And vice versa... as a simple SR latch is supposed to do.

    Now I have a 3rd pair of speakers, so I want to make a 3 way latch circuit that works just like the SR latch, but can't find any way to build it...

    The only relevant information I found is this. But it's only a block diagram, it won't show how to do it. A couple of logic gates? Or a chip?

    I've tried in a simulator with all sorts of combinations, 3 gates of 3 inputs of all sorts, but nothing worked. I'm pretty sure there's a way to do it, and I must not be the only one who tried this... But I can't get my head around this "logic puzzle"!!

    What would be the simplest possible way to make a 3 way latching circuit, also called a "flip-flap-flop"?

    Thanks in advance,
     
  2. SimL

    Thread Starter New Member

    Jan 15, 2015
    7
    0
    UPDATE:

    On the link I posted, I read fast, I thought it was a block diagram, but it is 3 input NOR gates. I tried it in a simulator, and it almost worked, as the C output will never be high... (image attached)

    Almost there, but not quite.... (why doesn't it work, it seems super logical??)
     
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    I have not seen such a circuit.

    To do something like this I would use 3 conventional flip flops. Each one of 3 buttons would set one flip flop while resetting the other two.

    You would also need something to insure only one flip flop (or none) is on when you first turn this on.
     
  4. crutschow

    Expert

    Mar 14, 2008
    12,974
    3,220
    Here's a circuit I put together that does the Radio PB function, which is what you want.
    It's perhaps overkill since it will handle 2 to 8 PBs (or even 16) but it's reasonably simple, requiring only 2 ICs, so you may want to consider it.
     
    Last edited: Jan 20, 2016
    djsfantasi, SimL and absf like this.
  5. Nykolas

    Member

    Aug 27, 2013
    87
    31
    Here is a 1-of-4 circuit. The 0.1uF across the OFF switch assures off on power-up. E
     
    SimL and absf like this.
  6. SimL

    Thread Starter New Member

    Jan 15, 2015
    7
    0
    Cool, thanks for the fast answer guys!!

    Crutschow's design looks really neat and simple, perfect when more than 4 options is needed. Really well explained, I am considering it. :)

    Nykolas' design looks cool and simple as well... Good to know that a quad SR Latch exists. I have some questions about the design, though:

    -There's 4 outputs, one "off" and 3 "programs", are they just names but in the end the 4 outputs are the same?
    -I assume the 4 input NAND gates are for resetting the other latches, but why two cascaded gates? The second one is an inverter? Why not use a 4 input AND gate instead? And why the .01uF cap between the two? Looks like a coupling cap, as in a class A amplifier design... Does it have a similar function? Can this part be done in a simpler way?
    -Why darlington transistors instead of BJTs? More power for the relay coils?

    In general, with relays:
    -What's the difference between 12V relays, 9V or 5V relays? Am I right to say they just different choices to adapt different chosen voltage rails, so using a simple 5V relays can be as efficient? (Since logic ICs vcc are 5V)

    Thanks guys!
     
  7. crutschow

    Expert

    Mar 14, 2008
    12,974
    3,220
    It will work fine with just 3 inputs, of course.
    Yes, the second is just an inverter. You could use one AND gate instead.
    The capacitor performs a RC differentiate function to generate a short (one-shot type) reset signal from the leading edge of the PB pulse to reset all the latches.
    The difference is the relay pull-in voltage and the coil resistance (current).
    Lower voltage relays of the same type require more coil current to operate.
     
    SimL likes this.
  8. SimL

    Thread Starter New Member

    Jan 15, 2015
    7
    0
    Thanks Crutschow.

    Oh, that makes sense! Didn't saw the RC configuration right away, as simple as it is.

    But what is the advantage of having a very short reset signal instead of the pushbutton directly?
     
  9. hp1729

    Well-Known Member

    Nov 23, 2015
    1,936
    218
    Re: flip flap flops
    What is so profound. It is called "Radio Buttons. Like car radio channel selectors.
     
    Last edited: Jan 18, 2016
  10. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,515
    1,246
    This is a variation of a game show circuit, something that latches on the first button pressed. Lotsa examples on the net. However... I direct selection a requirement? In other words, would a single-button stepping selector circuit be good enough? If so, look at the CD4017. This is a decade counter already decoded into 10 outputs that are stepped through with each clock pulse. Tie output #3 to the reset and you have a 3-stage stepper. There is a little bit more to a complete circuit, but not much.

    ak
     
  11. crutschow

    Expert

    Mar 14, 2008
    12,974
    3,220
    The advantage is, it won't work otherwise. :rolleyes:
    If you reset all the latches with the PB directly then the latch you are trying to set would have a simultaneous set and reset signal, so its output would be indeterminate when the PB is released.
     
    SimL likes this.
  12. SimL

    Thread Starter New Member

    Jan 15, 2015
    7
    0
    Exactly what I want! Super profound, eh! :D
    I thought you were the winner for the simplest circuit of this thread as it seems exactly what I'm searching for, but when I try it on the Falstad Java Circuit Simulator here, it doesn't work at all! The two input NAND gate will never give a low output, since the other input seems to stay low... Is your circuit incomplete, and has some parts that are taken for granted? Kind of a "EE slang"? (lol)

    Direct selection a requirement, yes. I want to be able to go from pair 1 to pair 3 with a single button, for example. And at a glance, with an illuminated pushbutton, see which is turned on.

    ______

    I know I might be complicating myself for nothing, as I could have 3 switches that routes the signal to each pair of speakers, like this overwhelmingly super simple product. This is my "plan C" to make one like that. However, I find pushbuttons and latching circuits far more classy and fun, so why not!! :D

    I thought it would only be a super simple "logic-gates puzzle" to go from a 2 way latch to a 3 way, but it seems a little more complex than that.
    However, the 4532&4514 (crutschow's circuit) or the 4044 (Nykolas') will do the job juuust fiiine. :cool:

    Thanks for your help y'all, but if somebody has a way to do it that works with a couple of gates only, as in hp1729's or the link I posted at the beginning of this thread, I'm curious!
     
  13. crutschow

    Expert

    Mar 14, 2008
    12,974
    3,220
    You may need to add pull-down resistors to the input for the simulation of hp1729's circuit.
    Resistors would certainly be required in any real circuit since an open input is undefined (not necessarily a logic 0).
     
  14. SimL

    Thread Starter New Member

    Jan 15, 2015
    7
    0
    Even there... I've added them here

    I found on the Falstad Circuit Simulation, we can put "logic input" component, that has "L" for low and "H" for high, and work like a pushbutton. More clean drawing, but still doesn't work, I did it here

    PS: How cool is that, a Java Circuit Simulator that can "run" in real time, see voltages and currents.. I knew it for a while, and for educational purposes, it's really cool. I tried by trial & error all kind of logic gates combinations to find an answer to my question...

    Plus, I found yesterday that we can
    "export circuit as a link".... for sharing in a forum like AAC, it's friggin awesome!!!!!!!!!!
     
  15. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,515
    1,246
    Here is a generic, one-chip, latching switch interface with open switch line termination, switch debounce, etc. Mutual exclusivity is left to the operator. With different latch chips and resistor networks it can be shrunk down to 2 inputs or expanded to 16 inputs or more. The 2N7002 is on one output as a relay driver example.

    ak
    SelectorSwitchLatch-1-c.gif
     
    absf and crutschow like this.
  16. crutschow

    Expert

    Mar 14, 2008
    12,974
    3,220
    I like the simplicity of your circuit, ak.
    But for reliable clock operation it specs a minimum rise-time of 4μs to 15μs depending upon the supply voltage, so it needs a debounce circuit that generates a fast rise time but a slow decay time.
    A series capacitor with a diode across it should work.

    Other ICs that could be used are the 4174 Hex-D FF and the 4175 Quad-D FF.
     
  17. hp1729

    Well-Known Member

    Nov 23, 2015
    1,936
    218
    Re: low out
    True, it is a high out. If you need a complete circuit hold on a minute.
    Okay, 3 ICs. Relays of your choice. I didn't know what kind you had in mind.
    Disadvantages ... no "off" option. Some set is always selected.
    It was done in TTL, but can be converted to CMOS easily.
     
    Last edited: Jan 19, 2016
  18. crutschow

    Expert

    Mar 14, 2008
    12,974
    3,220
    Have you actually gotten that circuit to work? :confused:
    I can't get it to operate in LTspice.
     
  19. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,515
    1,246
    Always dangerous to disagree with Wally, but (assuming you meant a maximum rise time...) ...

    Nope. Your statement is correct for normal latch operation, but in this case there is no penalty for the internal clock edge oscillating briefly due to a slow input risetime. And speeding up the attack edge puts it within the switch bounce period, leading to random results. As long as the switch is stable before the latch calms down, don't care about either. The "right" way is to use the first switch edge to start a 20-50 ms monostable, and have its trailing edge pulse the clock. But empirical data says this circuit has worked as is for a couple of decades.

    ak
     
    Last edited: Jan 19, 2016
    absf likes this.
  20. crutschow

    Expert

    Mar 14, 2008
    12,974
    3,220
    Ah, I got my minimums and maximums mixed up again. :oops:

    So you are saying the circuit works with a clock rise-time much slower than the spec. (?)
    Well, that may work in a single case, but it's certainly not good design. :eek:
    As you say, the correct way is to use a delayed trigger for the clock, That could be done with an RC delay into a Schmitt trigger gate such as the 4093 or 4106.
     
Loading...