Useful links


EXPERIMENT #6 PRELAB

So far in the ECE 110 Laboratory, everything you have done has involved a human somehow supplying input, and the circuit giving some sort of output. In Labs 2 and 3 you manually turned the motors on and off using switch the switch on the back of the car. In Lab 6 you examined the outputs of several simple logic gates by either tying them to the ground or to the power. Clearly, if this were the only way that we ever did things life would be pretty dull. Manually giving a circuit an input, observing the output, and then giving the circuit another input is not what we want to do. If computers ran like that, you'd have to manually change all the inputs and outputs to the processor in order to handle each different keystroke on the keyboard! What we really want to implement is a Feedback Control Loop. We want the car to be able to change its state based on some input, and have that change in state create a new input to the car, which causes the car to change its state again, etc. This concept is illustrated in the following diagram:

Pasted Graphic 8


Notice that this diagram illustrates a very simple loop: The car receives some input from the Tape and Board through the IR Sensors. This input is then processed through some logic circuit. The result of the logic circuit is passed through the Current Amplifier to the Motors, resulting in a change of state (that is, the car moves.). This change of state then results in a new input (the position of the car has changed, so the location of the tape is different), which closes the loop. This is what allows the car to be autonomous; it is constantly giving itself new inputs to process. Feedback control is the basis for all of computing, and issues relating to feedback control are still interesting research topics even to this day.

  1. Think of two systems that you believe demonstrate feedback control. Describe the systems and explain why you think they demonstrate the characteristics of a feedback control system.

    By the end of the lab you will have put together 3 different circuits that provide simple control loops to keep the car on track. Unfortunately, the loop can be broken if the car stops for some reason, or the car loses the tape - all of which will happen to all of these designs on some portion of the track. Most of your design challenge is to modify the existing designs - or creating completely new ones - to make your control loop more and more robust. But first we must become acquainted with an important part of this feedback loop. We have looked at how the motors work. We have fiddled with the logic gates. We need to become comfortable with using the IR sensors and then we can close the loop with some simple designs.

    The sensors are the transducers that change the electromagnetic energy in the IR signal to electrical energy that we read as a voltage. The reflective object sensor is made up of two components: i) a photodiode that transmits infrared light and ii) a photodetector that detects any infrared that is reflected from the table back to the sensor - notice that the current generated by the phototransistor is enhanced by connecting another transistor in parallel in the Darlington configuration - the transistor configuration that we studied in lab 5. You will see two ‘windows’ on the detector – one for the transmitter and one for the detector. Below is the schematic of the device – the pins are labeled as looking from the bottom.

    Pasted Graphic 10


    These sensors are put into a bar that has 19 slots for 19 sensors. This sensor bar itself is a circuit and it characteristics also need to be evaluated. A persistent problem with many designs is getting the height of the sensors correct so that distinct voltages are seen when looking at surfaces with different IR reflectivities - we use a black matte surface to provide low reflectivity and white correction tape to provide a higher reflectivity. An equally prevalent but much more difficult to diagnose problem is the problem of getting a good low voltage when many sensors are connected to the same bar, particularly when hooked up to logic gates. You will be investigating some of its properties in this lab.

    You will be introduced to three simple circuits that employ simple feedback. Input from the sensors in all three circuits are input into some combination of inverters. The outputs of these inverters are the digital circuit that decides how to control the motors so that the car can follow the tape under limited circumstances. These three circuit are three of many possible circuits using four sensors placed in the center of the sensor bar - two looking down at the tape and two straddling the tape (see figure below).

    lab7_sensor_configuration_general


    Below are three designs that combine the outputs of the four sensors in unique ways. We have given them names according to their strategy of keeping the tape close at hand - tape-following (leftmost), tape-avoiding (middle), and tape-seeking (rightmost). You will be building these three circuits and playing with them using a real track - the names will then become obvious if not before.

  2. When a sensor is over a white piece of tape it reads a high voltage (equivalent to a logical '1') and when a sensor is over black it read a low voltage (equivalent to a logical '0'). Given that the sensors respond to the presence or absence of white tape in this way fill in the table below for the tape avoiding and tape seeking strategies.

    Specify the logic levels for both strategies for the left and right motor signals L and R given all 16 possible states of the sensors LS1, LS2, RS1, and RS2. Since each strategy depends on only a limited set of all four sensors some of the inputs don't matter. The column for the tape-following circuit is already filled in for you .

  3. As you can see the tape-following scheme utilizes only 2 sensor outputs and in fact the L=RS1 and the R=LS1. Write down for the other two schemes the logic equations describing the L and R signals in terms of LS2, LS1, RS1, and RS2. Use the overbar notation to negate a signal.


