Ultrasonic range finder using ATMega8515 This project is used to measure the distance using ultrasonic sensors. The ultrasonic signal passes through

Tags

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.

Circuit Diagram

Ultrasonic range finder using ATMega8515

Operation

40Khz ultrasonic sensors are used. Microcontroller that controls the distance measurement is the Atmel AVR Mega8515. Measured distance is displayed on the display 2x16 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.

When multiplied by the number of variables and sample length of time brings up a constant distance to the obstacle in centimeters. The result is rounded to one decimal place. The circuit also uses an LED. It starts flashing at a distance of less than obstacles to 50cm.

Before the first (after production equipment) measurement it is needed to set the reference voltage for comparator. This is done by the variable resistance R5. We will link connector JP2. By the meter set adjustment mode. The transmitter will continue to broadcast. Reference voltage to set the size to analog comparator to the maximum measured distance. Flip LED signals. When sufficient income reflected signal to flip and LED lights up. If one sensor , the LED should extinguish. Open the JP2 connector and the sensor is ready for measurement. Resistance trimmer R2 is used to adjust the contrast of characters on the LCD.

The disadvantage of this simple rangefinder is the speed of ultrasonic sound varies in air due to temperature change.

The speed of sound in air at different temperatures

Temperature Speed
-20°C 319,3 m/s
0°C 331,6 m/s
5°C 334,5 m/s
10°C 337,5 m/s
15°C 340,6 m/s
20°C 343,8 m/s
25°C 346,3 m/s
40°C 355,3 m/s
60°C 366,5 m/s
80°C 377,5 m/s

The rangefinder has a length constant calculated for a temperature of 25°C. For more accurate measurements it sis necessary to add a thermometer. So before each measurement, first measure air temperature, and choose the appropriate length constant. The speed will also get changed with variable pressure. This change is not as great as in the case of temperature change.

Download

Hex files


EmoticonEmoticon

Advertisement