UltrasonicRead Problem with Pi3


I recently got e raspberry pi3 and the GrovePi+ Starter Kit.

Now i got the following problem: i tried to run the grove_ultrasonic.py example (i changed the port because my ultrasonic Ranger V2.0 is on Port 8) but it shows me “random” numbers like:

There is nothin in front of the sensor.

My Software Setup is the following:
I prepaired my microSD as described here: https://www.raspberrypi.org/documentation/installation/installing-images/windows.md

I followed your instructions from here: https://www.dexterindustries.com/GrovePi/get-started-with-the-grovepi/setting-software/

After that done i get a TypeError

So i did the firmware update as you describe on your site.

And now i have the values as mentioned above

I have also tried out the raspbian for robots and i get the same output.

Hi @basketball4-ever,

Can you send us a few more details, can you send us a picture of your setup, the code that you are using and a screenshot of the output that your getting. Since you say you have this problem with Raspbian for Robots as well, can you follow this guide, generate a test log and post it on the forums.


hi @Shoban

here is my setup:

the code i am using is the one from your examples called grove_ultrasonic.py with the port 8 instead of 4 and as you can see on the output i renamed the file but put it back in the same directory.

and here is the output i got with the installed raspbian for robots and then running the code:
output.txt (740 Bytes)

i always got a lot 515 as output…

and here is the log:
log.txt (6.0 KB)

sorry i had to send the information in 3 posts because as a “new user” i can only add one attachment.

@basketball4-ever: The logs dont seem to have any problems. What are the other sensors that are connected to the GrovePi. Can you post another picture which shows the other sensors connected on the other ports too. Do you get the same problem if you only have 1 ultrasonic sensor connected.

i had 3 led connected on port D4 D5 D6
a lcd with rgb Backlight on the i2c port
a light sensor on port A2
a sound sensor on port A1
a rotary angle sensor on port A0
a temperature & humidity sensor on port D7
a buzzer on port D2
a button on port D3

with only the ultrasonic sensor connected the problem persists

Hi @basketball4-ever,

Can you post a video of the setup with ultrasonic sensor and the output that you see. When you take a video make sure, there aren’t any stationary obstacles before the ultrasonic sensor and also observe what happens to the readings when a obstacle is brought close to ultrasonic sensor. Can you also tell if the ultrasonic sensor alone is working good.


hi @Shoban

There is no change in the output of the sensor when i bring an object closer to it.
How can i test if the sensor alone is “working good”? I don’t have any special equipment…

Hi @basketball4-ever,

Can you post a video of how you are using the sensor and with the output that you see on the screen.Also can you tell us from where you bought your starter kit.


hi @Shoban

here is the video:
video.avi (2.7 MB)

here is the output:
output.txt (992 Bytes)

I bought the starter kit from here:


Hi @basketball4-ever,

Can you send us video of different format or through different means like youtube links, Its not getting downloaded for us.

Thanks a lot for your patience, we will to try to help you the best possible.


hi @Shoban

I will try later, sorry. The video isn’t really special, you could see the pi3 with the grovePi board and only the ultrasonic sensor attached and my hand moving closer and further from the sensor…


Hi @basketball4-ever,

Sorry for the delay in reply, as part of the last test can you have the Ultrasonic sensor alone connected to Port D4 of GrovePi and run this example. In this example add a line with time.sleep(1) after Line 46.

We are not sure if this is a sensor problem and the problem looks more like an issue with the connections, sensor pinout or interference with another sensor.


Hi @Shoban,
Unfortunately this doesn’t solve the problem.

I restartet today once again, took your newest raspbian for robots image, then got only an error as output. And after running pi3.sh it was the same error as described…


Can you give us a few more details from the last post.

took your newest raspbian for robots image, then got only an error as output

Can you send us a screenshot of the program you had tried and the error you got.

after running pi3.sh it was the same error as described

Can you send us a link to pi3.sh and what it does

hi @karan

i downloaded the 2017.02.17_Dexter_Industries_Jessie.zip and followed this instruction.

after that the grove_ultrasonic.py example (with the insert of the time.sleep(1) after Line 46 as Shoban suggested) gave me an output like:

Then i run the file /home/pi/di_update/Raspbian_For_Robots/pi3/Pi3.sh

And now i have output like this:

I also run the “DI Software Update” but the problem persists.

Hi @basketball4-ever,

It looks like you received a defective ultrasonic sensor. Thanks a lot for testing it out. I’m really sorry for the frustration. We apologize for the delay in getting this sorted for you.

We would like to replace the sensor but since you have made the purchase through www.pi-shop.ch, can you make a request for replacement to them. We would like to work it out through them.

Again, I’m really sorry to hear about this; we’ll make it right immediately, thanks a lot for your patience.



read thos topic and after you can use your ultrasonic sensor SRF04:


you can use also an ultrasonic I2C (SRF02 or SRF08 for example):


i use this 3 sensors now.