Doc1 Pract Elek
Doc1 Pract Elek
These parts contain a complete 8051-type SOIC family (note that numbers in paren-
microcontroller in a surface-mount package thesis are mm).
measuring 3 mm × 3 mm.
TABLE 9-5. SMD IC packages in the SOIC family
Surface-mount IC packages vary in style,
Body Lead
from some that aren’t much different from Name Description width pitch
their DIP equivalents to those with leads so
SO Small Outline 0.156 0.050
closely spaced that a workbench microscope
(3.97) (1.27)
is needed to work with them. Figure 9-32
shows some of the common surface-mount SOM Small Outline 0.22 0.050
IC package types that are available. Medium (5.6) (1.27)
232 CHAPTER 9
control voltage (often set by a small potenti- ple P-N junctions include BJTs, UJTs, FETs,
ometer or a zener diode). SCRs, and TRIACs.
The 78XX and 79XX parts have been around Integrated circuits incorporate multiple
for quite a while and are readily available. BJTs, FETs, and other components into a
The “XX” is replaced with the output voltage design that can be simple, such as an op
of the device. The 78XX parts produce posi- amp or a 555 timer, to something as complex
tive voltages, and the 79XX parts are used to as the CPU in a computer with millions of
produce negative voltages. These regulators individual components.
are fixed output, with output voltages of 5, 8,
For experimenting and hacking, having a
10, 12, 15, and 24 volts. Most are rated for
decent selection of discrete solid-state parts
around 1A of output current. I like to keep a
on hand is always a good thing. A bag of
small stock of 7805, 7905, 7812, 7912, and
cheap 1N4148 diodes and some 1N4001,
7815 regulators on hand.
1N4002, and 1N4003 parts come in handy
Low-current regulators are also available in when you are dealing with power supply cir-
TO-92 packages, such as the LM317. This is cuits. LEDs can be purchased in the form of
an adjustable device with an output voltage kits from a number of suppliers. Although
from 1.2 to 32V with 100 mA of output cur- these are basically just a box or a large bag
rent. They are useful when working with containing smaller bags of parts, you can
analog-to-digital or digital-to-analog conver- always sort them out and store them neatly
tors that rely on a reference voltage (analog yourself.
interfaces are discussed in Chapter 13).
A basic selection of transistors (such as the
ones listed in Table 9-3) can be used for any-
Summary thing under about 300 MHz. Unless you
The realm of active components encom- plan to work with RF, you generally won’t
passes a broad range of devices, all of which need anything faster. If you would like a
share the common feature of using an exter- large selection to work with, inexpensive kits
nal source of current and having the ability of transistors are available, with a good selec-
to modify the way in which current moves tion of various types in neatly labeled little
through them in nonlinear ways. Some are plastic bags.
externally controllable, whereas others rely
on the intrinsic behavior of the solid-state When it comes to working with surface-
material from which they are fabricated. mount parts, you will of course need the cor-
rect tools (such as the soldering equipment
The basic P-N junction is the primary build- shown in Chapter 3) and to be able to use
ing block on which silicon-based solid-state the soldering techniques illustrated in Chap-
discrete devices are built. If a device has just ter 4. SMT can be extremely challenging, so
a single P-N junction, it is probably a diode unless there is a definite need for it, I would
or rectifier of some sort. Devices with multi- suggest avoiding it, at least initially. A proto-
type is expected to look clunky, and if you
234 CHAPTER 9
CHAPTER 10
Relays
5HOD\V PD\ EH DQ ROG WHFKQRORJ\ EXW some early computers were built using
they are still essential in electronics. A relay relays, such as the Zuse Z3 (1941), the
is basically just an electrically operated Atanasoff-Berry Computer (1942), and the
switch. Some are tiny and handle only small IBM ASCC/Harvard Mark I (1944).
amounts of current at low voltages, whereas Although they haven’t changed much in
other types, called contactors, are huge (the terms of operation, they have evolved into a
size of a small refrigerator) and can safely myriad of types over the past 180 years.
deal with hundreds of amperes and thou-
Regardless of the actual internal physical
sands of volts. But regardless of size and
arrangement, all electromechanical relays
power capacity, all relays and their close
operate on the principle of electromagnet-
cousins the contactors use the same basic
ism as the force driving a mechanism of
principle of operation.
some sort. The mechanism might be an
This chapter describes various types ranging armature, metal reeds, or a contactor bus bar
from low-current TTL-compatible reed relays type of arrangement.
to high-power types used to control AC.
Techniques for controlling a relay from a ARMATURE RELAYS
low-voltage circuit are also covered, as well An armature relay has an internal mecha-
as some examples of how relays can be used nism that transfers the motion induced by a
in control and logic circuits. solenoid coil (an electromagnet) into physi-
cal motion, usually by means of some sort of
Relay Background lever action. The motion of the armature can
Relays have been around since about 1830. be used to control multiple sets of contacts,
In fact, they are probably one of the oldest and in some designs, a small pushbutton is
types of electrical components (other than brought out through the shell of the relay to
perhaps switches). Relay-based switching allow manual operation. Figure 10-1 is a sim-
systems replaced human telephone switch- plified illustration of a basic SPST type of
board operators in mid–20th century, and relay.
235
REED RELAYS
Some types of relays use a set of thin metal
strips called reeds for the contacts. These are
sealed into a small glass tube, and a coil
wound around the tube provides the electro-
magnetic force that causes the reeds to bend
and make contact. Figure 10-2 shows how
this type of device works.
FIGURE 10-1. A basic electromagnetic relay
Any suitable magnetic field will cause the
Armature type relays can have one or more
reeds to flex and make contact. In fact, the
sets of contacts (SPST, SPDT, DPST, DPDT,
sensors used in security systems to detect an
3PDT, and so on), with the multiple contacts
open door or window are often nothing
all mechanically connected to the same
more than the reed in its glass tube without
armature lever. Since they are basically elec-
a coil. A permanent magnet in the window
tromechanical switches, the same general
or door frame closes the contacts when it’s
contact descriptions apply. But relays have
close to the sensor. Figure 10-3 shows a bare
the advantage of an electromagnet, which
reed sensor module suitable for use with
can exert considerable force. Relays with 10
something like an Arduino or BeagleBone
or even 20 sets of contacts are sometimes
single-board computer.
found in applications such as elevator con-
trols and old-style telephone switching sys-
tems. If you look ahead to Figure 10-8, you
can see three sets of SPDT contacts through
the clear plastic shell of the relay.
236 CHAPTER 10
FIGURE 10-4. Operation of a heavy-duty contactor
Relay Packages
Some relays are minuscule, while others are
huge. Relays come in printed circuit board
form factors with both through-hole and
surface-mount packages. They can be found
FIGURE 10-3. Reed contacts without a coil
in packages that use a socket, making them
easily replaceable. Other types have lug ter-
CONTACTOR
minals for use in industrial and automotive
In a high-current, high-voltage type of relay
applications, and still others have large bus-
known as a contactor, a solenoid coil is used
RELAYS 237
bar connections for applications such as on page 243. You can find relays of this type
high-power motor controllers. It all depends controlling things like lighting, heater ele-
on how much current they are designed to ments, small electric motors, and as drivers
handle at a given voltage and how much volt- for larger heavy-duty relays and contactors.
age and current is necessary to drive the
Reed relays are also available in packages
relay mechanism.
that look like a typical 14-pin IC, as well as
packages that have bare wire leads for the
PCB RELAYS
contacts and the coil. A reed relay might
Small relays for PCB applications are avail-
have a coil with a high enough resistance to
able in types that range from reed relays to
allow it to be driven directly from a micro-
compact armature devices that are capable of
controller or logic IC, but a reed relay usu-
handling up to 120 VAC at 10A or so. The
ally won’t carry as much current through its
previous section showed what a reed relay
contacts (the reeds) as an armature type of
looks like (in Figure 10-3). Figure 10-5 shows
relay.
a compact relay designed to be mounted to a
PCB. Both miniature armature and reed relays are
available in through-hole and surface-mount
packages. The surface-mount relay shown in
Figure 10-6 is an example (all dimensions
are in millimeters).
238 CHAPTER 10
power consumption of 140 mW, and nomi- and it is possible to deform the base and
nal contact ratings of 0.5 A at 125V AC. cause the terminal to shift during soldering.
This type of relay uses the crimped lug con- screw terminals
nectors discussed in Chapter 7 and the
These types of relays are mostly used in
crimping tool shown in Chapter 3. Although
industrial applications that involve switching
it is possible to solder to the terminals, this
high voltages and large amounts of current.
is generally not a good idea. Long ago, when
They are also available in an 11-pin form.
the base of the relay assembly was made of
Bakelite, it wasn’t as big of a problem,
because Bakelite can tolerate the heat of sol-
dering. Modern relays are made using plas-
tics with much lower melting temperatures,
RELAYS 239
Although octal sockets might seem like a
TIP also implies that, for a situation like this, you
throwback to the days of vacuum tubes,
could use a miniature PCB-mount relay, like
they are still quite common and readily available.
the units shown in Figure 10-9 (this is a
It is also possible to purchase just the octal plug
bank of four, with built-in drivers).
and put your own electronics into it. This is use-
ful for applications where you might want a
sealed module (like, say, a sensor data collector
for a remote environmental monitor) that can
quickly and easily be replaced if necessary.
Selecting a Relay
Relays have two sets of primary specifica-
tions: coil and contacts. The coil will have a
nominal operating voltage and resistance,
although sometimes the manufacturer will
give a power value instead of a resistance. If
the current isn’t specified, a quick applica-
tion of Ohm’s law will tell us how much cur-
FIGURE 10-9. Relay module for use with a microcontroller
rent we can expect the relay coil to draw, and
we can use the power specification to figure However, a small relay might require any-
out the coil resistance (see Chapter 1). where from 20 to 50 mA for its coil, which
The contacts should be rated to handle the means it can’t be controlled directly from a
load they will be controlling and then some. standard logic IC or microcontroller. In this
To be safe, it’s a good idea to derate the con- case, either a driver IC or a transistor driver
tacts by 50%, meaning that if you want to (as described in “Controlling Relays with
control a 240V, 40 A contactor with a 24V Low-Voltage Logic” on page 243) will be
AC coil that draws 36 mA with a driver relay, needed. The board shown in Figure 10-9
the smaller relay will need to have contacts doesn’t have this problem, because the driv-
that can handle 72 mA at 48V AC (twice the ers are already on the PCB.
current and voltage actually required). A A cascade of relays is not an uncommon sit-
smaller relay is used in this case because the uation. Figure 10-10 shows how a sequence
contactor uses AC for its coil, not DC. This of relay driver, small relay, and contactor can
makes it more challenging to control with be connected to control a high-current, high-
just a solid-state driver circuit, although it is power system. Conceptually, this can be
possible (and not uncommon). Using a extended as far as necessary, so that, in
small intermedite relay to handle the AC for theory, a 5V logic signal could control hun-
the contactor’s coil keeps things simple. dreds of amperes of current.
A small relay rated for 100 mA contact cur-
rent should do fine for this application. It
240 CHAPTER 10