My ultrasonic range finder is giving bad measurements and I'm trying to figure out if the problem is electrical, or physical (sound transmission though the PCB), and how to fix it. Suggestions are welcome!
Data sheet: https://cdn.sparkfun.com/datasheets/Sensors/Proximity/HCSR04.pdf
A 10us pulse on the trigger pin initiates a sound burst. A short time later the echo pin goes high for a duration that is proportional to the distance the sound had to travel. This sequence repeats at about 16Hz. The problem I'm having is that the sensor is acting as if there is an object directly in front of it (very short echo pulse), UNLESS I do ONE of the following:
When it's not working, the echo reads as if there is something directly in front of it, even when there is nothing in front of it. Here's a scope picture. The short blue pulse is the trigger, the yellow is the echo indicating the object is a couple of inches away, even though the object is much much further:
This is what I do to make it work:
And this is what it looks like on the scope when it's accurately measuring distance, notice the longer echo:
Here's how it does not work, unless I do one of the things listed above:
Any thoughts?
Data sheet: https://cdn.sparkfun.com/datasheets/Sensors/Proximity/HCSR04.pdf
A 10us pulse on the trigger pin initiates a sound burst. A short time later the echo pin goes high for a duration that is proportional to the distance the sound had to travel. This sequence repeats at about 16Hz. The problem I'm having is that the sensor is acting as if there is an object directly in front of it (very short echo pulse), UNLESS I do ONE of the following:
- Place a finger firmly on top of the PCB
- Lower the input voltage (Vcc) down to about 3.4V (specification is 5v)
- Continually wiggle it around in the breadboard until I get it in just the right position.
When it's not working, the echo reads as if there is something directly in front of it, even when there is nothing in front of it. Here's a scope picture. The short blue pulse is the trigger, the yellow is the echo indicating the object is a couple of inches away, even though the object is much much further:
This is what I do to make it work:
And this is what it looks like on the scope when it's accurately measuring distance, notice the longer echo:
Here's how it does not work, unless I do one of the things listed above:
Any thoughts?
Last edited: