Need help finding an IC/circuit to latch only one output at a time. - Page 1
Forum section: electronics / beginners

author: mikeylikesit
author_rank: Newbie
timestamp: November 13, 2017, 03:55:34 pm
content: Hello all, first post.I need help selecting an IC. When I search DigiKey I get too many results because I don't know the name of what I need.I have an old stereo with mechanical source select switches. The audio runs right through them and the resultant sound quality is awful. I plan to replace them with transistors and momentary buttons.I am looking for an IC that can take at least 5 momentary inputs and hold a corresponding output pin high until the next press, kind of like an XOR gate but with 5 inputs and 5 latched outputs. I have tried to figure out how to use discrete gates and simple latches but that's a little above my ability, so I'm trying to find an IC to do the job.Can someone recommend a specific part, or even just tell me what this thing is called? I'd also be happy with a proposed schematic using discrete components.Attached is a drawing of the circuit I'm planning. When a button on the left is pushed, only the output directly across from it should remain on, the rest (including the one that was just on) should go off. I don't especially care how it behaves when more than one are pressed at a time, or startup state, provided only one output at a time is ever held high.

author: paulca
author_rank: Super Contributor
timestamp: November 13, 2017, 04:08:14 pm
content: A SR Latch on each output would do.Switch 1 to Set 1, Reset 2, 3, and 4Switch 2 to Set 2, Reset 1, 3, and 4... and so on ...Might be a more elegant way though.A register IC would work, but getting the clock pulse at the right time might be tricky. Basically your buttons would be the data bus, but you would need to delay a few ms and then fire a pulse on the enable pin to latch the output. Also need to wire the output enable to ON.

author: Zero999
author_rank: Super Contributor
timestamp: November 13, 2017, 04:09:40 pm
content: BJTs will sound even worse than switches because they're very non-linear. J-FETs will be better but the gates will need to be biased below the drain-source voltage, to turn them off.Analogue switch ICs can be purchased for this sort of thing. Presumably you want to switch one input between five different possible signals? A 1:8 analogue multiplexer, such as the 74HC4051, will do that. To get the latching action you need, a microcontroller could be connected to those switches, to generate the appropriate binary code for the multiplexer.http://www.ti.com/lit/ds/symlink/cd74hc4051-ep.pdf

author: danadak
author_rank: Super Contributor
timestamp: November 13, 2017, 04:12:02 pm
content: Use PSOC 4.http://www.cypress.com/documentation/development-kitsboards/psoc-4-cy8ckit-049-4xxx-prototyping-kitsNot only give you the logic but also the analog switches to gate the audio.Regards, Dana.

author: Benta
author_rank: Super Contributor
timestamp: November 13, 2017, 05:38:39 pm
content: Why not keep the original button system, but rewire it for DC signals to control analog switches?

author: danadak
author_rank: Super Contributor
timestamp: November 13, 2017, 06:09:01 pm
content: See attached.Basically the control is by grounding with an open drain outputthe audio channel of interest.Code handles switch debounce and latch behavior.You could use debouncer component, and analog on chip muxes, but would takea more expensive part to route.Regards, Dana.

author: eblc1388
author_rank: Frequent Contributor
timestamp: November 13, 2017, 06:31:21 pm
content: Quote from: mikeylikesit on November 13, 2017, 03:55:34 pmThis is one I drawn up years ago.The use of 4017 will ensure one and only one output is high. The circuit works for 10 selections but fewer is OK. You can drive external transistors using a 10K resistors from Q0 to Q9 outputs. You can also use clock signal from another oscillator with a higher frequency.

author: eblc1388
author_rank: Frequent Contributor
timestamp: November 14, 2017, 08:41:22 am
content: Just for fun I did a simulation on the above circuit.In the simulation, U2 and U3 emulate user push button with the closing time at 200ms and 650ms respectively. CD4017 reset pin is fitted with a power ON reset circuit(C1/R2) to ensure 4017 Q0 is HIGH upon power On. The clocking to the CD4017 is a 1000Hz source. This is not critical. It can be any frequency between 1KHz and 20KHz.At t=200ms, user pushes button U2. Output Q6 is turned ON six milliseconds later, as the outputs Q1..Q5 has each has to go high for one clock pulse. Therefore it is important that whatever circuit connects to these outputs will be driven high for period of one clock pulse as the 4017 cycles to the correct output. A higher clocking frequency will be better as the unwanted state can be as short as possible. For example, a 1ms output pulse is not likely to pull ON a relay but will be bad for other applications.Once Q6 is HIGH, it stays HIGH if there is no other user inputs or user releases the push button. At t=650ms, user pushes U3 button. Q6 is immediately goes LOW, then Q7 goes high for one clock pulse, follows by Q8..Q9..Q0..Q1..Q2..Q3...until Q4 goes high and stays high. There is a 9x clock delay between Q6 goes low and Q4 goes high. Therefore the delay for the output to goes high can varies from one clock pulse to a maximum of ten clock pulses.

