© Jonathan Bartlett 2020
J. BartlettElectronics for Beginnershttps://doi.org/10.1007/978-1-4842-5979-5_11

11. Integrated Circuits and Resistive Sensors

Jonathan Bartlett1 
(1)
Tulsa, OK, USA
 

So far, the components we have studied are simple, basic components—batteries, resistors, diodes, and so on. In this chapter, we are going to start to look at integrated circuits , also called chips, microchips, or ICs. An IC is a miniaturized circuit placed on silicon. It is a whole collection of parts geared around a specific function. These functions may be small, such as comparing voltages or amplifying voltages, or they may be complex, such as processing video or even complete computers. A single chip may hold just a few components, or it may hold billions.

Miniaturized circuits have several advantages—they are cheaper to produce in mass, they use less power, and they take up less space in your overall circuit—all because they have a reduced area and use fewer materials. These miniaturized circuits are what allowed for the computer revolution over the last century.

11.1 The Parts of an Integrated Circuit

Integrated circuits, as we have noted, are basically miniaturized circuits placed on a silicon plate, called the die. This die is where all of the action of the integrated circuit takes place.

The die is then placed into a package, which then provides connection points for circuit designers to interface with the IC. These connection points are often called pins or pads. Each pin on an IC is numbered, starting with pin 1 (we will show you how to find pin 1 shortly). Knowing which pin is which is important, because most of the pins on a chip each have their own purpose, so if you attach a wire to the wrong pin, your circuit won’t work or you will destroy the chip. Most packages are marked with the chip’s manufacturer and part number. If they weren’t, it would be nearly impossible to tell one chip from another.

There are many different types of packaging available, but there are two general types that are often encountered:

Through-Hole: In this packaging type, the connection points are long pins which can be used on a breadboard. This type of packaging is easiest for amateur usage.

Surface Mount: In this packaging type, the connection points are small pads which are meant to be soldered to a circuit board. These packages are much smaller (and therefore less expensive) and can be more easily managed by automated systems to build completed circuits. These are also referred to as SMDs (surface mount devices) or SMT (surface mount technology).

Since we are only using breadboards in this book and not doing any soldering, we will only concern ourselves with through-hole packaging. However, through-hole packaging itself comes in a variety of styles. The main one we will concern ourselves with is called a dual in-line package , or DIP. Figure 11-2 shows the same chip in SMD and DIP configurations.

An integrated circuit in a DIP package has two rows of pins coming out of the package. Most chips either mark the top of the chip with a notch or indentation (where pin 1 is immediately counterclockwise of the notch) or mark pin 1 with an indentation or both. See Figure 11-2 to see how to use the notch to find pin 1. The rest of the pins are numbered counterclockwise around the chip.
../images/488495_1_En_11_Chapter/488495_1_En_11_Fig1_HTML.jpg
Figure 11-1

Comparison of the Same IC in SMD (Left) and DIP (Right) Packages (Image Credit: Shutterstock/Youra Pechkin)

../images/488495_1_En_11_Chapter/488495_1_En_11_Fig2_HTML.jpg
Figure 11-2

Pin 1 is Immediately Counterclockwise of the Notch (Image Credit: Shutterstock/Cristian Storto)

../images/488495_1_En_11_Chapter/488495_1_En_11_Fig3_HTML.jpg
Figure 11-3

A DIP IC Inserted Into a Breadboard

../images/488495_1_En_11_Chapter/488495_1_En_11_Fig4_HTML.jpg
Figure 11-4

The Pin Configuration of an LM393

../images/488495_1_En_11_Chapter/488495_1_En_11_Fig5_HTML.jpg
Figure 11-5

A Simple Comparator Circuit

../images/488495_1_En_11_Chapter/488495_1_En_11_Fig6_HTML.jpg
Figure 11-6

A Simple Resistor Sensor Circuit

../images/488495_1_En_11_Chapter/488495_1_En_11_Fig7_HTML.jpg
Figure 11-7

Darkness Sensor Schematic

../images/488495_1_En_11_Chapter/488495_1_En_11_Fig8_HTML.jpg
Figure 11-8

Darkness Sensor Breadboard Layout

The beauty of a DIP-packaged IC is that it fits perfectly onto most breadboards. Figure 11-3 shows how you can place your IC across the breadboard’s bridge and each pin on the chip will have its own terminal strip to connect to.

