Challenge

Project 2 - Measuring distance of an object using ultrasonic sensor (HC-SR04)

Preeti madam's Embedded system live batch 12

Overview of the Project:

In this project, the implementation of code for “Measuring distance of an object using ultrasonic distance sensor (HC-SR04)

Goals:

  • Measuring the distance of an object using Ultrasonic Distance Sensor (HC-SR04)
  • Usage of Input Capture Mode

Key Highlights of the Project:

  • Measuring the distance travelled by the wave to the object and gets bounced back from the object to sensor.
  • Measuring Pulse width using Input Capture Mode

Deliverables of this project:

  • The distance travelled by a wave to the object for which we want to measure the distance using Ultrasonic Distance Sensor (HC-SR04).
  • Measuring Pulse width using Input Capture Mode of Timer 1

Expected Outcomes:

The students will get the Knowledge on Ultrasonic sensor (HC-SR04) to measure the distance travelled by wave to the object, the hardware connection of Atmega328p and HC-SR04 and how to use input capture mode of Timer1

Screenshot of Simulation:

  • LCD screen is connected to portd of microcontroller atmega328 and rs,en pin connected with PB6,PB7 respectively.
  • Ultrasonic sensor trig pin, echo pin connected to PB1, PB0 respectively.
  • We can observe the signals at trig pin and echo pin in the analyzer.
  • Trig pin generates the waves and PB0(input capture flag) captures the difference in raising edge anf falling edge from echo pin using timer1 function in normal mode.
  • Counted signal converted to cm and shared to LCD screen and displayed.

Attached the code with comments, HEX and Simul files

Hence implemented the project as per the given instructions.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.