When we started this series on digital logic (CMOS, or complementary metal oxide semiconductors to be exact) we made the bold assertion that digital logic had only two states, high and low. Or near the positive supply and near ground, respectively. In the last installment of this series we will take liberties with this assertion.
The CMOS 4000 series of digital logic doesn’t have to be the mundane old if this AND this OR this, then THAT of most logic designs. As a matter of fact, we can get creative with our little logic circuits and make them do a lot of things that their inventors never thought of.
Making Sense of It
In the aircraft environment, we have the normal five senses (vision, hearing, touch, taste and smell) to let us perceive what the airplane is trying to tell us. However, every now and again, wed like to augment the perception with a boost to the airplanes own outputs. In particular, sometimes wed like a huge clanging bell to go off at the inception of a hiccup of the internal mechanisms of the machine.
Most often this bell will come in the form of a noise that we can inject into the pilots hearing sense to let the pilot know that there is something that demands immediate attention. Bell, buzzer, clanger…an unusual noise of some sort to gently alert the occupant of the left front seat that attention may be war-ranted-now. So we need a noisemaker. Electron-pounders call this an oscillator, and digital CMOS can be made an oscillator without too much fanfare.
What does an oscillator do? It gives out a signal (a tone if you will) without any input. It rings. And the frequency at which it rings? Somewhere in the human hearing range of 300 to 3000 up-and-down excursions per second. In electronspeak, this is 300 to 3000 Hertz (abbreviate Hz) or cycles per second.
The most annoying tone is somewhere between 1000 and 1500 Hz. What does this sound like? Well, for you instrument-rated folks, the middle marker is 1300 Hz to give you an idea. The outer marker is a rather soothing 400 Hz, and the inner/fan marker is a screechy 3000 Hz, but the middle marker is generally the one that gets my attention in that Id better see concrete ahead of me at that point, or I get to do the whole thing over again.
What this boils down to is that if I want something to catch my attention, Ill design my oscillator to give me a raspy square wave (digital up-down-up-down) at about 1000 Hz. I can then feed this raspy tone into an alarm input of the audio panel or intercom to drive the headphones of the occupants of the plane.
Not a problem. Any three inverters give me a perfectly wonderful way of making a foolproof square wave. An inverter can be a true inverting buffer, a NOR gate, or a NAND gate (See Figure 1). Or it can be leftover combinations of these three logic functions from elsewhere in your design. Mix and match; it makes no difference to the oscillator. Unless I absolutely need a particular gate of some sort, the circuits I show you will use the generic inverting buffer, but remember that you can use leftover inverting gates of any sort to make your own oscillators.
Start at the Beginning
The first oscillator is the always start under any conditions three-gate design. Actually, you can use any odd number of gates you wish, but three is the minimum. This circuit will oscillate for any values of R and C that you pick. I like to make R2 = 2 x R1 just to keep the current draw down a bit, but certainly R2 can be made extremely high if you wish; R1 and C1 determine the frequency of oscillation in accordance with the approximate formula f = 0.6/(R x C) where f is the frequency of oscillation in Hz, R is R1 in ohms and C is C1 in farads. We generally know what frequency we want, and most of us have an extensive parts shelf of resistors but only a limited selection of capacitors, so we can rearrange the equation to say that R = 0.6/(f x C).
Say, for example, that we want to have our frequency of oscillation 1400 Hz and we have 10 nanofarad (10 x 10-9 ) capacitors to work with. That means (using the magic ENG function of the calculator) that R1 has to be 4285 ohms. Thats kind of clumsy as resistors only come in standard values. The closest value is 4300 ohms (4.3kΩ), and this will slightly lower the oscillator frequency to 1395 Hz, but as they say, thats good enough for the folks I fly with. Using the closest 10% value resistor (rather than the 5% value of 4300Ω) of 3.9kΩ would raise the frequency to about 1500 Hz. and using the next higher value of 4.7kΩ would lower it to 1300 Hz or so.
Now if you keep the value of C1 relatively high (say, over 1 nf or 1000 pf), you can get away with using a two-gate oscillator. The equations are roughly the same, but if C1 drops below a critical level, the circuit will refuse to oscillate. What is the critical level? It depends on a whole host of things like power supply voltage, temperature, stray circuit leakage and capacitance, and a lot of others that are more subtle. Suffice it to say that a nanofarad (a thousand picofarads) will generally overcome these limitations, and the oscillator will sing nicely.
If you want a minimalist oscillator, the inverting Schmitt trigger buffer uses one buffer, one resistor and one capacitor. It is absolutely self-starting and will work with any values of R and C. They just don’t get any easier or cheaper than that.
Bonus Material
And now for the goodies. In general, we want the oscillator to give us an alarm only under specific conditions such as loss of oil pressure, overtemp on the cylinder heads and stuff like that. How you sense these conditions has been covered in my columns over the years ad nauseam. However, once you have the mechanical quantity converted to an electrical signal, you can turn the oscillator on and off by the application of a high (using a NAND gate) or a low (using a NOR gate).
There will be times when you need a very accurate frequency. There are cheap crystals that are used in wristwatches to keep accurate time. They cost about two bits apiece in onesie-twosies from Mouser and half a dozen other sources. They oscillate at exactly 32.768 kHz, which may seem like an odd number until you realize that you can use a CMOS digital divider to divide this frequency by 214 and come up with an output that is exactly 2 Hz. Whats magic about 2 Hz you ask? Tick-tock-tick-tock… With a low-frequency crystal like this I tend to use very high value resistors (10MΩ for R2 and 470kΩ for R1) and capacitors at C1 and C2 that set the frequency exactly spot on. Start with 33 pf for both C1 and C2 and tweak as necessary to get the frequency dead on.
With higher frequency (and more rugged mechanically) crystals above, say, 1 MHz or so, drop the values of R2 to about 1 MΩ and R1 down to about 4.7 kΩ. Again, start with 33 pf for both C1 and C2 and tweak for the correct frequency.
I’ll bet you never thought you could do so much with cheap digital logic as we’ve done over the last three months, but now you know all my digital secrets. Almost.
Wow, where from here? Well, Ive been asked several times to explain how baluns and splitters work, so how about we take a look at the magical things you can do with a little bit of coaxial cable. Then from there, who knows? So much to do, so little time in which to do it.