Be careful, though, when inserting ICs into breadboards. The spacing of the pins on an IC is often slightly wider or shorter than the breadboard’s bridge, and pins have to be inserted carefully. If you just jam the IC into the breadboard, you will likely accidentally crush one or more of the pins that aren’t exactly aligned on the hole. Instead, compare the spacing of the pins to the bridge spacing on your breadboard. If it doesn’t match up, very gently bend the pins with your fingers or with pliers to get them to match up. It’s usually just a very small amount, but if you don’t take care, you can easily damage your IC.

Usually, the ICs that I purchase are just a little wide, and I will squeeze the pins on each side slightly between my thumb and finger until they move close enough together. However you adjust the pins, make sure they line up before pushing them into their connection points on the breadboard. Also, with larger ICs, you may also need to slightly wiggle the IC back and forth as you gently insert it into place on the breadboard.

11.2 The LM393 Voltage Comparator

There are thousands and thousands of available chips which do a dizzying array of functions. In this chapter, we are going to focus on a very simple chip—the LM393 voltage comparator . This chip does one simple task. The LM393 compares two input voltages and then outputs either a high-voltage signal or a low-voltage signal depending on which input voltage is greater. The LM393 is actually a dual voltage comparator, which means that it will do two separate comparisons on the same chip. Like most chips, the LM393 is an active device, which means that it additionally requires a voltage source and a ground connection to provide power to the device.

Figure 11-4 shows the pin configuration (also called the pinout) of the LM393. The first thing to note on any pinout is where the voltage and ground connections are. In this case, the voltage is marked as VCC, and the ground is marked as GND. Even though the LM393 has two voltage comparators on the chip, they both share the power (VCC) and ground (GND) pins. The left side of the chip diagram shows the inputs and output for the first voltage comparator (1IN+, 1IN-, and 1OUT), and the inputs and output for the second voltage comparator are on the right (2IN+, 2IN-, and 2OUT). In your projects, you can use whichever one is more convenient for you, or even both at the same time if you have more than one voltage comparison task.

So the 1IN+ pin (pin 3) and the 1IN- pin are where the two voltages are being fed that are being compared by the first comparator. The 1OUT is the pin which will contain the output. If the voltage at 1IN+ is less than the voltage on 1IN-, the output pin will be at a low (i.e., near-zero/ground) voltage. If the voltage at 1IN+ is greater than the voltage on 1IN-, the output pin will not conduct at all, but this will be considered a “high” (positive voltage) state. This sounds counterintuitive, but, as we will see, this lets us set our own output voltage to whatever we want without causing too much complexity. This configuration where high-voltage outputs don’t conduct is called an open collector configuration. Don’t worry if this is a little confusing, we will discuss it more in depth later in the chapter.

VOLTAGE SOURCES ON INTEGRATED CIRCUITS

Note that the voltage pins on integrated circuits can be marked in a number of different ways. The positive voltage source is often labeled as VCC, VDD, or V+. The ground connect is often labeled as GND, VEE, VSS, or V−. There are additional ways that these are labeled as well. Finding the positive and ground connections for an IC should always be the first thing you do with it.

11.3 The Importance and Problems of Datasheets

Every IC (and, usually, any other part as well) has a datasheet supplied by the manufacturer which tells you important details about how you should use their chip in your circuit. Reading datasheets is one of the worst parts of electronics, in my opinion. For me, datasheets rarely have the information I am actually looking for in a way that is easy to find.

In fact, most datasheets assume that you already know how to use the device, and the datasheets are just there to supply additional details about the limitations of the device. For instance, looking through the LM393 datasheet from Texas Instruments, the actual operation of the device isn’t even listed until page 11, and there it is buried within a sub-subsection, almost as a sidenote.

These datasheets are written by people who have spent a lot of time being electrical engineers, and they are written for people who have spent a lot of time being electrical engineers, so when mere mortals read the datasheets, the important pieces are often shrouded in unintelligible gibberish. For instance, the fact that the “high” output state of the device doesn’t conduct isn’t mentioned explicitly anywhere at all in the datasheet. Instead, it is implied by the configuration.

