Go Down

Topic: Issues with HC-SR04 Ping sensor (Read 361 times) previous topic - next topic

MDD123

Whenever I get readings from my sensor, it'll take accurate measurements as long as nothing is moving.  The moment I move anything, reading spikes to well over 100,000 (I'm measuring pulseout) and prints to the serial monitor at a much slower rate than the other readings.  Has anyone else heard of or had this problem before?


Ufoguy

Try the New Ping library. code.google.com/p/arduino-new-ping/ .

It's more efficient and may solve your problem. It works perfectly on my HC-SR04.
If you want to meet a beautiful nurse you must be patient.

MDD123

Just got that running, now I have the opposite problem.  The readings run smoothly, but even the smallest amount of movement will cause a zero reading. 

Could this be an issue with the ping itself?  It was shipped in the same container as a larger, heavier item and had a few bent pins when I got it.

Ufoguy

#3
Jul 09, 2013, 04:41 am Last Edit: Jul 09, 2013, 05:10 am by Ufoguy Reason: 1

Just got that running, now I have the opposite problem.  The readings run smoothly, but even the smallest amount of movement will cause a zero reading.  

Could this be an issue with the ping itself?  It was shipped in the same container as a larger, heavier item and had a few bent pins when I got it.


Are you moving an object in front of the sensor or moving the sensor itself? If you're moving the sensor itself then there may be a loose connection. Try plugging the sensor directly into the Arduino by changing the pins in the code. There is also a ground pin in the Arduino on the digital pin row. So the sensor fits very well. Don't forget to change the pins in the code. The sensor should be facing opposite to the atmega.

Here is the pin reference

GND - GND
ECHO - 13
TRIG. - 12
VCC -11

Be sure to set 11 to high.

It'd also be good if you posted the code.
If you want to meet a beautiful nurse you must be patient.

Go Up