Ultrasonic range finder using ATMega8515

This project is used to measure the distance using ultrasonic sensors. The ultrasonic signal passes through the atmosphere to a barrier, which we want to measure the distance. Part of this signal is reflected and travels back to the receiver. The time delay between sending and receiving signals are then determined by distance barriers.

The device was designed as a parking assistant for the car. It will help the driver while reversing the car to measure the amount of free space behind the vehicle. It is possible to download for this device are two types of software on the MCU. The first version is intended for parking assistant. After activating the measurement device measures the distance still to shutdown and it shows on the LCD. The second version is designed for manual distance measurement. After activating the device measures the distance and show it on LCD. For further measurements you need to activate it again with the switch.

Ultrasonic range finder


40Khz ultrasonic sensors are used. Microcontroller that controls the distance measurement is the Atmel AVR Mega8515. Measured distance is displayed on the display 2×16 characters. The device has two buttons. S2 button activates or deactivates a measurement button S1 is controlled backlight. The device also includes a connector for connecting the programmer SV1 via ISP.

When activated, the microcontroller will generate measurements using 8bit timer port B0 frequency 40kHz, which passes through inverters for amplifying the current and used to drive the ultrasonic transmitter that will broadcast the ultrasonic waves at 40khz. Simultaneously with the activation of the posting run 16bit timer that measures time by receiving the reflected signal. Sending a signal spread environment. After hitting the barrier is part of it is reflected and returns back to the sensor. The reflected signal is detected by the receiver, amplified in amplifier. Received signal is brought to an internal analog comparator of the microcontroller, in which income is due to rollover. At this point, the transmission is stopped, but mainly stops counting the time reception of reflected signals. 16bit timer is set so that the counting pulses 1?s. Measurement is treated in a way where there is no reception, there is a 16-bit counter overflows (after 65ms) and sending a timing stops. The display shows the inscription “out of reach”. Further measurements are re-activated by pressing button S2. When receiving the reflected signal and the subsequent completion of counting time is 1?s counted the number of samples stored in the variable register, and timer is reset. Variable that contains the number of time samples must be multiplied with a constant length in order to display the measured distance.

For more details: Ultrasonic range finder using ATMega8515

About The Author

Ibrar Ayyub

Ibrar Ayyub is an experienced technical writer with a Master's degree in computer science from BZU Multan University. He has written for various industries, mainly home automation, and engineering. He has a clear and simple writing style and is skilled in using infographics and diagrams. He is a great researcher and is able to present information in a well-organized and logical manner.

Scroll to Top