# How to wire up a circuit with a button that cancels other circuits

What I really want to do is slightly more complex than this but I can distill it down to the following concept. Let's say I have 4 buttons and 4 LED lights. Each button turns on 1 LED light. If any other lights are on when a button is pressed then they will automatically shut off.

I'm pretty new to electronics so the following will not be using technical terms if you can provide any in the response so I can tell the electronics store what I need that would be appreciated.

Ideally the buttons should be single action buttons i.e. no "down state". Considering that I'm assuming the momentary press of the button will have to trigger some kind of switch to turn the circuit for the LED on so that the LED will stay on. Do these switches exist and if so what are they called? Also can the button press to turn one light on also simultaneously "cancel" the other three switches for the other lights?

EDIT: Alternatively could you explain a way to have two momentary press switches and an LED. Where one switch turns the LED on and another turns it off.

Input selector in one of my amps worked that way (until I blew the chip up and had to recreate the selector since I could not get another chip).

I do not particularly like programming microcontrollers (why else would I make a dual frequency counter with a lot discrete logic chips?), so I always look for a way to avoid using one.

I made this with real buttons in mind (so I added debouncing). If you actually want to control this with logic output from some detector or chip (that does not need debouncing) you can get rid of R1-R4 and C2-C5. If your control signal is active low ("0" when the button is pressed) then leave the inverters. If your control signal is active high ("1" when the button is pressed) then you do not need to use U2C-U2F and just connect the control signals to the anodes of D1-D4.

How this works: When "1" appears on the anode of, say, D1, it also goes to the input pin of U1. The flip-flop is triggered by the riding edge of the clock. To allow for the input pin voltages to settle to their final values, a circuit made of U2A, R5, C1 and U2B delay the riding edge by a few ms. Actually, you could probably get rid of R5 and C1 too, the propagation delay of U2A and u2B would probably be enough, but I have no way of testing it without building it.

R7 and C6 reset the flop-flop to "0" (all LEDs off) state when the power is turned on, otherwise at each turn on it would get a random state.

• Wow. That is impressive but definitely way over my head. Maybe someone at the electronics store can help me make sense of it :) I'm also a little confused is this a solution to my question or the one you made for your input selector? Commented Jan 26, 2012 at 22:35
• This is for your question (four buttons - press one and the associated LED lights up, press another and another LED lights up while the previous one goes dark. LED stays on after the button is released). When I made my version of the input selector, I did not know about such wonderful things as D-type flip-flops or Schmitt triggers - I did it with a lot of transistors and a few NAND gates. I also made it for only 3 inputs as I would have needed much more NAND gates for the 4th one. Commented Jan 26, 2012 at 22:42
• Ok I might be able to figure out the drawing then. Just two questions. 1) what is U1? A 555 timer or something? What does the symbol for the U2 items mean? I can't find it in a symbol chart. Is that an LED If so what are U2A and U2B for? Oh or are the Diode symbols the LED's? Commented Jan 26, 2012 at 22:48
• U1 is a quad D-type flip-flop, a 40175 chip (not 555). Commented Jan 26, 2012 at 22:52
• Aha. I see. Ok so I need to research flip-flops. I don't know that my final product will have 4 paths, might be more or less but I should be able to use your diagram to add or remove circuits. Thank you. Commented Jan 26, 2012 at 22:59

In cases with nontrivial logic like this, it's almost always easier to put a microcontroller with 8 available GPIO pins. Then, set up 4 pins as button inputs and 4 pins as LED outputs. This would be a perfect project for an Arduino board.

• I have played around with a Parralax microcontroller before so this is definitely an option. I'm not exactly sure why but I was hoping to avoid a microcontroller. If I don't get any other answers I'll definitely look into it. Commented Jan 26, 2012 at 20:36
• It can certainly be instructional to figure out how to piece together circuit elements without writing code, but in a commercial project you would always use a microcontroller. Now, if you just don't like writing code, that is another issue :) Commented Jan 26, 2012 at 22:07
• Fair enough. This is a small hobby prop I'm building so the simpler the better. Commented Jan 26, 2012 at 22:35
• Arduinos are actually overkill for something like this. Might be easier, but not better. The cost, size, and power draw is too high for such simple tasks. However with some cleverness a small micro controller could be better. Commented Jan 26, 2012 at 23:54
• I'm optimizing for development cost, as this seems like a hobby project or learning exercise. I agree that it would be overkill for any practical application worried about BOM cost or power consumption. Commented Jan 27, 2012 at 3:49

An implementation using eight NAND gates (four 3-input and four two-input) is here. Click the four switches to change the state of the LEDs. As illustrated, button inputs and outputs are active-low. Changing the NAND gates to NOR gates would yield a similar circuit with active-high inputs and outputs. Note that the capacitor on the bottom switch is there to ensure that the circuit will power up in a predictable state (as illustrated, with the bottom LED on). If one omits it from a real circuit, it would arbitrarily come up with one of the LEDs on, but it might or might not be consistent about which one. The linked schematic is interactive; you can click the switches to see how the different gates switch.