Go Down

Topic: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 (Read 128 times) previous topic - next topic

Human


Find the attached "NewPingTestA.zip" library and replace the existing NewPing.* files in your libraries/NewPing folder.  The only thing that Test A does is replace the echo measuring with the default pulseIn command.  Because you stated you can hear the sensor firing, we're going to first assume that the trigger is happening correctly and the problem is with measuring the echo.  This first test should isolate the problem where we can then focus in on one area.

Let me know what happens.

I still hear a bunch of ticks, and I mostly get "0 uS" output over and over again. Now and then, nonzero values appear:

Code: [Select]

7494 uS
...
41944 uS
...
8251 uS
...
26104 uS


I haven't found a pattern yet that can make it produce nonzero output.

Human


Thank you @teckel after ignoring the 0 values, it's working perfectly!


This may not be sufficient. I've seen valid, in-range values (nonzero) reported by the HC-SR04 when nothing was in range. You could get false positives if all you do is ignore 0cm distances.

teckel



Find the attached "NewPingTestA.zip" library and replace the existing NewPing.* files in your libraries/NewPing folder.  The only thing that Test A does is replace the echo measuring with the default pulseIn command.  Because you stated you can hear the sensor firing, we're going to first assume that the trigger is happening correctly and the problem is with measuring the echo.  This first test should isolate the problem where we can then focus in on one area.

Let me know what happens.

I still hear a bunch of ticks, and I mostly get "0 uS" output over and over again. Now and then, nonzero values appear:

Code: [Select]

7494 uS
...
41944 uS
...
8251 uS
...
26104 uS


I haven't found a pattern yet that can make it produce nonzero output.


Interesting...  Find the attached TestB - TestE libraries and test with the same sketch.  Each of these make slight changes and all work with the Uno.  Let me know if you start getting correct results (objects several inches from the sensor should give results in the hundreds).  It's still possible that none of these work for you, and if so that REALLY limits what the issue is, and I have a TestF library already ready to go.

Tim
Arduino - Teensy - Raspberry Pi
My libraries: NewPing - LCDBitmap - toneAC - NewTone - TimerFreeTone

Human


Interesting...  Find the attached TestB - TestE libraries and test with the same sketch.  Each of these make slight changes and all work with the Uno.  Let me know if you start getting correct results (objects several inches from the sensor should give results in the hundreds).  It's still possible that none of these work for you, and if so that REALLY limits what the issue is, and I have a TestF library already ready to go.

A rebuild with each version (exit Arduino IDE; unzip a test version of NewPing inside ~/sketchbook/libraries/NewPing/; run IDE; load test sketch; upload to Duemilanove; open serial monitor) still outputs 0 uS, regardless of whether or not something is close to the sensor.  I can run each version for more time to see if I get any nonzero times, but I thought I'd report these results sooner rather than later.

I'm pretty sure my steps will explicitly re-build the NewPing library each time, but maybe I need to touch the sources, too.

teckel



Interesting...  Find the attached TestB - TestE libraries and test with the same sketch.  Each of these make slight changes and all work with the Uno.  Let me know if you start getting correct results (objects several inches from the sensor should give results in the hundreds).  It's still possible that none of these work for you, and if so that REALLY limits what the issue is, and I have a TestF library already ready to go.

A rebuild with each version (exit Arduino IDE; unzip a test version of NewPing inside ~/sketchbook/libraries/NewPing/; run IDE; load test sketch; upload to Duemilanove; open serial monitor) still outputs 0 uS, regardless of whether or not something is close to the sensor.  I can run each version for more time to see if I get any nonzero times, but I thought I'd report these results sooner rather than later.

I'm pretty sure my steps will explicitly re-build the NewPing library each time, but maybe I need to touch the sources, too.


You should see the compiled size change slightly with each test library.  That's a good indicator that it's using a different library.

See the attached TestF library also.

Tim
Arduino - Teensy - Raspberry Pi
My libraries: NewPing - LCDBitmap - toneAC - NewTone - TimerFreeTone

Go Up