electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
Live streaming at radio.electro-music.com

  host / artist show at your time


Please visit the chat
 Forum index » DIY Hardware and Software » Lunettas - circuits inspired by Stanley Lunetta
basic guidelines for digital circuit design
Post new topic   Reply to topic Moderators: mosc
Page 1 of 1 [2 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message

Joined: Jan 14, 2010
Posts: 4103
Location: Moon Base
Audio files: 607

PostPosted: Sun Sep 02, 2018 11:52 am    Post subject:  basic guidelines for digital circuit design Reply with quote  Mark this post and the followings unread

Here are some basic guidelines that might be useful if you want to design your own digital circuits. This is not an introduction into
electronics and you should already know a bit (or byte) about digital logic. There is an excellent post by Rykhaard with some basic
info about electronics which you can find here and there is of course a lot more in depth information available online.

feel free to add, correct, ask or comment in any other way.

Connecting outputs and inputs together
When you want to connect a single output of a logic chip directly to an input you generally don't need any extra components.
So no pulldown/pullup resistors or diodes. (there are some exceptions but I will get into that later)

Never leave input pins unconnected (floating)
If you leave an input unconnected its state is undetermined (at least for CMOS) which can cause all kinds of odd behaviour in the
circuit. This also goes for unused gates so if you have a circuit that uses a NAND chip like a 4093 but only uses 3 of the available
gates you should not leave the input pins of the unsused gates floating. Eventhough the output is not connected to anything it could
still cause problems internally. Generally unused pins are direclty connected to GND or V+ depending on their purpose, so without
any pulldown/pullup resistors. It doesn't alway have to be GND or V+ though, for example the inputs of an unused logic gate could
be connected to any digital signal which in some case might be easier when designing a PCB.
there are cases in which you might want to leave a pin unconnected. Because of the high impedance of CMOS inputs they can act
like an antenna and if you add a wire to it it can pick up all kinds of electromagnetic 'noise' so you could use this to create some
unpredictable signals. Be careful though, inputs are sensitive to static electricity so they could get damaged.

Never connect outputs directly together
If for example you would combine 2 signals, one being high the other low it'll create a dead short which has the potential to release
some magic smoke and as you might know chips don't work without this magic smoke. Logic gates are the key for combining signals
and simple gates like OR and AND gates can be achieved with some diodes and a resistor. (more about that later). There are some
exceptions: Some chips have what is called a tri-state output. This means that besides being high or low they can also be very high
impedance which basically makes them float. You can connect these pins directly together but you have to be very careful in the
design of the circuit so that they can never be in a state where they would create any shorts. Another somewhat similar exception is
when using analog muxes or switches. Output pins of these (or actually they are bi-directional so pins can be used both as output
and input) can also be high impedance so as with tri-state outputs they could be connected together directly if you design the circuit

When to use pulldown/pullup resistors
pulldown/pullup resistors are used whenever an input pin is connected to a signal but can stil end up in a floating state. An example
of this would be when you want to control an input with a switch. Let's say you have a switch between an input and V+. When this
switch is closed the input wil be high but when the switch is open the input would be floating. By also connecting a resistor to GND
to this input (= pulldown resistor) the input will be held low when the switch is open. You could also have a switch between the
input and GND in which case you would need to add a resistor connected to V+ (= pullup resistor). pullupdown/pullup resistors can
also be needed when using analog muxes/switches or chips with tri-state outputs as these can also cause a floating state. The choice
between a pullup or puldown resistor depends on the circuit.
note: the value for these resistors is usually not very critical and values between 10K~1M are most common

Diode OR/AND (mickey mouse logic)
Allthough diodes can serve several purposes they are often used in digital circuits to create simple logic gates to combine signals. You
could use actual OR/AND gates but using some diodes and a resistor can be much more convenient, especially when you need a gate
with a lot of inputs. To make an OR gate with diodes connect all the cathodes together, this will be the output. The anodes will be the
inputs. Whenever one or more of the inputs are high the output wil be high (like a standard OR gate) but if all the inputs are low the
output would be floating (the diodes block the current flow) so usually it also needs a pulldown resistor. To make an AND gate you
connect the anodes together, which will be the output and the cathodes will be the inputs. It's a bit less obvious than an OR gate but
when one of the signals is low (in other words they're not all high) the output will be low. However when all inputs are high the output
would be floating so in this case it needs a pullup resistor on the output. Because the outputs aren't buffererd this method can't always
be used. For example it gets a bit tricky when you would want to use a diode OR to control a diode AND or drive an LED. For this reason
it is also better to avoid using them as an output stage of a circuit, at least without an extra buffer for which a transistor/opamp/
comparator or even another logic gate could be used.
Note that you only need to use diodes for signals that can be both high and low. If for example you want to combine (OR) an output
of a logic gate with a switch connected to V+ you don't need a diode for the switch as it can never be low

Transistor inverter
As with the diode OR/AND gates you could use an actual inverting logic gate but sometimes a single transistor can be a lot more convenient.
Most commonly used is a standard NPN transistor (BC547, 2N3904 etc) with the Emitter connected to GND. The Collector will be the output
but since it can only provide a low signal in this configuration it also needs a pullup resistor. The base should have a current limiting resistor
in series and be treated as other inputs so not left floating. You could also use a PNP transistor connected to V+ and a pulldown resistor but
this is not used as often. One big advantage of a transistor over an actual logic gate is that it can be used to convert voltages. For example
controllling a logic circuit powered by 12V with 5V signals will usuallly not work but a transistor only needs about 0.7V on the base so 5V is
plenty and with a pullup resistor connected to 12V the output can now switch between GND and 12V with a much lower control voltage.

Although you could just use outputs of CMOS chips as they are it's wise to add a current limiting resistor in series to protect the ouputs
from accidental shorts. Personally I also add diodes in series which makes it possible to connect multiple outputs to one input as they
will form a diode OR together with the pulldown resistors I use on inputs. Downside of this method is that the outputs can only be high
because low signals are blocked by the diodes, so sometimes I have to add an extra pulldown resistor for example when I want to
listen to an output.

I won't go into the details but it is generally good practise to connect a small capacitor (10nF~100nF) between the supply pins of every
chip as close to the V+ pin as possible. Often these lunetta circuits might work fine without them but it can make the difference between
it properly working or not. There are cases where you don't want to use them, for example the Cacophonator which actually creates an
unstable supply voltage on purpose.

* (I might add some images later) *

"My perf, it's full of holes!"
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider

Last edited by PHOBoS on Yesterday, at 4:21 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger

Joined: Nov 23, 2015
Posts: 822
Location: Netherlands
Audio files: 27

PostPosted: Tue Sep 04, 2018 12:00 am    Post subject: Reply with quote  Mark this post and the followings unread

Good initiative Phobos!

I'd like to add my 2 cents on outputs.
As Phobos pointed out there are more than one type of outputs but one type of output has not been discussed so far, there is what is called a totempole output or push-pull output where the output can sink and source current (usually the sink capacity is more than the maximum source current, but there is also an open collector output, which can only sink current, it is nothing more as a dedicated transistor where the collector is connected to the output of the chip.
So in order to use this output you have to provide a resistance to VCC in order to have some current to sink.
What are the common uses for an open collector output? Well first you can use it to as Phobos called Mickey Mouse Logic where one resistor is connected to VCC and the other end to a multiple of outputs (logic AND), secondly you can use (some, not all open collector outputs) it as a level shifter, where the chip is powered from VCC and the resistor from the open collector could be tied to the + 15 volt.
HERE you will find the datasheet of the SN7407, a hex open collector buffer/driver

SN7407 open collector
 Filesize:  16.37 KB
 Viewed:  594 Time(s)


my synth
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: mosc
Page 1 of 1 [2 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Lunettas - circuits inspired by Stanley Lunetta
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.

Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use