Pasted Graphic 9Pasted Graphic 11lab7_tape_seeking_circuit

lab7_table_prelab

Now consider how to make each of these designs stop when the vehicle encounters a white 8.5"X11" piece of paper. One of these designs will stop automatically - the other two need to include the outputs from one or more other sensors than the ones they use to navigate the track.

  • Design and draw an additional circuit for each design that makes the vehicle stop on a white piece of paper.



    EXPERIMENT #6


    IR sensors - adding eyes to the vehicle


    a) investigate the behavior of the sensors in sensor bar



    1. The sensor bar is one of the most important circuits that you will use on your vehicle. It has some complex behaviors when connected to the logic especially when many sensors are put on the same bar. Each sensor bar has slots for 19 sensors. In this portion of the lab you will investigate how one sensor responds to the reflection of IR from the white and black tape. Since the sensors are really just transistors whose base current is IR radiation instead of a current you know from the previous labs that differing amounts of base current allow different amounts of current to flow through the device producing a range of voltages depending on the reflectivity of the surface and the surface's proximity to the sensor. You will fight with sensor height for the rest of the semester. In this section you will investigate some of the parameters that will effect you designs.

      Get one sensor and insert it into the sensor bar as shown in the pictures below. Make sure that the writing on the sensors faces the vertical face of the fiberglass mounting unit. Connect one of the sensor wires to the small post just above the sensor where the voltage is available. Since you will be using the cars in the next section mount the protoboard on the vehicle and connect the black and red wires to the ground and Vcc supplied by the logic voltage connectors (that supply 5V) on the cars. DO NOT CONNECT THESE WIRES TO THE MOTOR VOLTAGE YOU WILL RUIN THEM. One sign that you have hooked them up incorrectly is that they will get very hot. They are not suppose to be hot. Now insert the other end of the sensor wire into one of the holes in the protoboard and monitor the voltage using the multimeter. Don't put the sensor bar on the car yet.


    2. Face the sensor towards the floor. What voltage do you read?
    3. Face the sensor up towards the light. What voltage do you read?
    4. Move the sensor around, touch it with your finger, move it closer and farther from the desk. What is the range of voltages that you read?

      Now stuff the sensor bar with sensors - fill all of the slots with sensors, still monitoring the same sensor.


    5. Orient the sensor bar so that it is facing the floor or off the edge of the table so that you get a low reading. What does the voltage from the sensor you were monitoring read now?
    6. Check the voltages of the other sensors on the bar, indicate the range of voltages that you find.
    7. Now touch the sensor with your finger. Do you still get a good high reading?
    8. Play with the sensor that you are monitoring, letting it see high and low reflectivity and play with the surrounding sensors at the same time. You should notice that the lowest values are affected more that the higher values. This is unfortunate since the lower range of the TTL gates that we are using have a rather narrow lower range and often, if many sensors are used on a bar it is very hard to get a good 0 state. But there is a simple fix - the PULL-DOWN resistor. Set the sensor bar so that the sensors read the lowest voltage. Place a 1KΩ resistor from the sensor output to the ground of the battery source. What happened to the voltage from the sensor?




      Pasted Graphic 13


      Remove all sensors but one. Now, mount the sensor bar on your vehicle. As you can see when you insert the long screws into the holes in the vehicle arms that the height of the sensor bar is adjustable. Remember to reconnect the red and black wires from the sensor bar to Vcc and ground. With the sensor bar on the vehicle we can investigate the effect of sensor height on the voltages measured when the sensor is looking at a black surface and a white surface.


    9. Push the sensor bar up as high as it will go so that the sensor is as far from the table as possible on the vehicle. Put a black strip under the sensor and record the voltage in the table below. Repeat for a white strip.
    10. Now push the sensor bar down as far as it will go without the sensor touching the table or the colored strips. Repeat the measurements of the voltage when looking at black and white strips for this height.
    11. Now repeat for an intermediate height. Can you find a height where the voltage for a white strip is 3.5V or greater while at the same time the voltage for a black strip is less than .3V?

      Pasted Graphic 14



      b) investigate the behavior of the sensor connected to external circuitry

      Now we will connect the sensor to external circuitry to see how they behave when connected to TTL logic. Build the circuit shown below. It simply connects the sensors to a NAND gate which is located on the chip labeled 74LS00. You can find the pinouts for the NAND chip in the data sheets by following the links to the left.

      Pasted Graphic 2

    12. Measure the voltage from the sensor disconnected from the gate and record.
    13. Now reconnect the sensor output to the gate. What is the voltage from the sensor now? How did it change? Insert the 1KΩ pull-down resistor. Did it help?
    14. With the car sitting on the table, observe and record the output of the sensor and the NAND gate on the oscilloscope while presenting alternately a white and black surface in front of the sensor. Be sure that the sensor bar is adjusted to a reasonable height. What logic function is this circuit emulating?


      Simple circuits for controlling the vehicle - adding a navigation system


      So far we have studied some of the parts that will go into your car designs - the motors, the current amplifiers, IR sensors, and some digital logic. Now we have enough experience with these critical components to build some simple circuits that control the vehicle so that it will follow a white piece of tape on the black table through some gentle turns. Three different strategies will be introduced - tape following, tape avoiding, and tape seeking. At the end of this lab if you are successful in designing these circuits your vehicle will probably be good enough to get at least 1/3 of the points in the final design challenge. The design process is beginning in earnest.


      a) tape following circuit –

      Insert 4 of the sensors into the sensor bar in the suggested locations (figure drawn as viewed from above). You will use the two center sensors for this part. Simply connect the right center sensor to the current amplifier (pin1) connected to the left motor - same for the left center sensor. Now set the car on the table and using either the oscilloscope or a multimeter measure the voltages from the sensors when they see alternately white and black. Use the oscilloscope/multimeter to set the height of the sensors so that you see a low value for black (.8V or less) and a high value for white (3.8V or greater).


      Pasted Graphic 9



      The signals L and R will tell the left and right motors to turn on and off so we need to combine this circuit to the circuit that we used to run the motors using the CA module. Remember that the CA module is used to allow us to turn the motors on and off electronically with signals provided by TTL logic. In lab 5 we hooked up the motors as shown below.


      Pasted Graphic 13


      The input to the CA on pin 1 was used to tell the motor to turn ON (if the voltage/current into the 'base' of the CA were sufficient to turn on all of the transistors, pin 1 connected to Vcc) and OFF (if the voltage/current were low and all of the transistors were off, pin 1 connected to gnd). Now you will build the same circuit except the Battery in the figure is replaced by the output of your circuit - the signals R and L - see figure below.


      Pasted Graphic 6



    15. Turn on the power and, with the vehicle still on its stand, test the response of the motors to different inputs to the sensors. You can do this quickly by putting your finger over the sensors. There are four possible states which are the two different sensors seeing either white or black - record the response of the motors to the four different combinations.
    16. When you are satisfied that the design is working properly, turn off the power, take the vehicle to one of the boards in the center of the room, place it with the two middle sensors over the white band of tape, turn the power on, and observe and describe the behavior of the autonomous vehicle. Does it follow the white band? How does it handle different types of turns? What types of turns cause it to lose the track?

      b) tape avoiding circuit –

      On another part of the protoboard build the tape avoiding circuit shown below.In this design the two outside sensors are connected to two inverters and the resulting signals R and L are connected to the current amplifiers connected to the right and left motors respectively. Your circuit should now look like the diagram below.


      Pasted Graphic 11


    17. Turn on the power and, with the vehicle still on its stand, test the response of the motors to different inputs to the sensors. You can do this quickly by putting your finger over the sensors. Again, there are four possible states - record the response of the motors to the four different combinations.
    18. When you are satisfied that the design is working properly, turn off the power, take the vehicle to one of the boards in the center of the room, place it with the two middle sensors over the white band of tape, turn the power on, and observe and describe the behavior of the autonomous vehicle. Does it follow the white band? How does it handle different types of turns? What types of turns cause it to lose the track?

      c) tape seeking circuit -

      In yet another part of the protoboard build the tape seeking circuit illustrated in the figure below. This design uses only a single outside sensor connected to a single inverter as shown in the figure below.


      lab7_tape_seeking_circuit

    19. Repeat 15 and 16 for this design as well.


      c. tape following vs. tape avoiding vs. tape seeking–

    20. Describe in words how the three strategies work - how does each circuit guide the car to follow the white tape?
    21. Compare the three designs - you may find that one type of circuit handles certain types of turns more easily. Describe the similarities and differences in the behavior of the car while using each type of circuit.
    22. For each design, explain how having the sensors in different positions can impact how the vehicles runs on the track. How is the behavior affected by sensor placement? Do the designs navigate the entire track better for some placements? Are some types of turns easier and others more difficult?
    23. For each design move the sensor bar almost all the way up as far as it will go. Run each design on the track. Do any of the designs perform better? Worse? Same?
    24. For each design move the sensor bar so that the sensor bottoms are about 1/4" from the table. Run each design on the track. Answer the same questions.

      d. adding a stop criteria (optional)–

      Add the logic to cause the car to stop for each circuit so that you can implement a stop without adding additional sensors.

    25. Put the car on the table and try to see if the car can still navigate the track and also stop. Most designs work much better if additional sensors are added - that are dedicated to the STOP function. As you probably found, sometimes the stopping interfears with the navigation.