The Black Art of Video Game Console Design: Analog Design with Discrete Components
The first two chapters were a little brutal on the theory of electronics, so in this chapter we are going to start making our turn to digital electronics and a more practical hands-on "results" approach rather than a lot of theory. That is, we are going to introduce or re-introduce a number of components and see how to use them along with some examples, rather than analyze them as we did in the previous two chapters. At the end of this chapter you should feel very comfortable with basic electronics, components, and what to use them for. You may not be able to design much in the way of complete analog systems, but you should at least be able to follow along and understand the general workings of anything later in the book that has to do with analog design. Considering that, here's what this chapter has in store:
- Basic Mechanical Components
- Capacitor Models
- Inductor Models
- Filter Design
- Diode Models
- Voltage Regulations
- Power Supply Design
- Introduction to Transistors
- Implementing Digital Logic with Transistors
- Clocking Logic
3.1 Basic Mechanical Components
Although the majority of electronics are passive components like capacitors or resistors, along with active components such as digital chips, you still need basic inputs such as switches, and ways to adjust values. These kinds of components aren’t that sexy, but they are necessary. Let’s take a look at two classes of "mechanical" components: switches and potentiometers.
Switches come in thousands of sizes and shapes. For example, Figure 3.1 depicts a number of switches from a the popular switch manufacturer SwitchCraft, found on the Internet at http://www.switchcraft.com/. They also make lots of other connectors and other cool parts. In any case, the main function of switches whether they are large or small is to interrupt or connect a signal current flow, just as the wall switch in your bedroom turns on a light. There are a number of types of switches, but they can be generally categorized into their functionality by means of describing the number of contacts or circuits they have, along with the number of possible positions. So that we have a common vocabulary, here are some terms used in switch descriptions to begin with:
- Poles—The number of switch contact sets that conduct current.
- Throw/Way—The number of conducting positions: For single or double, "throw" is used; for three or more, "way" is used.
- Momentary—Switch returns to its normal position when released. A spring is usually employed internally to accomplish this.
- Open—The switch is in the off position, contacts not conducting.
- Closed—The switch is in the on position, contacts conducting; there may be several on positions.
Figure 3.1 SwitchCraft’s plethora of switches.
18.104.22.168 Momentary Switches
The simplest switch is the momentary switch. Figure 3.2 shows a schematic diagram of two variations: normally open and normally closed. The normally open variation means that when you release the switch plunger, the circuit is open; when you press it, you close the circuit. The normally closed variation is the opposite: You press the switch to open the circuit. Figure 3.3 shows some pictures of classic momentary switches. The red cap usually means normally open, while the black cap means normally closed. In addition to the generic names, there is a more technical way of naming these switches. In Figure 3.4, you see that there is a single circuit to be opened/closed and the switch has a single state (released/depressed); thus these switches are classified as Single Pole Single Throw or SPST. What if you wanted to control two circuits at once with a single momentary switch? No problem; you simply need a Double Pole Single Throw or DPST. That means there are two circuits, but still only one state for them to be in. Figure 3.5 illustrates the schematic symbol for a DPST switch.
Figure 3.2 Normally open/closed momentary switch schematics.
Figure 3.3 Normally open/closed momentary switch examples.
Figure 3.4 Example SPST switch and circuit.
Figure 3.5 DPST switch schematic.
22.214.171.124 Slide Switches
The next type of switch is called a slide switch. Some common slide switches are shown in Figure 3.6. The point of a slide switch is that it’s not momentary, but stays in the position you leave it in. Figure 3.7 depicts the schematic symbol for a slide switch. As you can see, there are three connections on this particular switch; therefore, it can connect circuit A with B or B with C, but not A with C. The symbol on top of the switch represents the metallic or conductive slider. So this particular switch would be Single Pole Double Throw or SPDT. If there were two sets of contacts (two circuits) then we would have a Double Pole Double Throw as shown in Figure 3.8.
Figure 3.6 Common slide switches.
Figure 3.7 Schematic symbols for the slide switches.
Figure 3.8 Double Pole Double Throw switch.
126.96.36.199 DIP Switches
The word DIP switch stands for dual in-line parallel in the context of a switch; however, people sometimes will say "dual in-line package" as well. Figure 3.9illustrates the electrical symbol of a DIP and Figure 3.10 shows images of common DIP switches. DIP switches are usually nothing more that N slide switches in parallel; they are used in most cases to set hardware flags, control settings, etc. Each one of the switches is generally a SPST slide switch. You can find them in very small packages such as DIP2 all the way up DIP32. Common sizes are DIP4 and DIP8. When we get to digital electronics, we will use DIP switches all over the place; for example to set control lines that are sampled by the hardware or memory system.
Figure 3.9 DIP switch schematic.
For example, say that we need 4 control lines to either be 0 or 1; these control lines might select a memory chip or a port, who knows, but as a hardware designer we want a way to use a switch to send four 0/1 signals. Figure 3.11illustrates a DIP4 circuit that does this. Referring to the circuit, there are 4 independent switch circuits, each tied to ground, and each has a resistor connecting it to the system’s +5 power supply. All the switch circuits are identical, so we need only analyze one such as S0. When S0 is open, there is a path from the +5 supply to the output of S0, so any connection made to S0’s port will see a +5; this equivalent circuit is shown in Figure 3.12. A small current Iopen will flow in this case. As long as Iopen is very small (a few milliamps or microamps), the voltage drop over the resistor will be small and the port at S0 will have nearly +5 volts on it (a HIGH or "1" in digital electronics). The amount of current that flows depends on the resistor and the circuit that is being fed by the port. In most cases with TTL (transistor transistor logic), the load current will be milliamps, and with CMOS (Complementary Metal Oxide Semiconductor), the load current will be nearly 0 or in micro amps. The point being—the current Iopen is very small and we don’t need to worry too much about it. Now, the second case is more interesting; let’s look at that.
Figure 3.10 Images of DIP switches.
When the S0 switch is open, the port at S0 is feed with a +5 volt, but when we close the switch then we "short" S0 to ground. What happens now? Referring to Figure 3.13, there is an equivalent circuit shown for this case. There are two current branches, one from the +5 through the resistor to ground; this current Iclosed will always be
- Iclosed = V/R = +5/R
Figure 3.11 Mechanical 4-bit HIGH/LOW switch.
Figure 3.12 Equivalent circuit for single switched bit open.
Figure 3.13 Equivalent circuit for single switched bit closed.
Thus, this is one consideration when selecting R. The second current is the "sink" current needed by the device being driven to pull it down to a logic level 0; this is in the specification/data sheet and we will learn it later, but again might be a few micro to milliamps, but since we are shorting directly to ground, this current will always be sinkable. Therefore, this switch with a passive resistor array creates a 4-bit 0/1 digital signal. The one confusing thing about the arrangement is that when the switch is CLOSED or "ON," the circuit creates a 0 (0V); when the switch is OPEN or "OFF" the circuit creates a 1 (+5V). This is simply the way that it is designed.
One last note: The configuration of resistors we just saw in the DIP switch example is called "pull ups." They are named that way since they pull-up the signals. There are also pull-downs; you can pull signals down to ground as well of course. However, most designers prefer pulling signals up rather than down, since a digital "1" takes less current sometimes to generate than a digital "0", so a pull-up and short to ground is cleaner.
188.8.131.52 Rotary Switches
Rotary switches are used when you want to gate or send a signal from one (or more) sources to one of N possible destinations (old TV sets used to have these rotary switches, for example). Figure 3.14 illustrates a one pole, N-way rotary switch. The single pole can be thought of as the "common" node (not necessarily ground), and by rotating the mechanical switch you can send the common signal to any one of the N-connections. Or you can use the switch backward and think of connecting one of the N-ways to the common. For example, when I was in high school, I made a little communications network with TVs and audio for the school. They wanted to be able to send a TV signal and audio signal to one of 5 rooms from a single source. Of course this is trivial with one of these switches; assuming a common system ground for example, I sent the composite video signal to one of five rooms using a circuit as shown in Figure 3.15. A similar circuit was used for audio. Of course, I put the whole circuit in a box, labeled it really nice and added a 9V battery with some blinking lights to make it look like it did something more complicated!
Figure 3.14 A rotary switch.
Figure 3.15 A video selector circuit based on a rotary switch.
184.108.40.206 A Plethora of Switches
Although the switches we just covered are the most commonly used, there are so many kinds of switches you could literally fill a 2,000 page book with them. In other words, if you have a mechanical event that you want to detect with a switch, there’s something; I guarantee it. Some examples of exotic switching mechanisms are
- Hall Effect switches that switch or detect magnetic fields.
- Mercury switches that turn on/off based on orientation and a floating glob of conductive mercury.
- Reed switches that turn on/off based on the application of a magnetic field that effects an internal permanent magnet inside the switch.
- Pressure switches that turn on/off based on air pressure or vacuum.
Potentiometers (POT) are nothing more than variable resistors. Figure 3.16shows the schematic symbol of one along with a few actual devices. Basically, there is a knob or slide on the potentiometer that allows you to adjust the resistance from 0 to the maximum value. These are VERY useful devices. Internally, potentiometers work more or less by having the port contacts 1,2,3 connected to a piece of resistive material like carbon. When the slide or knob is turned, the current path length through the resistive element is changed as shown in Figure 3.17. Since the resistance of any material increases proportionally to its length, by placing a contact at two ends of the resistive material (contacts 1 and 3) and then placing a movable contact that makes a frictional contact to the resistive element (contact 2), you can change the resistance between contact 1 and 2 (call it R12) and between contacts 2 and 3 (call it R23) by moving the slide, knob, etc. Therefore, referring to Figure 3.17, the resistance of each branch or contact pair is simply
- R12 = X1*Re
- R23 = X2*Re
Or if the total resistance of the element is Rpot then
- R12 = X1*Re
- R23 = Rpot – R12
Figure 3.16a Potentiometer schematic
Figure 3.16b Some common POT configurations.
Figure 3.17 The mechanical operation of a slide potentiometer.
That is, the resistance is always divided between the two circuit legs, where Re is the resistance in ohms of the element per unit distance. Of course, we don’t really care about this much detail when using real potentiometers, and simply look at the specs for final resistance. So if a potentiometer is rated at 10K ohms then the resistance between contacts 1 and 3 is always 10K ohms; however, the resistance between contacts 1,2, and 2,3 changes as the potentiometer is adjusted. The specs of a potentiometer usually describe the action of the potentiometer. For example, "1-turn" would mean that there is a single 360 turn of the knob or dial that goes from 0–N. For example, let’s say that we have a 1-turn POT with a resistance of 10K. Let’s design a voltage divider with it that creates a 2.5V voltage at one of the contacts. Starting with the circuit shown in Figure 3.18a, we see that in fact, the POT can be used as a voltage divider; we also know from our study of voltage dividers that the voltage drop over each resistor R1 and R2 is simply their values divided by the sum multiplied by the source voltage.
Figure 3.18 Voltage divider circuit based on potentiometer.
Considering this, we simply need R1=R2=5.0K; this is easy! Just create the circuit as shown in Figure 3.18b and turn the knob (or dial) to 50% or half a turn, and that’s it. Of course, you need to set Vin to 5.0V (but I left it as a variable to show you that Vin is irrelevant of the voltage divider’s "action"). And the cool part is that you can adjust the voltage simply by turning the knob, so you have created an adjustable voltage supply. Of course, there’s the problem that you can only pull very little current with the supply, since any load would alter the impedance too much. However, if you were to use say a 100 ohm POT for the adjustment instead of 10K ohm and then only attach loads that pulled a few milliamperes, you would be fine.
As a final note, potentiometers are mechanical and thus have a lifetime; you can’t turn them back and forth an infinite number of times. They are fine for adjustments, but if you used them to constantly change something they would wear out and break. Also, they are nothing more than resistors internally, and thus have maximum power dissipation specifications in the watt range usually.