Search for question
Question

Computer Controlled System Design I Lab-9: Ultrasonic Sensor (Advanced Sensor) Objectives: • • • Learn the theory of operation of ultrasonic sensor. It is considered an advanced sensor because it has a built-in micro-controller to control its operation. Learn to interface ultrasonic sensor to a micro-controller. Display sensor data in Serial Monitor and Serial Plotter windows for analysis and debugging. Control an analog output device (LED brightness) by using the ultrasonic sensor. Pre-Lab Assignment: Read the following reference material available in Lab...zip file to complete pre-lab assignment: [1] Ultrasonic sensor technical specs and data sheet [2] Arduino Reference - Constrain function [3] Arduino Reference - Map function Equipment: Arduino board, USB cable, Ultrasonic sensor, Common Cathode RGB LED (or three different color LEDs), Jumper wires, Breadboard (or Sensor Shield) Procedure: Part 1: 1. Download the Lab...zip file from Blackboard. The zip file contains the documents and source code needed for this lab exercise. Unzip the file into a local folder. 2. Connect ultrasonic sensor to the micro-controller according to the schematic diagram. 3. Compile, upload and run the Ping_4Pin.ino program (available in zip file). This program is used to test the distance sensor. 4. Observe distance measurements in serial monitor window and verify that the sensor can measure distance in the range of 2 - 22 inches. Record (screen-shot) the minimum and maximum distance measurements and include in the Measurements section of the report. Part 2: 5. Modify the Ping_4Pin program to control the brightness of Red LED (0% to 100% duty cycle) connected to PWM output pin 9 by using the distance measurement in the range 2 to 22 inches. 6. Hint: In the modified program you will need to implement the following: ◉ ■ constrain function to limit the sensor input measurement between 2 and 22 inches. map function with appropriate input and output range of values to map sensor input range (2 to 22 inches) to analogWrite range (0 to 255) to control LED brightness from 0 to 100% duty cycle. 7. Display the graphs of distance measurements and LED brightness values in the Tools > Serial Plotter window in Arduino IDE. Include Serial Plotter screen shot in the report. Computer Controlled System Design I Part 3: (Car Parking Assistance Device) - 8. Modify the Ping_4Pin program to control three colored LEDs as follows: When distance measurement range is 2 – 8 inches, Red LED is ON When distance measurement range is 9 – 15 inches, Yellow (or Blue) LED is ON When distance measurement range is 16 – 22 inches, Green LED is ON Schematic Diagram: HC-04 +5V Vcc +5V I R3 330 Blue 11 ww R2 330 10 Green w RGB LED R1 330 (Common Cathode) Red w TX/1 RX/0 USB to PC 目 TRIG A0 Arduino A1 ECHO GND Lab circuit can be built by using three individual Red, Yellow and Green LEDs or by using a single common cathode (Red Green Blue) RGB LED, as shown in the schematic diagram. If using an RGB LED, Yellow color can be created by combining different brightness levels of Red and Green and keeping Blue LED off. Write a report with the help of lab report template available in Blackboard. Include following additional information in the Discussion and Conclusion sections of the report. In the Discussion > Input sub-system section of the report: • Describe the theory of operation of the ultrasonic distance sensor. Describe the basic specifications of the sensor such as operating voltage, operating current, operating frequency, min and max possible range of distance measurement, and the width of the area (in degrees) in front of the sensor in which an object's distance can be measured. In the Conclusion section of the report: Do online research to find and describe one practical and/or commercial use of the ultrasonic sensor when it is used in a device, product or measuring instrument.