-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proximity - HC-SR04 issue #896
Comments
I've had this issue before. If it helps at all I did not experience this with the more expensive "Parallax Ping Ultrasonic Range Sensor 28015", I ordered the "WYPH Ultrasonic Module HC-SR04" and had the issue that is mentioned above... I've got a whole mess of these things I'd like to use so I'm quite interested if there is any resolution to this as well! |
Did you load the correct firmware onto the board? These sensor require the custom PingFirmata provided in the docs |
In my case; I tried re-uploading that firmata several times. I switched back and forth between the two models of ping sensors as well. I haven't had it on the test bench in a few weeks but I can fire it back up and try is again this weekend. |
I have several models of this same sensor, which were used to test and confirm support and all of them work correctly. @carloscarcamo @topkoa can you both post pictures of your actual hardware? Thanks! |
I sure will. I won't have an opportunity until tomorrow afternoon though. |
Thanks! Be sure to @-ping me when you post :) |
@rwaldron yes, I've loaded the PingFirmata. http://www.icstation.com/arduino-ultrasonic-module-sr04-distance-transducer-sensor-p-1389.html Maybe the quality of the sensor is what cause the warning, maybe I need to buy a better sensor. |
I think I have the same model (looks identical, same pins). I did buy that model for a couple reasons:
I had the same feeling as you.. Maybe too cheap to be true? I guess we will see though. I have a feeling Rick will know what's up. :) |
Have you both included a jumper that connects the Echo and Trigger pins? |
I'll have to check my test rig; however I believe it was indeed jumped. |
yes! I did it!, as this diagram suggests: |
Nice! -- I'll still give it a check on my bench too when I get home tomorrow. |
Welp; I got home early. Just tried it and am getting the same problem... I have it wired exactly as the diagram indicates and with the correct PingFirmata installed. I have both ping sensors hooked up as well; (both the Parallax and the Generic). When I run the program, the generic ping sensor works for a few seconds then I get the same error as above. When I change the pin to use the Parallax ping it works flawlessly. Let me know if there is anything I can try. |
Another update: I swapped out the Generic ping sensor with another with the same results. Ruling out a faulty sensor. (I got a pack of 10 of them).. I only have one of the Parallax ping sensors, but that one seems to work just fine as stated above. |
Thanks for the follow up. Historically, the error you're seeing has been the result of insufficient power flow to the connected component. Let's try to reduce this as much as possible.
If this doesn't correct the problem, then please take another picture of the complete circuit, which should show:
|
Also, this is an interesting read: https://forum.sparkfun.com/viewtopic.php?f=42&t=40513 |
Ok. I will try later and post my results. And the C code: https://gist.github.com/carloscarcamo/2d2bf6a22ef8c7f081a1 |
@carloscarcamo can you try exactly as I describe here #896 (comment) Thanks! |
Sure, I will do it when I get home in a couple of hours :) |
So I did what you said, wired exactly as you indicated. I also used a multimeter and the voltage us a steady 4.92. I'll post some pics soon for you to verify. From reading that thread it looks like they are just garbage. Hah. Maybe put a warning in the wiki? Want me to mail you one so you can see for yourself? |
Probably a good idea.
I have soooo many of these—but all of mine work correctly. Where are you located? |
Coventry, Rhode Island |
Oh, that's not bad. Send me an email to waldron.rick@gmail.com and we can arrange this |
Duuuuude, is there anything between the bottom of your arduino and that metal table?? |
@rwaldron it seems like a metal table but it is not, it's hard to explain jajaja! |
@topkoa I received the two devices today and just set up some tests, compared them with several of my own and I'll be damned if I can't figure out what's going on with these. I can modify the read handler loop so that it only requests another measurement after the last measurement has been received. There are other controllers that do this, so it's not an issue. This will guarantee that it's impossible for another event handler to be added before the last one has cleared—this will fix the error that we're all now seeing. |
Just to make sure it's documented: this fix is working around faulty hardware that's not implementing the trigger/echo timeout correctly. |
Awesome; glad I could help! |
Just confirming the fix worked! I'm no longer getting that error on your latest code. A side note, these defective sensors are still effectively not good for a production application in my opinion-- with it running on my bench it occasionally just stops reading distance (returns 0) and sits idle for a good 30 seconds then seems to reset. I presume this is the condition where it caused J5 to crash before the fix. |
Yep, thats what I'm referring here:
Basically, we're just being more graceful about how the flaw is handled. |
@rwaldron thanks for taking some time and fix the problem :) |
No problem! |
I'm getting this warning:
I don't know if i'm doing something wrong, i'm using this simple code:
Is this normal or there is any problem?
Thanks in advance!
The text was updated successfully, but these errors were encountered: