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.
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.
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 ,
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.
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:
and try out the basic_test_all or this example with the correct pin number.
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.
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.