Discrete logic design vs a super cheap micro - Page 1
Forum section: electronics / projects

author: pyrohaz
author_rank: Regular Contributor
timestamp: March 08, 2015, 02:33:01 am
content: Hi all,I'm designing a 3 way analog channel selector (for audio frequencies) and I've designed a logic circuit that will so the individual channel selection just fine. It uses a schmitt trigger IC, an or gate IC, 3 transistors, 3 dual cathode diodes and a couple of resistor, amongst other parts.I see no reason to use a microcontroller other than it might potentially be a little more reliable (...speculative?) so I'd like some feedback from you guys!Realistically, the circuit should take three inputs - from switches, and when one switch is pressed, the corresponding output should be latched e.g. if switch A is pressed, input A is routed to the output.

author: Rufus
author_rank: Super Contributor
timestamp: March 08, 2015, 02:52:05 am
content: https://www.eevblog.com/forum/projects/3-way-soft-latching-switch-circuit/

author: dom0
author_rank: Super Contributor
timestamp: March 08, 2015, 03:14:11 am
content: Well I'd personally just use a rotary switch to directly select the channel, but if you really want a momentary switch to do it you can do it with a 4017 easily.

author: Someone
author_rank: Super Contributor
timestamp: March 08, 2015, 07:55:24 am
content: Your "discrete" solution is still a bit heavy, below is solving it with NC switches. It does not scale as well as the other solutions using a latch, but for 3 switches this is close to the minimum without abusing chips as per the 3 nand gate jam above.

author: JuKu
author_rank: Frequent Contributor
timestamp: March 08, 2015, 10:17:44 am
content: Quote from: dom0 on March 08, 2015, 03:14:11 am+1. Superior channel separation and no need to worry about power supplies, protection, signal levels vs switch voltage etc.If you insist on electronic switch, a micro gives the potential of remote control, but a microcontroller (with clock and clock polluted power supply) creates a potential problem of noise leaking into signals. solvable of course, but you need to watch out for that.

author: pyrohaz
author_rank: Regular Contributor
timestamp: March 08, 2015, 03:08:37 pm
content: Quote from: dom0 on March 08, 2015, 03:14:11 amI'm looking to use it as a foot pedal to switch between three audio channels so while a rotary switch - or even a three position toggle switch, would be easier to use and have all the listed advantages by JuKu, its a bit hard to rotate a switch with your foot!Quote from: Someone on March 08, 2015, 07:55:24 amNice design! The fact you can pretty much eliminate all the schmitt triggers and or gates in my design gives yours a massive advantage. Does switch contact bounce affect the operation of the circuit? If you're alright with me using your circuit, I'd like to point that (in simulation of course) adding parallel capacitors to the base resistors allows you to set initial conditions which is useful for selecting which channel is selected on power up!

author: Zero999
author_rank: Super Contributor
timestamp: March 08, 2015, 04:32:36 pm
content: Quote from: Someone on March 08, 2015, 07:55:24 amI agree that's not the proper way to do it.If you go for that solution then add some current limiting resistors before the switches (the tiny surge probably won't damage the gate but it's likely to put a glitch on the power rail) and power supply decoupling capacitors are a must.

author: Zero999
author_rank: Super Contributor
timestamp: March 08, 2015, 04:50:35 pm
content: You need active high, rather than active low so why not use NOR gates instead?

author: Someone
author_rank: Super Contributor
timestamp: March 08, 2015, 09:38:43 pm
content: Quote from: pyrohaz on March 08, 2015, 03:08:37 pmIt is immune to switch bounce when you only press one button at a time, feel free to use the circuit however you like.

author: Someone
author_rank: Super Contributor
timestamp: March 08, 2015, 11:59:02 pm
content: Here is abusing the internal pullups integral to LS logic to reduce part count for the scaleable width solution, but it results in active low logic for the outputs.From here on out its better to switch to a micro controller, as you can use the internal pullups and oscillators to reduce part count. Knowing the Atmel parts well with the internal 128kHz oscillator prescaled down to a few dozen Hz and properly filtered power supply rails noise wont be a problem, they also have pin change interrupts so it can stay in a sleep mode most of the time and it shouldnt be worse than a logic gate when switching.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: March 09, 2015, 12:33:00 am
content: The answer depends a lot on how many you want to build, and other aspects like power supply voltage available.Micro will often have the lowest parts count, and maybe BOM cost, and will be alot more flexible (e.g. allowing nonvolatile storage of selection) but you need to factor in the cost of writing code and programming the device.

author: Tomorokoshi
author_rank: Super Contributor
timestamp: March 09, 2015, 03:22:50 am
content: How about an analog multiplexer?http://www.digikey.com/product-search/en/integrated-circuits-ics/interface-analog-switches-multiplexers-demultiplexers/2556671?k=analog%20multiplexer&stock=1Something like this?http://www.digikey.com/product-detail/en/ADG704BRMZ-REEL/ADG704BRMZ-REELCT-ND/4885446

author: pyrohaz
author_rank: Regular Contributor
timestamp: March 09, 2015, 06:55:59 pm
content: Quote from: Hero999 on March 08, 2015, 04:50:35 pmThats even easier to use! Thanks for the input, I'll look to prototyping this circuit.Quote from: Someone on March 08, 2015, 11:59:02 pmQuote from: mikeselectricstuff on March 09, 2015, 12:33:00 amI'm quite likely only going to be building these devices for myself! I've recently got acquainted with the MSP430 series of chips, or I could use one of the STM32F0 TSSOP chips (smallest pin count package) though this seems like a bit of an overkill surely? Would it be worth considering a PSoC by Cypress? I know they have configurable analog blocks so maybe I could do all the switch reading and analog multiplexing in one chip?

author: krivx
author_rank: Frequent Contributor
timestamp: March 09, 2015, 07:05:04 pm
content: What kind of audio signals are you switching? It's possible that the FET switch solutions may work better than single transistor circuits in terms of distortion...

author: pyrohaz
author_rank: Regular Contributor
timestamp: March 10, 2015, 01:12:01 am
content: Quote from: krivx on March 09, 2015, 07:05:04 pmI'm hoping to interface the latching circuit to 4066 analog switches

author: krivx
author_rank: Frequent Contributor
timestamp: March 10, 2015, 02:54:58 pm
content: Quote from: pyrohaz on March 10, 2015, 01:12:01 amHah, sorry, never mind then.