The reason for this is that the datasheets are usually read by professionals familiar with the type of device and who just need to know the electrical details so they don’t accidentally bend the device beyond the breaking point. Thus, the datasheets oftentimes spend more time just showing and describing the layout of the circuit on the chip and graphs of different chip properties, and then you are left to interpret what that means for your circuit. For advanced circuit designers, this is great. For students and hobbyists, however, this is oftentimes more frustrating than helpful.

However, datasheets do often provide a few basic details that are helpful to everyone. They will often tell you
  • What each pin does

  • What the power requirements are

  • What the outer limits of the chip’s operation are

  • An example circuit that you can build with the device

For all of these reasons, Appendix E contains simplified datasheets for a number of common devices that are easier to read than the standard ones.

For the LM393, the important points are as follows:
  1. 1.

    The input voltage on VCC can be anywhere between 2 V and 36 V.

     
  2. 2.

    When sensing voltage, the LM393 doesn’t really draw any (or at least much) current, so there are no parallel resistances we need to worry about.

     
  3. 3.

    The output is high when IN+ is greater than IN- and low (i.e., near-ground) when IN+ is less than IN-, with an error range of about 2 millivolts.

     
  4. 4.

    When the output is low, this means the output pin will conduct current into itself (since it is at ground, positive charge will naturally flow into it), but if it sinks more than 6 mA into it, you will destroy it, so you have to be sure that you know the maximum amount of current that could flow through the pin when it is at ground.

     
  5. 5.

    When the output is high, this means the output will not conduct any current, but instead act as if it were disconnected. As we will see, this will allow us to supply our own “high” voltage level.

     

That isn’t to say that the datasheets aren’t important, but for a beginner, the datasheets usually aren’t what you need to get started.

11.4 A Simple Circuit with the LM393

In this section, I am going to show a simple circuit using the LM393 chip. In doing so, we are going to be using several of the resistor circuit patterns that we learned in Chapter 9.

The circuit we are discussing is shown in Figure 11-5. Can you identify the resistor circuit patterns? Take a minute and see if you can find some. Note that the wire coming out of 1IN- crosses two wires that it is not joined with.

The first thing to notice is that we have two voltage dividers. The first voltage divider is between R1 and R2. Since R1 and R2 are the same resistance and are connected to both 5 V and 0 V, that means that they divide the voltage in half, giving a 2.5 V output. The second voltage divider is between R3 and R4. Since R3 is half of the resistance of R4, that means that it only uses up half as much voltage as R4. Thus, since R3 eats up 1.7 V and R4 eats up 3.3 V, the wire coming out from the middle is at 3.3 V.

Then, to the right of the circuit, you can see that we have a current-limiting resistor in front of the LED. That is not its only function, though. It also functions, as we will see shortly, as a pull-up resistor.

So what is the big triangle? Comparators (and several other circuits commonly placed on ICs) are represented as triangles in the schematic (we could have also placed the chip itself there). Each of the connections is labeled the same as they are labeled in the pinout diagram in Figure 11-4 so they would be easy to locate.

The way that the circuit works is very simple. The voltage coming in to 1IN+ is 3.3 V, and the voltage coming in to 1IN- is 2.5 V. Since 1IN+ is greater than 1IN-, then that will turn 1OUT to high (positive voltage). However, remember that we said that 1OUT does not conduct when it is high. It acts like an open switch. Therefore, R5 acts like a pull-up resistor and supplies the positive voltage for us to our LED to turn it on.

Now let’s say that the input voltages were reversed. What would happen? If 1IN- is greater than 1IN+, then 1OUT will go low (0 volt) and also conduct. It will act like a closed switch going to ground.

Therefore, current will go the easy route—it will go through 1OUT (directly to ground) instead of through the LED (1.8 V or more), effectively denying power to the LED and switching it off. This works just like the switch in the circuit in Chapter 9, Section 9.4, “The Pull-Up Resistor.” When 1OUT is low, it acts like a closed switch to ground and acts as a sink for all current at that point in the circuit. When 1OUT is high, it acts like an open switch, and whatever voltage/current you provided at that point is allowed to continue on.

