Apple I Replica Creation -- Appendix E: Electrical Engineering Basics

Appendix E

Electrical Engineering Basics



Introduction


Understanding how hardware hacks work usually requires an introductory-level understanding of electronics. This appendix describes electronics fundamentals and the basic theory of the most common electronic components. We also look at how to read schematic diagrams, how to identify components, proper soldering techniques, and other engineering topics.

This appendix is not going to turn you into an electronics guru, but it will teach you enough about the basics so that you can start to find your way around. For more detail on the subject, see the suggested reading list at the end of this appendix.


Fundamentals


It is important to understand the core fundamentals of electronics before venturing into the details of specific components. This section provides a background on numbering systems, notation, and basic theory used in all facets of engineering.


Bits, Bytes, and Nibbles


At the lowest level, electronic circuits and computers store information in binary format, which is a base-2 numbering system containing only 0 and 1, each known as a bit (a portmanteau of binary digit). By comparison, the common decimal numbering system we use in everyday life is a base-10, which consists of the digits 0 through 9.

Electrically, a 1 bit is generally represented by a positive voltage (SV, for example), and a 0 bit is generally represented by a zero voltage (or ground potential). However, many protocols and definitions map the binary values in different ways.

A group of 4 bits is a nibble (also known as a nybble), 8 bits is a byte, and 16 bits is typically defined as a word (though a word is sometimes defined differently, depending on the system architecture you are referring to). Figure E.1 shows the interaction of bits, nibbles, bytes, and words. This diagram makes it easy to grasp the concept of how they all fit together.


Figure E.1 Breakdown of a 16-Bit Word into Bytes, Nibbles, and Bits


The larger the group of bits, the more information that can be represented. A single bit can represent only two combinations (0 or 1). A nibble can represent 24 (or 16) possible combinations (0 to 15 in decimal); a byte can represent 28 (or 256) possible combinations (0 to 255 in decimal); and a word can represent 216 (or 65,536) possible combinations (0 to 65,535 in decimal).

Hexadecimal format, also called hex, is commonly used in the digital computing world to represent groups of binary digits. It is a base-16 system in which 16 sequential values are used as base units before adding a new position for the next number (digits 0 through 9 and letters A through F). One hex character can represent the arrangement of 4 bits (a nibble). Two hex characters can represent 8 bits (a byte). Table E.1 shows equivalent number values in the decimal, hexadecimal, and binary number systems. Hex characters are sometimes prefixed with 0x or $ to avoid confusion with other numbering systems.

The American Standard Code for Information Interchange, or ASCII (pronounced ask-key), is the common code for storing characters in a computer system. The ASCII character set (Table E.2) uses 1 byte to correspond to each of 128 different letters, numbers, punctuation marks, and special characters. Many of the special characters are holdovers from the original specification created in 1968 and are no longer commonly used for their original intended purpose. Only the decimal values 0 through 127 are assigned, which is half of the space available in a byte. An extended ASCII character set uses the full range of 256 characters, in which the decimal values of 128 through 255 are assigned to represent other special characters that are used in foreign languages, graphics, and mathematics.

Decimal Binary Hex   Decimal Binary Hex
0 0 0   20 10100 14
1 1 1   21 10101 15
2 10 2   22 10110 16
3 11 3   23 10111 17
4 100 4   24 11000 18
5 101 5   25 11001 19
6 110 6   26 11010 1A
7 111 7   27 11011 1B
8 1000 8   28 11100 1C
9 1001 9   29 11101 1D
10 1010 A   30 11110 1E
11 1011 B   31 11111 1F
12 1100 C   32 100000 20
13 1101 D   ... ... ...
14 1110 E   63 111111 3F
15 1111 F   ... ... ...
16 10000 10   127 1111111 7F
17 10001 11   ... ... ...
18 10010 12   255 11111111 FF
19 10011 13        
Table E.1 Number System Equivalents: Decimal, Binary, and Hexadecimal


