Challenge

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

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

Aim : To Measuring distance of an object using ultrasonic sensor (HC-SR04) and display the distance on LCD display.

Overview of the Project:

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

Program Code :

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

Working of HC-SR04 :

1.Controller has to trigger the sensor to start transmitting the ultrasonic waves

  • Ultrasonic Module HC-SR04 works on the principle of SONAR and RADAR system.
  • HC-SR-04 module has an ultrasonic transmitter, receiver, and control circuit on a single board.
  • The module has only 4 pins, Vcc, Gnd, Trig, and Echo.
  • When a pulse of 10µsec or more is given to the Trig pin, 8 pulses of 40 kHz are generated. After this, the Echo pin is made high by the control circuit in the module.
  • The echo pin remains high till it gets an echo signal of the transmitted pulses back.
  • The time for which the echo pin remains high, i.e. the width of the Echo pin gives the time taken for generated ultrasonic sound to travel towards the object and return.
  • Using this time and the speed of sound in air, we can find the distance of the object using a simple formula for distance using speed and time.

Components :

1.ATmega32 IC

2.HD44780(2*16 LCD Display)

3.Ultrasonic Sensor(HC-SR04)

4.Oscilloscope

Connection :

1.Atmega 32 IC pins D0 to D7 Connected to LCD display.

2.Atmega32 IC Pins Port C C2 Connected to LCD display EN pin,C3 connected to LCD display RW(read/Write) pin and C4 connected to RS pin

3.Atmega 32 port b B0 connected to ultrasonic ECho pin ThroughOscilloscope ,Port A A0 pin connected to Ultrasonic Trigger pin Through Oscilloscope.

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

OUTPUT :

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

Result : The Object of the Distance measured through ultrasonic sonic sensor wave travelled by the object and hardware connection of Atmega32 and HC-SR04 And used the Timer1 capture mode.

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.