Microchip Technology

user Occupation hasn't been added


  • Ultrasonic Range Meter Using 8-bit Microcontroller

  • Created: May 27, 2016

    • view537
    • comment0
    • bookmark0
    • fork0


No description available.


The ultrasonic sensor technology is one of the various methods to measure distances. It uses an 8-bit microcontroller with 24/40 Kbyte of on-chip flash EEPROM program memory that is partitioned into 2 independent program memory blocks. This ultrasonic range meter measures the distance up to 2.5 meters at accuracy of 1 cm using pulse echo method. The ultrasonic sensor transmits a signal to the object, then receives echo signal from the object and produces an output signal. Its time period is proportional to the distance of the object that is similar to radar. This device calculates the distance of the object based on the speed of the sound wave at normal temperature and displays the distance on LCD.

The major components in this project are 8051 microcontroller, 16x2 LCD display and ultrasonic sensor. The ultrasonic sensor’s TRIG and ECHO pins are connected to the P3.5 and P3.2 respectively. The LCD data pins are connected to the PORT2 of the controller and controller pins RS, RW, En are connected to the P1.0, P1.1 and P1.2 respectively. The variable resistor R2 is used to vary the contrast of the LCD while power supply pins of controller and ultrasonic sensor are connected to the 5V DC. When HIGH pulse of 10us is applied to the TRIG pin, the ultrasonic module transmits 8 consecutive pulses of 40 KHz. After transmitting the 8th pulse at the echo pin of the sensor, the state becomes HIGH. However, when the module receives reflected signal from the object, the echo pin becomes LOW. The time taken by the signal to leave and return to the sensor is used to determine the range of the object.

The ultrasonic sensor is designed to measure the range of the object in the embedded projects. This device is generally integrated to terrain monitoring robots, obstacle avoidance mobile robot or used as an automotive parking sensors and obstacle warning systems where it offers excellent range detection with high accuracy and stable readings.