Dec Hex Char   Dec Hex Char   Dec Hex Char   Dec Hex Char
0 0 NUL (null)   32 20 Space   64 40 @   96 60 `
1 1 SOH (start of heading)   33 21 !   65 41 A   97 61 a
2 2 STX (start of text)   34 22 "   66 42 B   98 62 b
3 3 ETX (end of text)   35 23 #   67 43 C   99 63 c
4 4 EOT (end of transmission)   36 24 $   68 44 D   100 64 d
5 5 ENQ (enquiry)   37 25 %   69 45 E   101 65 e
6 6 ACK (acknowledge)   38 26 &   70 46 F   102 66 f
7 7 BEL (bell)   39 27 '   71 47 G   103 67 g
8 8 BS (backspace)   40 28 (   72 48 H   104 68 h
9 9 TAB (horizontal tab)   41 29 )   73 49 I   105 69 i
10 A LF (line feed)   42 2A *   74 4A J   106 6A j
11 B VT (vertical tab)   43 2B +   75 4B K   107 6B k
12 C FF (form feed)   44 2C ,   76 4C L   108 6C l
13 D CR (carriage return)   45 2D -   77 4D M   109 6D m
14 E SO (shift out)   46 2E .   78 4E N   110 6E n
15 F SI (shift in)   47 2F /   79 4F O   111 6F o
16 10 DLE (data link escape)   48 30 0   80 50 P   112 70 p
17 11 DC1 (device control 1)   49 31 1   81 51 Q   113 71 q
18 12 DC2 (device control 2)   50 32 2   82 52 R   114 72 q
19 13 DC3 (device control 3)   51 33 3   83 53 S   115 73 s
20 14 DC4 (device control 4)   52 34 4   84 54 T   116 74 t
21 15 NAK (neg. acknowledge)   53 35 5   85 55 U   117 75 u
22 16 SYN (synchronous idle)   54 36 6   86 56 V   118 76 v
23 17 ETB (end of trans.)   55 37 7   87 57 W   119 77 w
24 18 CAN (cancel)   56 38 8   88 58 X   120 78 x
25 19 EM (end of medium)   57 39 9   89 59 Y   121 79 y
26 1A SUB (substitute)   58 3A :   90 5A Z   122 7A z
27 1B ESC (escape)   59 3B ;   91 5B [   123 7B {
28 1C FS (file separator)   60 3C <   92 5C \   124 7C |
29 1D GS (group separator)   61 3D =   93 5D ]   125 7D }
30 1E RS (record separator)   62 3E >   94 5E ^   126 7E ~
31 1F US (unit separator)   63 3F ?   95 5F _   127 7F DEL
Table E.2 The Standard ASCII Character Set


Reading Schematics


Before we get into the theory of individual electronic components, it is important to learn how circuit designs are drawn and described. A schematic is essentially an electrical road map of a circuit. Reading basic schematics is a good skill to have, even if it is just to identify a particular component that needs to be removed. Reading schematics is much easier than it may appear, and with practice it will become second nature.

In a schematic, each component of the circuit is assigned its own symbol, unique to the type of device it is. The United States and Europe sometimes use different symbols, and there are even multiple symbols to represent one type of part. A resistor has its own special symbol, as does a capacitor, diode, or integrated circuit. Think of schematic symbols as an alphabet for electronics. Table E.3 shows a selection of basic components and their corresponding designators and schematic symbols. This is by no means a complete list, and as mentioned, a particular component type may have additional symbols that aren't shown here.

Component Designator Symbol
Resistor R
Potentiometer (variable resistor) R
Capacitor (nonpolarized) C
Capacitor (polarized) C
Diode D
LED D
Photodiode D
Transistor (NPN) Q
Transistor (PNP) Q
Crystal Y
Switch SW
Pushbutton switch SW
Speaker LS
Fuse F
Battery BT
Ground None
Ground None
Ground None
Table E.3 Designator and Schematic Symbols for Basic Electronic Components


A part designator is also assigned to each component and is used to distinguish between two parts of the same type and value. The designator is usually an alphanumeric character followed by a unique numerical value (R1, C4, or SW2, for example). The part designator and schematic symbol are used as a pair to define each discrete component of the circuit design.

Figure E.2 shows an example circuit using some of the basic schematic symbols. It describes a light-emitting diode (LED) powered by a battery and controlled by a switch. When the switch is off, no current is able to flow from the battery through the rest of the circuit, so the LED will not illuminate. When the switch is on, current will flow and the LED will illuminate.


Figure E.2 An Example Circuit: A Basic LED with a Current-Limiting Resistor and Switch


Voltage, Current, and Resistance


Voltage and current are the two staple quantities of electronics. Voltage, also known as a potential difference, is the amount of work (energy) required to move a positive charge from a lower potential (a more negative point in a circuit) to higher potential (a more positive point in a circuit). Voltage can be thought of as an electrical pressure or force and has a unit of volts (V). It is denoted with a symbol V, or sometimes E or U.

Current is the rate of flow (the quantity of electrons) passing through a given point. Current has a unit of amperes, or amps (A), and is denoted with a symbol of I. Kirchhoff's Current Law states that the sum of currents into a point equals the sum of the currents out of a point (corresponding to a conservation of charge).

Power is a "snapshot" of the amount of work being done at that particular point in time and has a unit of watts (W). One watt of power is equal to the work done in one second by one volt moving one coulomb of charge. Furthermore, one coulomb per second is equal to one ampere. A coulomb is equal to 6.25 x 1018 electrons (a very, very large amount). Basically, the power consumed by a circuit can be calculated with the following simple formula:

P = V x I

where

  • P = Power (W)
  • V = Voltage ( V)
  • I = Current (A)


Differentiating Between Voltage and Current

We use special terminology to describe voltage and current. You should refer to voltage as going between or across two points in a circuit—for example, "The voltage across the resistor is 1.7V." You should refer to current going through a device or connection in a circuit—for example, "The current through the diode is 800mA." When we're measuring or referring to a voltage at a single given point in a circuit, it is defined with respect to ground (typically 0V).


Direct Current and Alternating Current


Direct current (DC) is simple to describe because it flows in one direction through a conductor and is either a steady signal or pulses. The most familiar form of a DC supply is a battery. Generally, aside from power supply or motor circuitry, DC voltages are commonly used in electronic circuits.

Alternating current (AC) flows in both directions through a conductor (see Figure C) and is arguably more difficult to analyze and work with than DC. The most familiar form of an AC supply is an electrical outlet in your home. In the United States and Canada, these outlets provide 120V AC at 60Hz (cycles per second). In other parts of the world, varying AC voltages and line frequencies are used.


Figure E.3 An Example of an Alternating Current Waveform


Several terms are used to describe the AC signal:

  • Peak voltage (VPEAK). The maximum positive and negative points of the AC signal from a center point of reference.
  • Peak-to-peak voltage (Vpp). The total voltage swing from the most positive to the most negative point of the AC signal.
  • Root-mean-square (RMS) voltage (VRMS). The most common term used to describe an AC voltage. Since an AC signal is constantly changing (as opposed to DC, in which the signal is constant), the RMS measurement is the most accurate way to determine how much work will be done by an AC voltage.

For a typical sinusoidal AC signal (like the one shown in Figure E.3), the following four formulas can be used:

Average AC Voltage (VAVG) = 0.637 x VPEAK = 0.9 x VRMS

VPEAK = 1.414 x VRMS = 1.57 x VAVG

VRMS = 0.707 x VPEAK = 1.11 x VAVG

Vpp = 2 x VPEAK


Resistance


Resistance can be described with a simple analogy of water flowing through a pipe: If the pipe is narrow (high resistance), the flow of water (current) will be restricted. If the pipe is large (low resistance), water (current) can flow through it more easily. If the pressure (voltage) is increased, more current will be forced through the conductor. Any current prevented from flowing (if the resistance is high, for example) will be dissipated as heat (based on the first law of thermodynamics, which states that energy cannot be created or destroyed, simply changed in form). Additionally, there will be a difference in voltage on either side of the conductor.

Resistance is an important electrical property and exists in any electrical device. Resistors are devices used to create a fixed value of resistance. (For more information on resistors, see the "Basic Device Theory" section in this appendix.)


Ohm's Law


Ohm's Law, proven in the early 19th century by George Simon Ohm, is a basic formula of electronics that states the relationship between voltage, current, and resistance in an ideal conductor. The current in a circuit is directly proportional to the applied voltage and inversely proportional to the circuit resistance. Ohm's Law can be expressed as the following equations:

V = I x R

or...

I = V ÷ R

or...

R = V ÷ I

where...

  • V = Voltage (V)
  • I = Current (A)
  • R = Resistance (in ohms, designated with the omega symbol, Ω)


Basic Device Theory


This section explores the five most common electronic components: resistors, capacitors, diodes, transistors, and integrated circuits. Understanding the functionality of these parts is essential to any core electronics knowledge and will prove useful in designing or reverse-engineering products.


Resistors


Resistors are used to reduce the amount of current flowing through a point in a system. Resistors are defined by three values:

  • Resistance (Ω)
  • Heat dissipation (in watts, W)
  • Manufacturing tolerance (%)

A sampling of various resistor types is shown in Figure E.4. Resistors are not polarized, meaning that they can be inserted in either orientation with no change in electrical function.


Figure E.4 Various Resistor Types


The value of a resistor is indicated by an industry-standard code of four or five colored bands printed directly onto the resistor (Figure E.5). The bands define the resistance, multiplier, and manufacturing tolerance of the resistor. The manufacturing tolerance is the allowable skew of a resistor value from its ideal rated value.


Figure E.5 Resistor Color Code Chart


A resistor's internal composition can consist of many different materials, but the most common three types are carbon, metal film, and wire-wound. The material is usually wrapped around a core, with the wrapping type and length corresponding to the resistor value. Carbon-filled resistors, used in most general-purpose applications such as current limiting and nonprecise circuits, allow a 5% tolerance on the resistor value. Metal film resistors are for more precise applications such as amplifiers, power supplies, and sensitive analog circuitry; they usually allow a 1% or 2% tolerance. Wire-wound resistors can also be very accurate.

When resistors are used in series in a circuit (Figure E.6), their resistance values are additive, meaning that you simply add the values of the resistors in series to obtain the total resistance. For example, if R1 is 220 ohms and R2 is 470 ohms, the overall resistance will be 690 ohms.


Figure E.6 Resistors in Series


Parallel circuits provide alternative pathways for current flow, although the voltage across the components in parallel is the same. When resistors are used in parallel (Figure E.7), a simple equation is used to calculate the overall resistance:

1 / RTOTAL = (1 / R1) + (1 / R2) + ...

This same formula can be extended for any number of resistors used in parallel. For example, if R1 is 220 ohms and R2 is 470 ohms, the overall resistance will be 149.8 ohms.

For only two resistors in parallel, an alternate formula can be used:

RTOTAL = (R1 x R2) / (Rl + R2)


Figure E.7 Resistors in Parallel


Carbon and metal film resistors typically come in wattage values of 1/16W, 1/8W, 1/4W, 1/2W and 1W. This corresponds to how much power they can safely dissipate. The most commonly used resistors are 1/4W and 1/2W. For high-current applications, wire-wound resistors are typically used because they can support wattages greater than 1W. The wattage of the resistor usually corresponds to its physical size and surface area. For most consumer electronics, resistors greater than 1W are seldom used. To calculate the required wattage value for your application, use the following equation:

P = V x I

or...

P = I2 x R

where...

  • P = Power (W)
  • V = Voltage across the resistor (V)
  • I = Current flowing through the resistor (A)
  • R = Resistance value (Ω)


Capacitors


A capacitor's primary function is to store electrical energy in the form of electrostatic charge. Consider a simple example of a water tower, which stores water (charge): When the water system (circuit) produces more water than a town or building needs, the excess is stored in the water tower (capacitor).

At times of high demand, when additional water is needed, the excess water (charge) flows out of the water tower to keep the pressure up.

A capacitor is usually implemented for one of three uses:

  • To store a charge. Typically used for high-speed or high-power applications, such as a laser or a camera flash. The capacitor will be fully charged by the circuit in a fixed length of time, and then all of its stored energy will be released and used almost instantaneously, just like in the water tower example.
  • To block DC voltage. If a DC voltage source is connected in series to a capacitor, the capacitor will instantaneously charge and no DC voltage will pass into the rest of the circuit. However, an AC signal flows through a capacitor unimpeded because the capacitor will charge and discharge as the AC fluctuates, making it appear that the alternating current is flowing.
  • To eliminate ripples. Useful for filtering, signal processing, and other analog designs. If a line carrying DC voltage has ripples or spikes in it, also known as "noise," a capacitor can smooth or "clean" the voltage to a more steady value by absorbing the peaks and filling in the valleys of the signal.

Capacitors are constructed of two metal plates separated by a dielectric. The dielectric is any material that does not conduct electricity, and varies for different types of capacitors. It prevents the plates from touching each other. Electrons are stored on one plate of the capacitor and they discharge through the other. Consider lightning in the sky as a real-world example of a capacitor: One plate is formed by the clouds, the other plate is formed by the earth's ground, and the dielectric is the air in between. The lightning is the charge releasing between the two plates.

Depending on their construction, capacitors are either polarized, meaning that they exhibit varying characteristics based on the direction they are used in a circuit, or nonpolarized, meaning that they can be inserted in either orientation with no change in electrical function. A sampling of various capacitor types is shown in Figures E.8 and E.9.


Figure E.8 Various Nonpolarized Capacitor Types (Ceramic Disc and Multilayer)



Figure E.9 Various Polarized Capacitor Types (Electrolytic and Tantalum)


Capacitors have a unit of farad (F). A 1-farad capacitor can store one coulomb of charge at 1 volt (equal to one amp-second of electrons at 1 volt). A single farad is a very large amount. Most capacitors store a minuscule amount of charge and are usually denoted in µF (microfarads, 10-6 x F) or pF (pico­farads, 10-12 x F). The physical size of the capacitor is usually related to the dielectric material and the amount of charge that the capacitor can hold.

Unlike resistors, capacitors do not use a color code for value identification. Today, most monolithic and ceramic capacitors are marked with a three-number code called an IEC marking (Figure E.10). The first two digits of the code indicate a numerical value; the last digit indicates a multiplier. Electrolytic capacitors are always marked in µF. These devices are polarized and must be oriented correctly during installation. Polarized devices have a visible marking denoting the negative side of the device (in the case of surface-mount capacitors, the marking is on the positive side). There may be additional markings on the capacitor (sometimes just a single character); these usually denote the capacitor's voltage rating or manufacturer.


Figure E.10 Examples of Some Capacitor IEC Markings


The calculations to determine effective capacitance of capacitors in series and parallel are essentially the reverse of those used for resistors. When capacitors are used in series (Figure E.11), a simple equation is used to calculate the effective capacitance:

1 / CTOTAL = (1 / C1) + (1 / C2) + ...

This same formula can be extended for any number of capacitors used in series. For example, if C1 is l00µF and C2 is 47µF, the overall capacitance will be 31.9µF.

For only two capacitors in series, an alternate formula can be used:

CTOTAL = (C1 x C2) / (C1 + C2)

When using capacitors in series, you store effectively less charge than you would by using either one alone in the circuit. The advantage to capacitors in series is that it increases the maximum working voltage of the devices.


Figure E.11 Capacitors in Series


When capacitors are used in parallel in a circuit (Figure E.12), their effective capacitance is additive, meaning that you simply add the values of the capacitors in parallel to obtain the total capacitance. For example, if C1 is l00µF and C2 is 47µF, the overall capacitance will be 147µF.


Figure E.12 Capacitors in Parallel


Capacitors are often used in combination with resistors in order to control their charge and discharge times. Resistance directly affects the time required to charge or discharge a capacitor (the higher the resistance, the longer the time).

Figure E.13 shows a simple RC circuit. The capacitor will charge as shown by the curve in Figure E.14. The amount of time for the capacitor to become fully charged in an RC circuit depends on the values of the capacitor and resistor in the circuit.


Figure E.13 A Simple RC Circuit to Charge a Capacitor



Figure E.14 Capacitor-Charging Curve


The variable T (called the time constant) is used to define the time it takes for the capacitor to charge to 63.2% of its maximum capacity. The time constant can be calculated by the following formula:

T = R x C

where...

  • T = Time constant (seconds)
  • C = Capacitance (F)
  • R = Resistance (Ω)

A capacitor reaches 63.2% of its charge in one-fifth of the time it takes to become fully charged. Capacitors in commercial applications are usually not charged to their full capacity because it takes too long.


Diodes


In the most basic sense, diodes pass current in one direction while blocking it from the other. This allows for their use in rectifying AC into DC, filtering, limiting the range of a signal (known as a diode clamp), and as "steering diodes," in which diodes are used to allow voltage to be applied to only one part of a circuit.

Most diodes are made with semiconductor materials such as silicon, germanium, or selenium. Diodes are polarized, meaning that they exhibit varying characteristics depending on the direction they are used in a circuit. When current is flowing through the diode in the direction shown in Figure E.15 (from anode, left, to cathode, right), the diode appears as a short circuit. When current tries to pass in the opposite direction, the diode exhibits a high resistance, preventing the current from flowing.


Figure E.15 Various Diode Types Showing Direction of Current Flow


Diodes come in many types and sizes, each with varying electrical properties. You need to consider a number of characteristics when designing with diodes or replacing one in a circuit:

  • Breakdown/reverse voltage (VR), also known as the peak inverse voltage (PIV), is the maximum voltage you can apply across a diode in the reverse direction and still have it block conduction. If this voltage is exceeded, the diode goes into "avalanche breakdown" and conducts current, essentially rendering the diode useless (unless it's a Zener diode, which is designed to operate in this breakdown region).
  • Forward voltage (VF) is the voltage drop across the diode. This usually corresponds to the forward current (the greater the current flowing through the diode, the larger the voltage drop). Typical forward voltage of a general-purpose diode is between 0.5V and 0.8V at l0mA.
  • Forward current (IF) is the maximum current that can flow through the diode. If current flowing through the diode is more than it can handle, the diode will overheat and fail, causing a short circuit.
  • Reverse recovery time (TRR) is the time it takes a diode to go from forward conduction to reverse blocking. (Think of this as a revolving door that goes in both directions, and the people coming in and going out are the current.) If the turnaround time is too slow, current will flow in the reverse direction when the polarity changes and cause the diode junction to heat up and possibly fail. This is primarily of concern for AC-rectifying circuits commonly used in power supplies.

Figure E.16 shows the diode V-I curve, a standard curve that illustrates the relationship between voltage and current with respect to a diode.


Figure E.16 The Diode V-I Curve


In normal forward bias operation (shown on the right side of the graph), the diode begins to conduct and act as a short circuit after the forward voltage drop is met (usually between 0.5V and 0.8V). When the diode is reverse biased (shown on the left side of the graph), current is essentially prevented from flowing in that direction, with the exception of a very small leakage current (measured in the nA range). The point at which the diode begins its avalanche breakdown is called "the knee," as shown by the visible increase in reverse current on the curve, looking somewhat similar to a profile of a knee. Breakdown is not a desirable mode to which to subject the diode, unless the diode is of a Zener type (in which case proper current limiting should be employed).


Transistors


The transistor is arguably the greatest invention of the 20th century and the most important of electronic components. It is a three-terminal device that essentially serves as an amplifier or switch to control electronic current. When a small current is applied to its base, a much larger current is allowed to flow from its collector. This gives a transistor its switching behavior, since a small current can turn a larger current on and off.

The first transistor was demonstrated on December 23, 1947, by Bell Telephone scientists William Shockley, John Bardeen, and Walter Brattain. The transistor was the first device designed to act as both a transmitter, converting sound waves into electronic waves, and a resistor, controlling electronic current. The name transistor comes from the words transmitter and resistor. Although its use has gone far beyond the function that combination implies, the name remains.

The transistor became commercially available in 1954 from Texas Instruments, and quickly replaced bulky and unreliable vacuum tubes, which were much larger and required more power to operate. Over 50 years later, transistors are now an essential part of engineering, used in practically every circuit and by the millions in single integrated circuits taking up an area smaller than a fingernail. Companies such as AMD, NEC, Samsung, and Intel are pushing the envelope of transistor technology, continuing to discover new ways to develop smaller, faster, and cheaper transistors.

This appendix only scratches the surface of transistor theory and focuses only on the most general terms. A sampling of various discrete transistors is shown in Figure E.17.


Figure E.17 Various Discrete Transistor Types


The transistor is composed of a three-layer sandwich of semiconductor material. Depending on how the material's crystal structure is treated during its creation (a process known as doping), it becomes more positively charged (P-type) or negatively charged (N-type). The transistor's structure contains a P-type layer between N-type layers (known as an NPN configuration) or an N­-type layer sandwiched between P-type layers (known as a PNP configuration).

The voltages at transistor terminals—the collector, emitter, and base—are measured with respect to ground and are identified by their pin names, VC, VE, and VB, respectively. The voltage drop measured between two terminals on the transistor is indicated by a double-subscript (for example, VBE corresponds to the voltage drop from the base to the emitter). Figure E.18 shows the typical single NPN and PNP schematic symbols and notations.

A trick to help you remember which diagram corresponds to which transistor type is to think of NPN as "not pointing in" in reference to the base-emitter diode. Thus, the other transistor is the PNP type.


Figure E.18 NPN (Left) and PNP (Right) Transistor Diagrams


An NPN transistor has four properties that must be met (the properties for the PNP type are the same, except the polarities are reversed):

  1. The collector must be more positive than the emitter.
  2. The base-emitter and base-collector circuits look like two diodes back-to-back (Figure E.19). Normally the base-emitter diode is conducting (with a forward voltage drop, VBE, of approximately 0.7V) and the base-collector diode is reverse­biased.
  3. Each transistor has maximum values of IC, IB, and VCE that cannot be exceeded without risk of damaging the device. Power dissipation and other limits specified in the manufacturer's data sheet should also be obeyed.
  4. The current flowing from collector to emitter (IC) is roughly proportional to the current input to the base (IB), shown in Figure E.20, and can be calculated with the following formula:

IC = hFE x IB

or

IC = B x IB

where hFE (also known as beta, B) is the current gain of the transistor. Typically, B is around 100, though it is not necessarily constant.


Figure E.19 Diode Representation of a Transistor, NPN (Left) and PNP (Right)



Figure E.20 NPN Transistor Characteristic Curve


Integrated Circuits


Integrated circuits (ICs) combine discrete semiconductor and passive components onto a single microchip of semiconductor material. These may include transistors, diodes, resistors, capacitors, and other circuit components. Unlike discrete components, which usually perform a single function, ICs are capable of performing multiple functions. There are thousands of IC manufacturers, but some familiar ones are Intel, Motorola, and Texas Instruments.

The first generation of commercially available ICs was released by Fairchild and Texas Instruments in 1961 and contained only a few transistors. In comparison, the Pentium 4 processor from Intel contains over 175 million transistors in a die area approximately the size of your thumbnail.

ICs are easy to identify in a circuit by their unique packaging. Typically, the silicon die (containing the microscopic circuitry) is mounted in a plastic or ceramic housing with tiny wires connected to it (Figure E.21). The external housing (called a package) comes in many mechanical outlines and various pin configurations and spacings.


Figure E.21 Silicon Die Inside an Integrated Circuit


With the constant advances in technology, ICs are shrinking to inconceivable sizes. Figure E.22 shows a variety of IC packages, including, from left to right, Dual Inline Package (DIP), Narrow DIP, Plastic Leadless Chip Carrier (PLCC), Thin Small Outline Package (TSOP) Type II, TSOP Type I, Small Outline Integrated Circuit (SOIC), Shrink Small Outline Package (SSOP), and Small Outline Transistor (SOT-23).


Figure E.22 Various IC Package Types


Ball Grid Array (BGA) is a relatively new package type that locates all the device leads underneath the chip, which reduces the area necessary for the device (Figure E.23). However, it is extremely difficult to access the balls of the BGA without completely removing the device, which limits its use by hobbyists. BGA devices are becoming more popular due to their small footprint and low failure rates. The testing process (done during product manufacturing) is more expensive as X-rays need to be used to verify that the solder has properly bonded to each of the ball leads.


Figure E.23 BGA Packaging


With Chip-on-Board (COB) packaging—colloquially referred to as glop-tops—the silicon die of the IC is mounted directly to the PCB and protected by epoxy encapsulation (Figure E.24).


Figure E.24 COB Packaging


Proper IC positioning is indicated by a dot or square marking (known as a key) located on one end of the device (Figure E.25). Some devices mark pin 1 with an angled corner (such as with square package types like PLCC). On a circuit board, pin 1 is typically denoted by a square pad, whereas the rest of the IC’s pads will be circular. Sometimes, a corresponding mark will be silkscreened or otherwise noted on the circuit board. Pin numbers start at the keyed end of the case and progress counter-clockwise around the device, unless noted differently in the specific product data sheet.


Figure E.25 IC Package Showing Pin Numbers and Key Marking


Microprocessors and Embedded Systems


A microprocessor—also known as a microcontroller or CPU (central processing unit), though there are slight technical differences—is essentially a general-purpose computer and is the heart of any embedded system. It is a complete computational engine fabricated on a single integrated circuit. In embedded systems, there is a union of hardware (the underlying circuitry) and software/firmware (code that is executed on the processor). You cannot have one without the other. Just about every electronic device you own can be considered an embedded system.

In 1971, Intel released the first microprocessor, the 4004. There are now thousands of microprocessors available, each with its own benefits and features, including:

  • Cost
  • Size
  • Clock speed
  • Data width (for example, 8-, 16-, or 32-bit)
  • On-chip peripherals (such as on-chip memory, I/O pins, LCD control, RS-232, USB, wireless networking, analog-to-digital converters, or voltage references)

Common microprocessors include the Intel x86 family (used in most personal computers), Motorola 6800- and 68000-series (such as the 68020 or 68030 used in some Macintosh computers or the DragonBall MC68328 used in some Palm PDA devices), ZiLOG Z8, Texas Instruments OMAP, and Microchip PIC.

While we don't cover the specifics of various microprocessors here, their ubiquity inside hardware products should be noted. When you're hardware hacking or reverse-engineering a product, chances are that you will encounter a microprocessor of some type. But fear not: Microprocessor data sheets, usually available from the manufacturer, contain instruction sets, register maps, and device-specific details that will give you the inside scoop on how to operate the device. And, once you understand the basic theory of how microprocessors work and the low-level assembly language that they execute, it is fairly trivial to apply that knowledge to a new device or processor family.


Soldering Techniques


Soldering is an art form that requires proper technique in order to be done correctly. With practice, you will become comfortable and experienced with the process. The two key parts of soldering are good heat distribution and cleanliness of the soldering surface and component. In the most basic sense, soldering requires a soldering iron and solder. There are many shapes and sizes of tools to choose from (more details of which are available in Chapter 2). This section uses hands-on examples to demonstrate proper soldering and desoldering techniques.

Soldering Iron Safety

Improper handling of the soldering iron can lead to burns or other physical injuries. Wear safety goggles and other protective clothing when working with soldering tools. With temperatures hovering around 700 degrees F, the tip of the soldering iron, molten solder, and flux can quickly burn clothing and skin. Keep all soldering equipment away from flammable materials and objects. Be sure to turn off the iron when it is not in use and store it properly in its stand.


Hands-On Example: Soldering a Resistor to a Circuit Board


This simple example shows the step-by-step process to solder a through-hole component to a printed circuit board (PCB). We use a piece of prototype PCB and a single resistor (Figure E.26). Before you install and solder a part, inspect the leads or pins for oxidation. If the metal surface is dull, sand with fine sandpaper until it is shiny. In addition, clean any oxidation or excess solder from the soldering iron tip to ensure maximum heat transfer.


Figure E.26 Prototype PCB and Resistor


Bend and insert the component leads into the desired holes on the PCB. Flip the board to the other side. Slightly bend the lead you will be soldering to prevent the component from falling out when the board is turned upside-down (Figure E.27).


Figure E.27 Resistor Inserted into PCB


To begin the actual soldering process, allow the tip of your iron to contact both the component lead and the pad on the circuit board for about a second before feeding solder to the connection. This will allow the surface to become hot enough for solder to flow smoothly (Figure E.28).


Figure E.28 Heating the Desired Solder Connection


Next, apply solder sparingly and hold the iron in place until solder has evenly coated the surface (Figure E.29). Ensure that the solder flows all around the two pieces (component lead and PCB pad) that you are fastening together. Do not put solder directly onto the hot iron tip before it has made contact with the lead or pad, as doing so can cause a cold solder joint. Soldering is a function of heat, and if the pieces are not heated uniformly, solder may not spread as desired. A cold solder joint will loosen over time and can build up corrosion, causing it to fail.


Figure E.29 Applying Heat and Solder to the Connection


When it appears that the solder has flowed properly, remove the iron from the area and wait a few seconds for the solder to cool and harden. Do not attempt to move the component during this time. The solder joint should appear smooth and shiny, resembling the image in Figure E.30. If your solder joint has a dull finish, reheat the connection and add more solder if necessary.


Figure E.30 Successful Solder Joint


Once the solder joint is in place, snip the lead to your desired length (Figure E.31). Usually, you will simply cut the remaining portion of the lead that is not part of the actual solder joint (see Figure E.32). This prevents any risk of short circuits between leftover component leads on the board.


Figure E.31 Snipping Off the Remaining Component Lead



Figure E.32 Completed Soldering Example


Every so often during any soldering session, use a wet sponge to lightly wipe the excess solder and burned flux from the tip of your soldering iron. This allows the tip to stay clean and heat properly. Proper maintenance of your soldering equipment will also increase its life span.


Desoldering Tips


Desoldering, or removing a soldered component from a circuit board, is typically trickier than soldering, because you can easily damage the device, the circuit board, or surrounding components.

For standard through-hole components, first grasp the component with a pair of needle-nose pliers. Heat the pad beneath the lead you intend to extract and pull gently. The lead should come out, then repeat for the other lead. If solder fills in behind the lead as you extract it, use a spring-loaded solder sucker to remove the excess solder.

For through-hole ICs or multipin parts, use a solder sucker or desoldering braid to remove excess from the hole before attempting to extract the part. You can use a small flat-tip screwdriver or IC extraction tool to help loosen the device from the holes. Be careful to not overheat components, as they can become damaged and may fail during operation. For surface mount devices (SMDs) with more than a few pins, the easiest method to remove the part is by using the ChipQuik SMD Removal Kit, as shown in the following step-by-step example. Removal of SMD and BGA devices is normally accomplished with special hot-air rework stations. These stations provide a directed hot-air stream used with specific nozzles, depending on the type of device to be removed. The hot air can flow freely around and under the device, allowing the device to be removed with minimal risk of overheating. Rework stations are typically priced beyond the reach of hobbyist hardware hackers, and the ChipQuik kit works quite well as a low-cost alternative.


Hands-On Example: SMD Removal Using ChipQuik


The ChipQuik kit (www.chipquik.com) allows you to quickly and easily remove surface mount components such as PLCC, SOIC, TSOP, QFP, and discrete packages. The primary component of the kit is a low-melting-point solder (requiring less than 300 degrees F) that reduces the overall melting temperature of the solder already on the SMD pads. Essentially, this enables you to just lift the part right off the PCB.

Figure E.33 shows the contents of the basic ChipQuik SMD Removal Kit, from top to bottom: alcohol pads for cleaning the circuit board after device removal, the special low-melting temperature alloy, standard no­clean flux, and application syringe.


Figure E.33 ChipQuik SMD Removal Kit Contents


Figure E.34 shows the circuit board before the SMD part removal. Our target device to remove is the largest device on the board, the Winbond WTS701EM/T 56-pin TSOP IC.


Figure E.34 Circuit Board Before Part Removal


The first step is to assemble the syringe, which contains the no-clean flux. Simply insert the plunger into the syringe and push down to dispense the compound (Figure E.35). The flux should be applied evenly across all the pins on the package you will be removing. Flux is a chemical compound used to assist in the soldering or removal of electronic components or other metals. It has three primary functions:

  1. Cleans surfaces to assist the flow of filler metals (solder) over base metals (device pins).
  2. Assists with heat transfer from heat source (soldering iron) to metal surface (device pins).
  3. Helps in the removal of surface metal oxides (created by oxygen in the air when the metal reaches high temperatures).


Figure E.35 Applying Flux to the Leads


Once the flux is evenly spread over the pins of the target device, the next step is to apply the special ChipQuik alloy to the device (Figure E.36). This step is just like soldering: Apply heat to the pins of the device and the alloy at the same time. You should not have to heat the alloy with the soldering iron for very long before it begins to melt. The molten alloy should flow around and under the device pins (Figure E.37).


Figure E.36 Applying Heat and Alloy to the Leads



Figure E.37 Chip with Alloy Applied


Starting at one end of the device, simply heat and apply the alloy. Repeat for the other side(s) of the device. The flux will help with ensuring a nice flow of the alloy onto the device pins. Ensure that the alloy has come in contact with every single pin by gently moving the soldering iron around the edges of the device. Avoid touching nearby components on the PCB with the soldering iron.

Now that the alloy has been properly applied to all pins of the device, it is time to remove the device from the board. After making sure that the alloy is still molten by reheating all of it with the soldering iron, gently slide the component off the board with a tool such as a small jeweler’s flat-blade screwdriver (Figure E.38). If the device is stuck, reheat the alloy and wiggle the part back and forth to help the alloy flow underneath the pads of the device and loosen the connections.


Figure E.38 Removing the Device from the Board


The final step in the desoldering process is to clean the circuit board. This step is important because it will remove any impurities left behind from the ChipQuik process.

First, use the soldering iron to remove any stray alloy left on the device pads or anywhere else on the circuit board. Then, apply a thin, even layer of flux to all of the pads that the device was just soldered to. Use the included alcohol swab or a flux remover spray to remove the flux and clean the area (Figure E.39).


Figure E.39 Using Flux and Alcohol Swab to Clean Area


The desoldering process is now complete. The surface mount device has been removed and the circuit board cleaned (Figure E.40). If you intend to reuse the device you just removed, use the soldering iron to remove any stray alloy or solder left over on the pins and ensure there are no solder bridges between pins.


Figure E.40 Circuit Board with Part Successfully Removed


Common Engineering Mistakes


During engineering design and debugging, you should remember the important maxim KISS—Keep It Simple, Stupid—at all times. It can be frustrating to troubleshoot a problem for hours or days on end and then discover the cause was a simple oversight. The most common engineering mistakes for hobbyists are listed here. Although there are hundreds of other simple mistakes that can cause an engineer to quickly lose his or her hair, this list should get you started:

  • Faulty solder connections. After soldering, inspect the connections for cold solder joints or bridges. Cold solder joints happen when you don't fully heat the connection or when metallic corrosion and oxide contaminate a component lead or pad. This is the most common mistake for amateur and hobbyist electronics builders. Solder bridges form when a trail of excess solder shorts pads or tracks together (see the "Soldering Techniques" section in this appendix).
  • Installing the wrong part. Verify the part type and value before you insert and solder the component to the circuit board. Although many devices appear to look similar (e.g., a 1K and a 10K resistor look almost the same except for the color of one band), they have different operating characteristics and may act very differently in an electronic circuit. Surface-mount components are typically harder to distinguish from one another. Double-check to ensure that each part is installed properly. Keep in mind that the only way to properly test a component's value is to remove it from the board and then test it.
  • Installing parts backwards. ICs have a notch or dot at one end indicating the correct direction of insertion. Electrolytic capacitors have a marking to denote the negative lead (on polarized surface mount capacitors, the positive lead has the marking). Through-hole capacitors also have a shorter-length negative lead than the positive lead. Transistors have a flat side or emitter tab to help you identify the correct mounting position and are often marked to identify each pin. Diodes have a banded end indicating the cathode side of the device.
  • Verify power. Ensure that the system is properly receiving the desired voltages from the power supply. If the device uses batteries, check to make sure that they have a full charge and are installed properly. If your device isn't receiving power, chances are it won't work.


Web Links and Other Resources


General Electrical Engineering Books


  • Radio Shack offers a wide variety of electronic hobby and how-to books, including an Engineer's Notebook series that provide an introduction to formulas, tables, basic circuits, schematic symbols, integrated circuits, and optoelectronics (light-emitting diodes and light sensors). Other books cover topics on measurement tools, amateur radio, and computer projects.
  • Nuts & Volts (www.nutsvolts.com) and Circuit Cellar (www.circuitcellar.com) magazines are geared toward both electronics hobbyists and professionals. Both are produced monthly and contain articles, tutorials, and advertisements for all facets of electronics and engineering.
  • Horowitz and Hill, The Art of Electronics, Cambridge University Press, 1989. Essential reading for basic electronics theory. It is often used as a course textbook in university programs.
  • C. R. Robertson, Fundamental Electrical & Electronic Principles, Newnes, 2001. Covers the essential principles that form the foundations for electrical and electronic engineering courses.
  • M. M. Mano, Digital Logic and Computer Design, Prentice-Hall, 1979. Digital logic design techniques, binary systems, Boolean algebra and logic gates, simplification of Boolean functions, and digital computer system design methods.
  • K. R. Fowler, Electronic Instrument Design, Oxford University Press, 1996. Provides a complete view of the product development life cycle. Offers practical design solutions, engineering trade-offs, and numerous case studies.


Electrical Engineering Web Sites


  • ePanorama.net: www.epanorama.net A clearinghouse of electronics information found on the Web. The content and links are frequently updated. Copious amounts of information for electronics professionals, students, and hobbyists.
  • The EE Compendium, The Home of Electronic Engineering and Embedded Systems Programming: http://ee.cleversoul.com Contains useful information for professional electronics engineers, students, and hobbyists. Features many papers, tutorials, projects, book recommendations, and more.
  • Discover Circuits: www.discovercircuits.com A resource for engineers, hobbyists, inventors, and consultants, Discover Circuits is a collection of over 7,000 electronic circuits and schematics cross-references into more than 500 categories for finding quick solutions to electronic design problems.
  • WebEE, The Electrical Engineering Homepage: www.web-ee.com Large reference site of schematics, tutorials, component information, forums, and links.
  • Electro Tech Online: www.electro-tech-online.com A community of free electronic forums. Topics include general electronics, project design, microprocessors, robotics, and theory.
  • University of Washington EE Circuits Archive: www.ee.washington.edu/circuit_archive A large of collection of circuits, data sheets, and electronic-related software.


Data Sheets and Component Information


When reverse-engineering a product for hardware hacking purposes or reusing parts, identifying components and device functionality is typically an important step. Understanding what the components do may provide detail of a particular area that could be hacked. Nearly all vendors post their component data sheets openly on the Web, so simple searches will yield a decent amount of information. The following resources will also help you if the vendors don't:

  • Data Sheet Locator: www.datasheetlocator.com A free electronic engineering tool that enables you to locate product data sheets from hundreds of electronic component manufacturers worldwide.
  • IC Master: www.icmaster.com The industry's leading source of integrated circuit information, offering product specifications, complete contact information, and Web site links.
  • Integrated Circuit Identification (IC-ID): www.elektronikforurn.de/ic-id Lists of manufacturer logos, names, and datecode information to help identifying unknown integrated circuits.
  • PartMiner: www.freetradezone.com Excellent resource for finding technical information and product availability and for purchasing electronic components.


Major Electronic Component and Parts Distributors



Obsolete and Hard-to-Find Component Distributors


When trying to locate obscure, hard-to-find materials and components, don't give up easily. Sometimes it will take hours of phone calls and Web searching to find exactly what you need. Many companies that offer component location services have a minimum order (upwards of $100 or $250), which can easily turn a hobbyist project into one collecting dust on a shelf. Some parts-hunting tips:

  • Go to the manufacturer Web site and look for any distributors or sales representatives. For larger organizations, you probably won't be able to buy directly from the manufacturer. Call your local distributor or representative to see if they have access to stock. They will often sample at small quantities or have a few-piece minimum order.
  • Be creative with Google searches. Try the base part name, manufacturer, and combinations thereof.
  • Look for cross-reference databases or second-source manufacturers. Many chips have compatible parts that can be used directly in place.

The following companies specialize in locating obsolete and hard-to-find components. Their service is typically not inexpensive, but as a last resort to find the exact device you need, these folks will most likely find one for you somewhere in the world:



← Previous Contents