Ultrasonic Ranger Returning Inconsistent Values


#1

Hello,
I have recently set up a GrovePi configuration using the Windows Iot Core with a Raspberry Pi 3, I am currently just running your sample C# code and it works fine. However, the Ultrasonic sensor will occasionally return a value that does not match the others, even though I have not touched the sensor and nothing has moved. For example, this is the output from my Visual Studio 2015 Console.
Ultrasonic reads 185
Ultrasonic reads 185
Ultrasonic reads 185
Ultrasonic reads 185
Ultrasonic reads 185
Ultrasonic reads 184
Ultrasonic reads 185
Ultrasonic reads 185
Ultrasonic reads 185
Ultrasonic reads 40
Ultrasonic reads 177
Ultrasonic reads 178
Ultrasonic reads 185


#2

We have not seen a lot of false positive values being reported from the ultrasonic sensor. Would it be possible for you to install Raspbian for Robots (http://www.dexterindustries.com/howto/install-raspbian-for-robots-image-on-an-sd-card/) and try the example in python to check if it’s a problem with the sensor https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_ultrasonic.py.

-Karan


#3

When I run the python script using the Raspbian for Robots image it works fine, I don’t know whats going on now.


#4

I have reloaded my IOT Image but now when I run the sample Ultrasonic program, it still returns weird values.
Ultrasonic reads 185
Ultrasonic reads 185
Ultrasonic reads 184
Ultrasonic reads 184
Ultrasonic reads 185
Ultrasonic reads -1
Ultrasonic reads 185
Ultrasonic reads 185
The thread 0x5b0 has exited with code 0 (0x0).
Ultrasonic reads 185
Ultrasonic reads 184
Ultrasonic reads 183
Ultrasonic reads 137
Ultrasonic reads 184
Ultrasonic reads 185


#5

I tried switching ports and got these results, still not working.
Ultrasonic reads 58
Ultrasonic reads 59
Ultrasonic reads 58
Ultrasonic reads 58
Ultrasonic reads 115
Ultrasonic reads 59
Ultrasonic reads 58
Ultrasonic reads 59
Ultrasonic reads 59
Ultrasonic reads 59
Ultrasonic reads 61
Ultrasonic reads 0
Ultrasonic reads 0
Ultrasonic reads 0
Ultrasonic reads 0
Ultrasonic reads 0
The thread 0xbe0 has exited with code 0 (0x0).
Ultrasonic reads 61
Ultrasonic reads 61
Ultrasonic reads 61
Ultrasonic reads 61
Ultrasonic reads 61
Ultrasonic reads 61
Ultrasonic reads 0
Ultrasonic reads 0


#6

Hey Cofish, last we checked (about 1 month ago) winiot was still running a beta on the Pi 3. It has been a little late to delivery. I’m not sure what the current status of their image is; is it still in beta? When I tried to run C# examples on their beta I had some troubles and reported them to the WinIoT team.


#7

It has been runnning on a Windows Insider Preview(Beta), but I recently switched, this week, over to what I believe to be an official image(its accessible for download via the IOT Device Hub).


#8

Hi,

I have the same kind of thing, one measure on two returns 0.

The good measure (in centimeters) is stored in the readBuffer[0].
I don’t have to do the calculation readBuffer[1] * 256 + readBuffer[2].

Ex:
readBuffer[0] | readBuffer[1] | readBuffer[2]

40 | 255 | 255
0 | 255 | 255
41 | 255 | 255
0 | 255 | 255
39 | 255 | 255
0 | 255 | 255
41 | 255 | 255
0 | 255 | 255
39 | 255 | 255
0 | 255 | 255
41 | 255 | 255
0 | 255 | 255
41 | 255 | 255

Regards,

MisterG


#9

@MisterG: Do you have a spare SD card where you can burn raspbian for robots and see if the python program works any better for you.


#10

Also, wanted to check @MisterG: this thread is discussing using WinIoT Core, is that what you’re using here?


#11

Hi,
@karan : it’s working correctly with my new GrovePi card
@JohnC : yes it’s WinIoT on a Raspberry Pi 3
I’ll still have to find out why it’s not working with the GoPiGo, but I’m happy while it’s working with the GrovePi
Thanks for your answer.