Search for question
Question

ELEC 310 HW5 1. We want to implement a proximity sensor using an infrared transmitter and receiver (shown in the figure below). The infrared light is transmitted and then reflected off a nearby object and causes an electrical current to flow in the receiver, leading to a voltage proportional to the intensity of the light. We want to write a C program that uses ADC to measure the voltage on the infrared receiver to estimate the distance of the obstacle. Assume ADC_Init() function is provided. Also, consider that 10-inch distance will generate half a volt at the receiver. a. Write down the main() function which includes: i. Call for ADC_Init() function. ii. Infinite while loop iii. Required instructions to manually read the ADC. iv. Voltage calculation based on the value the ADC reads. v. Distance calculation.. b. How can you use this implementation in public safety? (Hint: Autonomous Driving) c. Add a few lines of code in main.c in order to set the variable brake to one when the distance is less than a threshold. Explain how this threshold/constraint affects public safety. d. Is always braking the best solution if an object is close to a car? What is wrong with that? e. What are the other options instead of breaking if the proximity sensor detects an object around a vehicle? How can you modify your design to accommodate public safety? IR Led IR Receiver Reflected rays from the object Object or Body