ECET 365 Week 2 Lab DeVry
Just Click on Below Link To Download This Course:
ECET 365 Week 2 Lab DeVry
Lab 2:
Interfacing to the Smart Car Video Sensor
Objectives
- Develop a hardware interface to the visual sensor in the Robotic Car Kit.
- Test the sensor with software and use data to control the steering servo.
Parts List
- Robotic Car Kit with visual sensors
- Freescale Tower Kit with S12G128 CPU board
- PC with IDE software (e.g. CodeWarrior Development Studio V5.1)
Introduction
- The Robotic Car is required to follow a one-inch-wide centerline around a track. In the actual contests, various track configurations could be encountered. Here, we use an oval track made with sheets of white foam board and 1-inch-wide black cloth Gorilla Tape (labeled “Not Electrical Tape).
- The visual sensor system is provided in the Robotic Car Kit to follow the center line. The scheme is to use two sensors, one on each edge of the center track. The sensors are infrared sensors. There are also two infrared LEDs that illuminate the area of the track seen by the sensors. Each sensor detects the infrared energy that is reflected from the track surface. When the Robotic Car is centered on the centerline, both sensors see almost no infrared light reflected from the black surface. However, if one of the sensors strays onto the white background (the foam board), the infrared light is greatly reflected and the sensors alert the CPU that the car has moved too far left or right.
Deliverables
Answer all
questions in Week 2 Lab Cover Sheet here (Links
to an external site.)Links to an external site..
Submit
your Week 2 Lab Assignment.
You
can also download the cover sheet for Week 2 Lab in the Files section of the
Course Menu.
Required
Software
CodeWarrior
Development Studio for S12(x) V5.1
Access the
software at http://www.nxp.com/ (Links
to an external site.)Links to an external site. (Links
to an external site.)Links to an external site..
Lab Steps
STEP 1:
Procedures
- Construct Interface between Visual Sensors and CPU Board
- The PmodLS1 Infrared Light Detector Module Reference Manual (in the Files section of the Course Menu) describes the module that is the interface between the CPU Board and the Visual Sensors. Examine the photographs in Appendix B of the Construction Notes for the Robotic Car and observe that the module is soldered to the proto-board via the 6-pin header strip. The pins need to be bent down (carefully) at a 45 degree angle so that the module is slanted upward. The cables from the sensor modules (attached to the front bumper via Velcro supplied in the Robotic Car Kit) are connected to the module. Note the color coded wires correspond to the markings on the module. This project uses S3 and S4. The module includes LEDS to show the functioning of the outputs of the sensors. An LED which is on means that a logical 1 is on the output pins. See Figure 3 showing the orientation of the sensors on the bumper.
- Testing the Video SensorsIt is recommended to operate the sensors from the +3.3V power on the proto-board. This power comes from the power supply at the bottom of the primary elevator of the Tower. The power supply has two screw terminals for +5V input and Ground. You should use the battery holder (4 AA cells), but make sure the total battery voltage is less than 5.5 volts. If you run the sensors from +5 V directly, you will put more than 20 mA through the LEDs, possibly damaging them.In place of an actual track, we can use an index card with a center stripe that is black and 1inch wide. See Photos 1 and 2 in Appendix B. Black GorillaTMTape is recommended, but you could use a black felt marker. Make sure the color is uniform.
- The PmodLS1 module contains a small potentiometer that can be adjusted with a small flat bladed screwdriver approximately 0.070 inches in width. We want to adjust the potentiometer so that the LEDs on the module (LD3 and LD4) are off when the center strip is along the center axis of the car. As the strip is moved to one side, one LED will light up as the sensor sees the white background of the index card. The other LED will light up when the card is moved to the other side.Both LEDs will light up if both sensors see the white background, which indicates that the car has left the center track entirely.
- The right sensor output (LD4) is connected to Primary side pin A47. The left sensor output (LD3) is connected to Primary side pin A48. These pins are accessible from the proto-board. The connecting wires can be soldered to the holes from either the top or bottom of the proto-board.Pin A47 is the input to Port A (A0). Pin A48 is the input to Port A (A1 ). By examining the Robotic Car programs in Appendix A, you can see how the sensor inputs are used for the steering logic.
- The program stops the right wheel if the left sensor sees the white background. Similarly, the left wheel is stopped if the right sensor sees the white background. In either case, the result is that the wheel which is still turning moves the sensor back onto the black stripe.If both sensors light up, it means that the car has gone off the black stripe completely, and both motors stop.When all motor and sensor connections and the power wiring is complete, we can load the first program and test the steering system. We will do this in the next task.
- Set the car on a block (firm packing foam works) so that the wheels can turn without interference. Ensure that the batteries are installed.
- The TWR-S12G128 CPU board and the proto-board should be installed in the Tower. Make sure the primary edges of the boards are installed on the primary elevator of the Tower. The boards can be installed backwards but they will not work.
- Consult the TWR-S12G128_UG.pdf User Guide. The Power section shows that the Power Select jumper (JP5) should be set to pins 3 and 4, the default setting. This is necessary for the PC to program the CPU board.
- Turn on SW1. The +5V LED and +3.5V LED at the bottom of each elevator should light up. Also, a green LED on the CPU board will light up.
- Using a PC with the CodeWarrior V5.1 installed, connect the USB cable between the PC and the CPU board. More LEDs will light up on the CPU board. See the “Connecting the Robotic Car to CodeWarrior” document in the Files section of the Course Menu.
- Once the program is running, you can remove the USB cable from the CPU board. The program will shut down when you shut down the power to the CPU board, but it will resume when the power is again applied.
- Center the striped index card under the Visual Sensors and ensure that both sensors are over the black stripe. Turn on SW2 and SW3. Both wheels should be rotating.
- Move the card to the right side. When the left sensor reaches the white background, the wheel on the right side should stop.
- Move the card to the left side. As the sensors go over the black stripe, both wheels will rotate. When the right sensor reaches the white background, the left wheel will stop.
- This completes the testing of the Robotic Car.
- Observations – Complete the following questions in the Week 2 Lab Cover Sheet and submit your Lab assignment.
- Sketch the change in the output of the visual sensors as the striped index card is moved from the center to each side of the center line.
- Describe the effect of the potentiometer on the output of the sensor module.
- If the motors and software are installed, describe the action of the drive wheels as the index card is moved left and right.
Comments
Post a Comment