Interfacing Ultrasonic Rangefinder with AVR

In this tutorial, we are going to interface ultrasonic rangefinder with the all popular ATMEGA8. Ultrasonic rangefinder is used to find range of an obstacle or a wall from the sensor. However, when there are cheap methods available to find range like the IR sensor or even a combination of LED’s and LDR would do but the question is why we use a more costly sensor. The reason is:-

  • IR sensors are not accurate
  • Result varies from object to object
  • Calibration is required
  • Works good only for shot range

Normally the IR sensors have a range from 30-80 cm or even less depending upon the manufacturer and also the LED’s used. However for an ultrasonic rangefinder, the distance can be measured accurately up to 400cm with an accuracy of 1cm.

HC-SR04 sensor

Ultrasonic rangefinders find application to measure level of a liquid, object sensing. Also, the great thing with this sensor is they required no calibration; no conversion from analog to digital data and the code are is not limited to any particular manufacturer sensor. The code will work pretty much with almost all sensors available in the market. Continue reading