Computers don't exist in a vacuum. They have to interface with the
world in many ways. You can sit at a keyboard and type and you're
using a computer interface. You click a mouse button and that's another
Measurement devices often need to communicate with computers also.
A computer control system
needs temperature values in order to compute whether a valve should be
A computer control system
needs to be able to set a voltage in order to control the speed of a motor.
These kinds of needs - and many others - show
why interface circuits are necessary.
You'll need to use a comparator, sooner or later. Here's what you'll
need to learn about comparators.
Given a need to develop
a "zero-one" signal that depends upon whether an analog signal has exceed
Be able to use a comparator
to generate the desired signal.
Be able to wire the comparator
correctly - for an LM339.
A comparator is the simplest circuit that moves signals between the analog
and digital worlds. What does a comparator do?
Simply put, a comparator compares two analog
signals and produces a one bit digital signal. The symbol for a comparator
is shown below.
The comparator output satisfies the following
When V+ is larger than V-
the output bit is 1.
When V+ is smaller than V-
the output bit is 0
to give you an idea of how a comparator works, here is a simulation of
using a comparator. Set the voltages on the control panel to adjust
the voltage inputs to the comparator.
About Real Comparators?
Real comparators may work like the one in the simulation, but there are
sometimes other considerations. For example, a common comparator
is the LM339, which come on a chip with four comparators. The four
comparators are all open collector outputs. We need to discuss that.
Here's a diagram of the output circuitry showing
how the comparator is connected to the output transistor, and how the collector
of the transistor is connected to the output terminal on the chip.
In this situation, you don't need to know a lot about transistors (although
it's a good idea to learn that if you don't know it!). What you need
to know is that, in this situation, the transistor acts like a switch.
A transistor doesn't always act that way, but it does in this situation.
When the output of the
comparator is a 1, current flows from the comparator through the base of
the transistor, out the emitter to ground, as shown.
When that current flows,
the transistor acts like a switch that permits current to flow from the
collect to the emitter to ground.
The way you connect the comparator is to put your load between five volts
and the collector connection on the chip - like this.
Finally, if you want to use an LM339, you'll
need this pin-out. You can click
here to get the pin-out in a separate window.