author: David Hess
author_rank: Super Contributor
timestamp: November 14, 2017, 05:19:51 pm
content: I like Paulca's set-reset latch idea which can be made up with flip-flops which have set-reset inputs; some variation of a 7474 would be typical. Drive the set and reset signals from the pushbutton switches through an array of diodes or transistors.Eblc1388's idea is simpler however it steps through the undesired functions which may not be ideal.

author: eblc1388
author_rank: Frequent Contributor
timestamp: November 14, 2017, 06:37:42 pm
content: Quote from: David Hess on November 14, 2017, 05:19:51 pmThat can be easily eliminated.Feeds the outputs of 4017 to a octal transparent latch HC373, and connects the /CE of 4017 to that of the LE pin of HC373.When the HC373 latch-enable (LE) input is high, the Q outputs follow the data (D) inputs. When LE is low(where 4017 is cycling through varies outputs), the Q outputs are latched at the logic levels of the D inputs.

author: mikeylikesit
author_rank: Newbie
timestamp: November 16, 2017, 04:20:38 pm
content: Thanks everyone, so many great ideas!I looked through my parts box and found a couple quad NAND gates, some N-FETs, and an 8 bit multiplexer, so I'm planning to basically combine the ideas of Hero999 and paulca, plus the diode array steering like David Hess mentioned, so I'll be like this:pushbutton --> diode array --> SR latches (one per multiplexer input) --> N-FET (to carry the audio path).I would like to get a chip with analog switches like the 74HC4051 eventually, but I really enjoy completing a project with what I have on hand and not paying Digikey $13 to ship $8 worth of parts, so I'll just try to come up with a layout that works for the chip I have and one I could order, and socket it so I can change it out later.I'll post some pictures when I finish the project.

author: macboy
author_rank: Super Contributor
timestamp: November 17, 2017, 03:15:45 pm
content: After you figure out the control part, you need to address the actual audio switching. You willnothave success with cleanly switching audio signals with BJT transistors. A BJT acts like a current-controlled current source (with some current gain, the Hfe of the transistor). They won't work in this application.You might have success with FETs. A FET acts as a voltage-controlled variable resistance. In this way, it can act as a switch for analog signals. Even easier, get some variation of an "analog switch" or "analog mux" IC, such as 4053, 4052, 4066, etc (different prefixes based on manufacturer: CD4066, 74HC4066 etc). These package up FETs along with the appropriate circuitry to drive them, and accept digital logic inputs to control everything. In either case, you need to realize that the FET isn't perfect, and its resistance will vary with the signal level. This will cause distortion, unless you take care todesign outthe effect of this variable resistance. In general, all that is needed is a low source impedance to drive the input of the FETs, and a high load impedance on the other side. Then the variation of resistance in the FET has virtually no effect on the signal level. This means, buffer each input with an op-amp as a unity gain follower, and send the outputs of those to the inputs of the analog MUX IC (or discrete FETs if you choose). The output of the MUX/FETs should then connect to another opamp as a unity gain follower. You'll want to AC couple (DC block) at some point too, as some offset is likely to be introduced.The above is OK if you want a completely solid-state solution. I'd personally be tempted to use relays since they will negate the requirement for the additional opamps, and will have much less crosstalk. If looking at relays, be absolutely certain to use signal relays, (a.k.a. telecom relays), not power relays. They really are different, and a power relay will end up making bad connections after a while, if used for small signals.

author: paulca
author_rank: Super Contributor
timestamp: November 17, 2017, 04:02:43 pm
content: Would it be OTT to use switched opto isolators? So the BJT just switches in the correct set of optos?

author: macboy
author_rank: Super Contributor
timestamp: November 17, 2017, 09:07:41 pm
content: Most optos have a BJT output transistor, so you haven't gained anything.