Author Topic: Discrete logic design vs a super cheap micro  (Read 6299 times)

0 Members and 1 Guest are viewing this topic.

Offline pyrohazTopic starter

  • Regular Contributor
  • *
  • Posts: 186
  • Country: gb
    • Harris' Electronics!
Discrete logic design vs a super cheap micro
« on: March 08, 2015, 02:33:01 am »
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.

 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
 

Offline dom0

  • Super Contributor
  • ***
  • Posts: 1483
  • Country: 00
Re: Discrete logic design vs a super cheap micro
« Reply #2 on: March 08, 2015, 03:14:11 am »
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.
,
 

Offline Someone

  • Super Contributor
  • ***
  • Posts: 4531
  • Country: au
    • send complaints here
Re: Discrete logic design vs a super cheap micro
« Reply #3 on: March 08, 2015, 07:55:24 am »
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.
 

Offline JuKu

  • Frequent Contributor
  • **
  • Posts: 566
  • Country: fi
    • LitePlacer - The Low Cost DIY Pick and Place Machine
Re: Discrete logic design vs a super cheap micro
« Reply #4 on: March 08, 2015, 10:17:44 am »
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.
+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.
http://www.liteplacer.com - The Low Cost DIY Pick and Place Machine
 

Offline pyrohazTopic starter

  • Regular Contributor
  • *
  • Posts: 186
  • Country: gb
    • Harris' Electronics!
Re: Discrete logic design vs a super cheap micro
« Reply #5 on: March 08, 2015, 03:08:37 pm »
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.

I'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!

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.

Nice 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!

 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19525
  • Country: gb
  • 0999
Re: Discrete logic design vs a super cheap micro
« Reply #6 on: March 08, 2015, 04:32:36 pm »
abusing chips as per the 3 nand gate jam above.
I 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.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19525
  • Country: gb
  • 0999
Re: Discrete logic design vs a super cheap micro
« Reply #7 on: March 08, 2015, 04:50:35 pm »
You need active high, rather than active low so why not use NOR gates instead?
 

Offline Someone

  • Super Contributor
  • ***
  • Posts: 4531
  • Country: au
    • send complaints here
Re: Discrete logic design vs a super cheap micro
« Reply #8 on: March 08, 2015, 09:38:43 pm »
Nice 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!
It is immune to switch bounce when you only press one button at a time, feel free to use the circuit however you like.
 

Offline Someone

  • Super Contributor
  • ***
  • Posts: 4531
  • Country: au
    • send complaints here
Re: Discrete logic design vs a super cheap micro
« Reply #9 on: March 08, 2015, 11:59:02 pm »
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.
 

Online mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13748
  • Country: gb
    • Mike's Electric Stuff
Re: Discrete logic design vs a super cheap micro
« Reply #10 on: March 09, 2015, 12:33:00 am »
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. 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 


Offline pyrohazTopic starter

  • Regular Contributor
  • *
  • Posts: 186
  • Country: gb
    • Harris' Electronics!
Re: Discrete logic design vs a super cheap micro
« Reply #12 on: March 09, 2015, 06:55:59 pm »
You need active high, rather than active low so why not use NOR gates instead?

Thats even easier to use! Thanks for the input, I'll look to prototyping this circuit.

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.

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. 

I'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?
 

Offline krivx

  • Frequent Contributor
  • **
  • Posts: 765
  • Country: ie
Re: Discrete logic design vs a super cheap micro
« Reply #13 on: March 09, 2015, 07:05:04 pm »
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...
 

Offline pyrohazTopic starter

  • Regular Contributor
  • *
  • Posts: 186
  • Country: gb
    • Harris' Electronics!
Re: Discrete logic design vs a super cheap micro
« Reply #14 on: March 10, 2015, 01:12:01 am »
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...

I'm hoping to interface the latching circuit to 4066 analog switches :)
 

Offline krivx

  • Frequent Contributor
  • **
  • Posts: 765
  • Country: ie
Re: Discrete logic design vs a super cheap micro
« Reply #15 on: March 10, 2015, 02:54:58 pm »
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...

I'm hoping to interface the latching circuit to 4066 analog switches :)

Hah, sorry, never mind then.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf