HY-SRF05 Ultra sonic sensor

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have tested a HY-SRF05 sensor with a PIC micro LCD counter that i build a few years back.

 

I pulse the trigger pin of the HY SRF05 hi for 10us and then low for 1000ms and repeat on off pulses ,as i move an object away from the sensor  the value of the counter increases but does not go higher than -+6000 counts (1 count is 1uS).

 

Now 6000/58 (ref from various web sites to calculate distance) i get 103cm.

 

That is the same value i get from my Atmega328p distance meter ,the sensor does not work on 3-4m as stated in the datasheet.

 

My question is -- Did anybody get the 3-4m distance from this sensor.(the sensor is not faulty same results on 3 sensors unless all 3 is faulty).

 

 

This topic has a solution.
Last Edited: Fri. Mar 16, 2018 - 05:13 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mikedb wrote:
6000 counts (1 count is 1us)

So 6000 counts at 1 count per us is 6ms - which should be the round-trip time.

 

Now 6000/58 (ref from various web sites to calculate distance)

Would be helpful if you gave a link for those refereces - so that we can see what they actually said in context.

 

Taking speed of sound as 340m/s, a 6ms round-trip is 6ms * 340m/s = 2040 mm

 

So the distance to the target is 1020 mm - or 1.02m

 

 

 

the sensor does not work on 3-4m as stated in the datasheet

So is that actually the sensor not working, or your code not working?

 

Have you looked at the "echo" pulse output from the sensor? is it varying correctly beyond 1m out to 3-4m?

 

If the round-trip for 1m is 6000 counts, then 3-4m is going to be 18000-24000 counts.

 

Is there anything in your software limiting the maximum count ... ?

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I used a 24 bit counter (PIC Micro) with a 7 digit display to VARIRFY my Atmel source code and i get the same MAX number of counts 6000 .

 

Do a search on Distance meter Atmega32 as one example of the distance calculation,some web sites claim max 4m and other says 4m round trip and the datasheet just say 4m.

 

The test i did with the PIC counter is independant  from my Atmega source code and both counters give the same result == 6000 max.

 

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Don't forget to update your other thread with the link to this one.

 

Have you looked at the "echo" pulse output from the sensor? is it varying correctly beyond 1m out to 3-4m?

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

 

I resolved the issue with the distance myself NOTHING to do with the source code as i stated i used a second counter to measure the length of the echo pulse in uS.

 

I re tested in a more open space and PERFECT reaches up to 4 meters away from the object ,so the 4 meters is NOT the round trip but the distance to the object.

 

In my shack there was always something -+1 meter on the side that bounced back a echo!

 

The beam is said to be 15 deg's and that was the problem,too many loose ''things'' all over in the shack.