Connect with us

Distance measurement using HC-SR04

Discussion in 'Microcontrollers, Programming and IoT' started by niranjan23, Apr 9, 2014.

Scroll to continue with content
  1. niranjan23


    Apr 9, 2014

    I maked interfacing program for HC-SR04 ultrasonic seonsor with AT89S52....
    but there is problem...with accurate distance.....I am not getting accurate distance in (cm)....
    I attached program code below with some my project images....can you tell me what is the problem in my code...

    Attached Files:

  2. Anish


    Feb 5, 2011
    Where is the code and what microcontroller are you using?
  3. gorgon


    Jun 6, 2011
    If your picture is correct, it looks like you are overwriting the result with 0.0 continuously, making a blur.
  4. morphingstar


    Mar 1, 2012
    When you calibrate distance you must use the difference method. Take the nearest point about 1 m away from the transducer and the farthest point the max. distance you want to measure + 20%. Then calibrate your system in a way that the 2 values shown on your indicator agree with the actual values of your reflector distances. This info is based on 40 khz, if yours is higher you may need to reduce the 1 meter distance. If it is too low you are introducing errors. I recommend >=15% of datasheet range for minimum.
    Further you need to compensate for air temperature, the change is significant if you want accuracy. Consult air physics data for amount / range.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day