CECS347 Project 1 - An Ultrasonic Ranger Finder-3

pdf

School

California State University, Long Beach *

*We aren’t endorsed by this school

Course

347

Subject

Electrical Engineering

Date

Feb 20, 2024

Type

pdf

Pages

2

Uploaded by DeaconRoseAnt106

Report
1 CECS 347 Project 1 An Ultrasonic Ranger Finder Total: 25 points+6 bonus points Preparation: You will need a LaunchPad, an HC-SR04 Ultrasonic sensor, a ruler to measure distance in centimeters, and three resistors (one 1kΩ and one 2kΩ or three 1kΩ ) for building a voltage divider. New Topics Covered: PLL, General Purpose Timer, Ultrasonic Sensor, Software PWM. Reference Projects: GPTM_Timer0A, UltrasonicSensor, SysTickPWM, TimerPWM Purpose: The purpose of this project is to review the following topics learned: GPIO, SysTick timer, Edge interrupt and to learn and practice the following new topics: PLL: Phase Lock Loop, learn how to generate a system clock using PLL. GPTM: General purpose timers, learn how to generate periodic timing with one general purpose timer. Ultrasonic sensor: Learn how to interface HC-SR04 ultrasonic sensor to detect obstacle range. Software PWM: How to generate a PWM signal using a hardware timer and use it to control the brightness of an LED. System Requirements: Design a system with an HC-SR04 ultrasonic sensor that provides information on the range of the closest obstacle in front of the system. 1. PLL is required to generate a 16MHz system clock. 2. The onboard RGB LEDs are used to provide range information. 3. When there is no obstacle within 70cm in front of the system. All LEDs will be off. 4. When there is an obstacle in the range of 10cm to 70cm in front of the system, white light will be turned on. The brightness of the white light will be used to indicate the range of the obstacle based on the following table. Distance (cm) PWM Duty Cycle 10 - 19 90% 20 - 29 80% 30 - 39 70% 40 - 49 60% 50 - 59 50% 60 - 69 40% 5. When obstacle is within 10cm in front of the system, blink the red LED at a frequency of 2Hz: 0.25s on/0.25s off.
2 Hardware Design Requirements: 1. Use General Purpose Timer1 in 16-bit count down mode to generate trigger pulses and to measure ultrasonic echo high period. 2. Use SysTick timer with interrupt enabled to generate a PWM signal and use this PWM signal to control the brightness of the white light and the blinking of the red LED. 3. Edge interrupt is required to capture the rising edge and the falling edge of the echo pin. 4. Use the following pins to interface with the HC-SR04 Ultrasonic sensor: PB5 connects to the trigger pin, PB4 connects to the echo pin. Development Steps: 1. (5 points) Project1P1: Build an embedded system with PLL to generate a 16MHz system clock. Use SysTick timer to generate a 2Hz square wave and output to the onboard red LED. Simulate on simulator and screen shot the logic analyzer’s output with the grid set to be 0.25s. 2. (10 points) Project1P2: Keep a 16MHz system clock, add an ultrasonic sensor to the system and use General Purpose Timer1 in 16-bit count down mode generate trigger pulses and to measure ultrasonic echo high period. Edge interrupt is required to capture the rising edge and the falling edge of the echo pin. Demonstrate the distance detected using on board debug for the following three distances: distance>70cm, 10cm < distance < 70cm, and distance < 10cm. 3. (5 points) Project1P3: Add timer-based PWM to the system to implement the light control: use SysTick timer to generate PWM signals control the brightness of the white light and the blinking of the red LED. Extra Challenges: 1. (3 points) For Project1P2: use General Purpose Timer1 “Input Edge Time” mode to measure echo high period width. 2. (3 points) For Project1P3: use General Purpose Timer2 PWM mode to control the brightness of the white light and the blinking of the red LED. Deliverable: 1) Demonstrate your lab and submit source code for each of the three parts separately, one zip file per part: Project1P1.zip, Project1P2.zip and Project1P3.zip. For the two extra challenges, please submit: Project1P2Ex.zip and Project1P3Ex.zip. (20+6 points) 2) Submit a project report. Demonstration video or video link in "Operation" section of the report. (5 points)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help