TEXAS A&M UNIVERSITY ENGR 111B: Foundations of Electrical & Computer Engineering Lab 6: Photo-Detection Team Members: _________________________ _________________________ Section Number: __________ Team Number: __________ This Lab is due by the Beginning of the Next Lab Session. Written By: Hank Walker Lorne Liechty Written by Texas A&M University 1 Lab 6: Photo-Detection Time Limit: 1 week OVERVIEW In this lab, students will construct a circuit on the protoboard to have the robot follow a light source. In order to perform this exercise, the following new material will be introduced: - Photo-detection BACKGROUND To assist students in completing the exercises required by this lab, the following background information has been provided. It is recommended that each student read all of the following information as a beneficial review of the topics required. PHOTO-DETECTOR CIRCUITRY Photo-detection circuits fall into the category of optical electronics. Optoelectronic devices are used to detect or emit light as part of their operation. The photo-detection circuit in this lab will measure two different amounts of light, and compare the difference between them. In this way, we will be able to determine the relative direction of the strongest light source. This comparison will be used to control the motors to turn the robot towards the stronger light source. Conversely, one could have it turn away from the light. The method that will be used to measure the light source is a photoresistor (also termed a photocell). As discussed in lecture, a photoresistor is a resistor whose value falls with increasing light intensity. Photons knock electrons loose from dopant atoms, and these additional carriers reduce the resistance. A typical photoresistor is shown in Figure B1. Figure B1: Typical photoresistor design. Written by Texas A&M University 2 In this lab, the resistance of the photocell will be used in a voltage divider circuit, which will vary the voltage between the photocell and the connected resistance. Figure B2 shows how this system would work if a photocell were connected to a fixed resistor. We approximate the photoresistor resistance as falling linearly with increasing light intensity. As can be seen in Figure B3, this is approximately correct. Figure B2: Photocell voltage divider and hypothetical model. Figure B3: Photocell resistance vs. illumination. As can be seen in Figure B4, the spectral (light frequency) response of a photoresistor depends on the material. We are using cadmium sulfide (CdS), which responds primarily in the visible light range, with a peak response to green light. Other materials include cadmium selenide (CdSe) and cadmium telluride (CdTe), with peak responses in the infrared light range. Written by Texas A&M University 3 Figure B4: Photoresistor spectral response characteristics. The output of the circuit in Figure B2 can be fed to a comparator, along with a potentiometer-derived voltage reference, as was done with the RC timer in Lab 4. This converts the photocell output to a logical output, that is, the light intensity is above or below a threshold determined by the potentiometer setting. We will use this logical output to turn a motor on or off. Written by Texas A&M University 4 LAB EXERCISES BEFORE YOU COME TO LAB: Use the truth table in Table L1 to design the logic so that the robot turns towards the brightest light source. If both photoresistors receive similar light, the robot should go “straight” (even if your robot really curves). You will have photoresistors on the left and right sides of your protoboard. Table L1: Logic for photoresistor circuit. Left Sensor Light Right Sensor Light More Less Same Same Less More Left Motor On? Right Motor On? You will build and design a photo-detection circuit that will use the logic in Table L1 to steer the robot towards the brightest light source. To begin, assemble the circuit shown in Figure L1 on your protoboard. You will use your LM393 dual comparator, two photoresistors, two 25-turn 10 k potentiometers, two 1 k resistors, and two MPSA06 NPN transistors. Place the photocells close to each edge of the protoboard, with no light obstructions. The circuit will compare the amount of light on each photoresistor, and turn the motors on or off as necessary to turn towards the strongest light source. Figure L1: Photo-detection Circuit Written by Texas A&M University 5 The LM393 functional schematic and pin diagram is shown in Figure L2. Figure L2: Functional Schematic of LM393 Comparator The comparator outputs are hooked up to MPSA06 NPN transistors, which in turn power the motors, as in Lab 4. The comparator outputs are connected to the base inputs of the MPSA06 transistors, with the emitters connected to ground, the collectors connected to the motor, and the other motor terminal connected to the battery. As a reminder, the MPSA06 pin-out is shown in Figure L3. Figure L3: Packaging Diagram of MPSA06 NPN Transistor. It is housed in a TO-92 package. With the flat side up, the emitter is pin 1 on the left, base in the middle, and collector on the right. (Most transistors have the base in the middle and collector on the right). 1. In order to ensure that the circuit functions properly, the reference voltages for each comparator must be properly set. First, measure the voltage at the node between the two photocells, termed the “center voltage,” when both are receiving the same amount of light (e.g. they are directly under a ceiling light). Be careful not to obstruct the light when making this measurement. Cover one photocell with your hand (avoid touching the top of the photocell), and observe how the voltage changes. Repeat this for the other photocell. Record the center voltage in Table R1 for these three cases. Written by Texas A&M University 6 2. The reference voltages need to be set so that the motors follow the logic in Table L1. One reference voltage will be higher than the nominal (equal light on each photocell) center voltage, which the other reference will be lower. When the center voltage rises or falls, it will rise above the upper reference or fall below the lower reference. The closer the references are to the nominal center voltage, the more sensitive the circuit will be to a difference in the light on each photocell. Initially, set the voltage of reference 1 (in Figure L1) to be 1V above the nominal center voltage and reference 2 to be 1V below the center voltage. Record these reference voltages, and measure both of the comparator outputs as you cover and uncover the sensors. Remember that the high comparator output will be about 0.8V when connected to the base of the NPN transistor. Record your findings in Table R2. 3. Place the robot on the floor and see how it functions seeking a bright light source. You can use laser pointers, flashlights, or hands blocking the light, to vary the light sources. 4. Adjust the reference voltages until the robot is performing suitably. Record the operating characteristics of the circuit in Table R3. 5. Reverse the logic of the photo-detection circuitry so that the robot will turn away from the source of light rather than turn towards it. This may be done by altering the comparator reference settings and altering the comparator input connections, or altering the motor connections. The goal is to reverse the motor settings compared to Table L1. 6. Test the new darkness seeking system to see that it is working properly. Once the robot is operating successfully, record the operating characteristics in Table R4. Written by Texas A&M University 7 RESULTS: to be uploaded onto elearning.tamu.edu 1. MEASURING CENTER VOLTAGES Both Uncovered Covering Left Covering Right Table R1 2. Negative Reference Voltage: ________________ Positive Reference Voltage: ________________ COMPARATOR OUTPUTS Normal Covering Left Covering Right Low Reference High Reference Table R2 3. Negative Reference Voltage: ________________ Positive Reference Voltage: ________________ Right Sensor Covered No No Yes Yes Light-Seeking Photo-Detector Operation Center Left Right Left Sensor Voltage Comparator Comparator Covered (V) Output (0/1) Output (0/1) No Yes No Yes Table R3 Written by Texas A&M University Direction of Turn (Right / Left) 8 4. Negative Reference Voltage: ________________ Positive Reference Voltage: ________________ Right Sensor Covered No No Yes Yes Light-Seeking Photo-Detector Operation Center Left Right Left Sensor Voltage Comparator Comparator Covered (V) Output (0/1) Output (0/1) No Yes No Yes Table R4 Written by Texas A&M University Direction of Turn (Right / Left) 9 REPORT: to be uploaded onto elearning.tamu.edu REPORT REQUIRMENTS Answer the following questions: - Explain the function of the Photo-detection circuit Explain why the logic needs to be reversed to avoid the light. Written by Texas A&M University 10