[SOLVED] Ultrasonic ranger sensor showing the same value

Hi all,

I have had my Ultrasonic working fine, but then it stopped working. Now it only shows the same value 680. I have tried different digital ports and restarted everything, but still nothing worked.

Any idea? Is that possible that the sensor got broken? I handle them very carefully always.

Regards,

Hey Mmansur, have you tried returning to the original code for the sensor?

Does this give you the same value?

Thanks John for replying. Strangely it is now working again. I donā€™t recall anything that I have done besides plugging everything out and in again and reboot it.

Hello,

I got a new GoPiGo2 starter kit a few days and Iā€™m having the same problem that was originally reported by mmansur: The ultrasonic sensor was working in a the basic example, then I tried it a little later after a reboot and it stopped working. When I test with basic_test_all.py and the ā€˜uā€™ command, values near 684 (+/- 1) are always returned, no matter how far away the obstacle is.

Since mmansur said the problem went away when reconnecting, I powered off, unplugged the senorā€™s cable on both ends, waited a minute, plugged it back in, and tried again, but the behavior didnā€™t change.

Any ideas?

Thanks,
ā€“mark

Hey @mark1,
Did you try the ultrasonic example that John has mentioned above. Can you try it out and paste the output that you get when you run it.

karan, thanks for your reply. I just tried running that test and it repeatedly prints Error.

Iā€™m surprised that a GrovePi program would work with the GoPiGo. Note that on the GoPiGo the ultrasonic is connected to port A1, but this program mentions D4. Iā€™m just starting, so Iā€™m probably confused.

ā€“mark

Hey @mark1,
Looks like we sent you the link for the GrovePi example by mistake, can you try out this example https://github.com/DexterInd/GoPiGo/blob/master/Software/Python/sensor_examples/grove_distance_sensor.py and see if it works for you.

Thanks Karan. I tried that and it repeatedly prints 0. Does that tell you anything?

In case this gives you a hint, I should also mention that even before it stopped working, it was working a little strangely. After first connecting it I tried the obstacle-avoiding example, and although it did stop before hitting an obstacle, it stopped at greatly varying distances from the obstacle ā€“ from 1 in to 2 ft. I only ran this program a few times, then shut the GoPiGo off, then later tried it again and thatā€™s when it stopped working completely.

Hey @mark1: Can you follow this tutorial to generate a log for the GoPiGo and upload the log here. Can you also upload a screenshot of your setup and a closeup of your connections.

@karan,
Sorry this taken so long, Iā€™ve been swamped with work. Log and photos are attached.
ā€“mark
log.txt (6.7 KB)



Hey @mark1 ,
It really looks like your the sensor is broken since everything else looks good. We have not seen a problem like this before. Thanks a lot for testing it out. Iā€™m really sorry for the frustration.

Can you contact us here, under ā€œGeneral Questions and Feedbackā€ and we will have a replacement shipped to you immediately.

Again, Iā€™m really sorry to hear about this; weā€™ll make it right immediately.

Do let us know how the new sensor works for you when you get it.
-Karan

Thanks for you help Karan. I filled out the form, and when I press Send it does itā€™s little animated dance, but then there is to ā€œmessage sentā€ confirmation ā€“ hope this is normal.

Oops, I guess the Send button was working, sorry for all the duplicate emails.

Karan, thank you for sending a replacement. However, it is not working either, so perhaps the problem is in the GoPiGo board?

When I test with grove_distance_sensor.py, it always prints 0 as before. When I test with basic_test_all.py and the ā€˜uā€™ command, it always prints 690 or 691.

@mark1,
That is kind of puzzling, we have not seen the GoPiGo and the ultrasonic sensor behave like that before. Can you try downgrading the firmware to version 1.5 by running the firmware update script here.

Make the script executable:

sudo chmod +x firmware_update_15.sh

then run it:

sudo ./firmware_update_15.sh

and try out the basic_test_all or this example with the correct pin number.

Hello,

I am currently dealing with the same problem here. Donā€™t know whether I should make another thread or just reuse this one. My setup is a Raspberry Pi with the GrovePi+.

Running the grove_ultrasonic.py script always returns values of 670. It is the version 2.0 of the ultrasonic sensor that I have but I believe from reading other posts that should not make a difference. Executing a flow in Node-RED reading the same ultrasonic sensor gives me the same value.

Anyone here who has an answer for this?

Kind Regards,

Bram

Hi @bpellens,

Itā€™s better for posting it here. It makes sense since itā€™s the same issue. Another topic would be redundant and no one likes duplicates.
Thank you for thinking about it.


Could you do the following:

  1. Confirm youā€™re using this script: https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_ultrasonic.py

  2. Show us a picture of your setup. We would like to see how itā€™s hooked up.

  3. Run the instructions found in this post at Step 3. Then attach the log.txt file here.


This is all for now.

Thank you!

Hello,

Thank you for the quick reply. After I, a day later, booted the Raspberry Pi in order to do the things you suggested, the sensor seemed to be working. This is really strange as nothing has changed to the setup. Could it be possible that there was interference from other devices? I donā€™t see any difference with the way I ran things yesterday.

Anyways, it seems to be okay now. In a little while I will try to test it in the real environment. Hopefully it is still functioning there.

Kind Regards and thank you very much,

Bram

1 Like

Hi @bpellens,

The readings should have fluctuated provided there were bad contacts, interferences, etc. At least, thatā€™s how Iā€™m thinking.
Itā€™s weird the values consistently stayed at 670.

Without more feedback, I canā€™t tell what was the reason for it to behave this way.

Please let us know how is going to work the following days.

Thank you!

1 Like