The resistor R5 does several jobs. The first job is to act as a pull-up resistor, as we just described. Remember that a pull-up resistor prevents the load to ground from going too high when the switch is closed. Without the pull-up resistor, when the switch is closed (1OUT goes low), we would have a short circuit from the voltage source to ground. This would not only waste a large amount of electricity; it would break the LM393, because it can only sink a maximum of 6 mA of current. Having a 2 kΩ resistor, we limit the current for the closed switch to I = V/R = 5/2,000 = 0.0025 A = 2.5 mA.

When the switch is open, the current flows through the resistor to the LED, and then the resistor acts as a current-limiting resistor for the LED. The amount of current to the LED will be calculated as I = V/R = (5 − 1.8)/2,000 = 3.2/2,000 = 0.0016 A = 1.6 mA.

11.5 Resistive Sensors and Voltages

One of the more practical uses of the voltage comparator circuit is to measure the values of sensors which act as variable resistors. Many different materials in the world act as resistors. What’s really interesting is that many of these materials change their resistance depending on external factors. Some of them change their resistance based on temperature, pressure, light, humidity, and any number of other environmental factors.

Now, changing resistance doesn’t tell us much by itself. If we put a resistor between a voltage source and ground, it will always eat up that voltage source. However, if you use it in concert with a fixed resistor to make a voltage divider, you can then get the output voltage to vary based on the changes in resistance.

Figure 11-6 illustrates this principle. It is a simple voltage divider, where the top resistor is actually a photoresistor (a resistor that varies based on light) and the bottom resistor has a fixed resistance. Thus, as the light varies, the top resistance will vary. This will change the ratio between the top and bottom resistors, which will affect the output voltage.

To use this circuit, you will need to know the resistances of your photoresistor on the different conditions you are interested in. I usually use the GL5528, which ranges from 10 kΩ in bright light to 1 MΩ in complete darkness. However, depending on your specific photoresistor as well as the light conditions that you think of as “light” and “dark,” the resistance values that are relevant for light and dark will be different for you. So, whatever photoresistor you use, it is worthwhile to measure the resistance using your multimeter in the different conditions you think of as light and dark.

11.6 Sensing and Reacting to Darkness

So far in the book, we have focused entirely on example circuits that didn’t really do anything. They lit up, they had voltage and current, but there wasn’t much interesting that they were doing. However, now, we finally have enough knowledge to start building circuits that do something.

We have
  1. 1.

    A way to generate a fixed voltage (using a voltage divider)

     
  2. 2.

    A way to generate resistances from real-world events (photoresistors and other resistance sensors)

     
  3. 3.

    A way to convert changes in resistance to changes in voltage (using a voltage divider with one fixed resistor)

     
  4. 4.

    A way to compare our varying voltage to our fixed voltage (using the LM393 comparator)

     
  5. 5.

    A way to utilize the output signal from the LM393 to do work (using the pull-up resistor and the LED)

     

There are a lot of pieces to put together this simple circuit, which is why it has taken so long to do anything worthwhile. However, if you have followed along carefully, now that you are here, you should be able to see how all of this fits together.

What we will do is to take the circuit given in Figure 11-5 and modify R4 to be our photoresistor and R3 to be a fixed resistor. In my own testing, I discovered that the light/dark switchover point for my photoresistor was about 15 kΩ. Therefore, I am going to use a 15 kΩ resistor as the fixed resistor for R3. Yours may need to vary based on your experimentation with your photoresistor.

When there is light in the room, the photoresistor will have a lower resistance than 15 kΩ, which will make the fixed resistor R3 use up more of the voltage. Thus, the voltage at the divider will be less than 2.5 V, which will turn 1OUT to low (which closes the switch and makes a path to ground on the output before it gets to the LED, which turns the LED off).

In low-light conditions, the resistance will jump way up above the resistance of the fixed resistor. If the upper, fixed resistor has less resistance than the bottom resistor, then the voltage at the divider will be larger than 2.5 V, activating the comparator and turning 1OUT to high (i.e., opening the switch and allowing power to flow through the LED).

The final circuit is given in Figure 11-7. You can see a way to lay it out on the breadboard in Figure 11-8.

11.7 Sources and Sinks

Two terms that often come up when dealing with circuits are the concepts of a current source and a current sink . A source is a component whose pins might provide current to other parts of the circuit. A sink is a component whose pins might pull current from other parts of the circuit.

For the LM393, its input pins neither source nor sink current (at least not any significant amount). The input pins more or less just sense the voltage without pulling any measurable current. Therefore, they are neither sources nor sinks of current. Technically, they probably sink a few nanoamps (billionths of an amp), but not nearly enough to affect our circuit analysis.

The output pin, even though it is called an output, doesn’t source any current. Instead, it acts either as a sink (when low) or as a disconnected circuit (when high). This is known as an open collector output.

Anytime an IC sources or sinks current, be sure to read the datasheets on the maximum amount of current it can source or sink. These are usually quantities that you have to limit—they are merely telling you at what point their circuit will physically break. Therefore, you must use resistors to limit the currents to make sure that they are within limits.

However, be aware that many (but certainly not all) ICs do not source current, using open collectors for their output operations. This has the disadvantage that you have to supply your own voltage and pull-up resistor to the output pin, but it also has the advantage that the output is set to whatever voltage level you choose. In other words, you don’t need to pick a new comparator IC to get a different output voltage.

11.8 Review

In this chapter, we learned the following:
  1. 1.

    Integrated circuits (called ICs or chips) are miniaturized circuits packaged up into a single chip that can be added to other circuits.

     
  2. 2.

    ICs can have a few or several billion components on them, depending on the function.

     
  3. 3.

    ICs have different types of packages, including through-hole (optimized for breadboards) and surface mount (optimized for soldering and machine placement).

     
  4. 4.

    Dual in-line packages (DIPs) are the most common through-hole packaging type used for students, hobbyists, and prototype builders.

     
  5. 5.

    DIP chips should be placed in the breadboard saddling the bridge, so that each IC pin is attached to its own terminal strip.

     
  6. 6.

    On most chips, pin 1 is located immediately counterclockwise of the notch in the chip, and remaining pins are numbered counterclockwise.

     
  7. 7.

    Most ICs are active devices, meaning that they have a direct connection to a power supply and ground in addition to their normal input and output pins.

     
  8. 8.

    An IC datasheet is a document that tells about the electrical characteristics of an IC. However, most of them are difficult to read and assume you are already familiar with the part. However, they are very useful for getting a pinout for the chip as well as telling the maximum ratings for voltages and currents.

     
  9. 9.

    The LM393 is a dual voltage comparator IC—it compares two voltages and alters its output based on which is larger.

     
  10. 10.

    The LM393’s inputs do not consume any significant current when sensing the input voltages.

     
  11. 11.

    The LM393’s outputs are open collectors—which means that they act as a switch to ground. When the output is “low,” the pin acts as a closed switch to ground. When the output is “high,” the pin acts as a disconnected circuit.

     
  12. 12.

    Because the LM393 acts as a disconnected circuit when high, a pull-up resistor circuit is required to get an output voltage.

     
  13. 13.

    Many sensors are based on the fact that the resistance of many materials will change with environmental factors. Therefore, the sensor acts as a variable resistor, with the resistance telling you about the environment.

     
  14. 14.

    A resistive sensor can be used with a fixed resistor to make a variable voltage divider, essentially converting the resistance to a voltage, which then can be detected.

     
  15. 15.

    By putting the sensor-based resistive voltage divider in comparison with a fixed reference, we can use the LM393 comparator to trigger an output when the sensor crosses some threshold of resistance.

     

11.9 Apply What You Have Learned

  1. 1.

    Calculate the amount of current flowing through each element of the circuit in Figure 11-5. You can presume that the LM393 uses about 1 mA for its own (internal) operation and that the LED is a red, 1.8 V LED. What is the total amount of current used by the circuit?

     
  2. 2.

    Take the circuit in Figure 11-5 and swap which voltage divider is attached to 1IN+ and 1IN-. Now calculate the total amount of current used by this circuit.

     
  3. 3.

    The Spectra flex sensor is a resistive sensor that changes its resistance when bent. When it is straight, it has a resistance of 10 kΩ. When it is bent, it has resistances of 60 kΩ and above. Draw a circuit that turns on an LED when the resistor is bent. Use a resistor symbol for the flex sensor, but label it as FLEX.

     
  4. 4.

    Build the circuit in Figures 11-7 and 11-8.

     
  5. 5.

    If you wanted to wait until the room was even darker before the LED went on, how would you change the circuit?

     
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.182.179