Smoothing Ping Sensor Readings

I’m using my Arduino Uno with a Ping Sensor to take readings that will correlate with a code in Processing. (Processing.org) I have made the programs successfully read together so that as you approach the sensor the image in processing zooms in, and as you back up, the image zooms out.

My problem is that the sensor is jumpy and the zooming in/out is sporadic. I’ve been adjusting the number of readings taken along with the delay time and I have it hooked up to 5v. I’m slightly successful with 75 readings with delay(10), but I was hoping someone had found a way to take more consistent readings.

Also, is there any way to restrict the direction that the ping is reading from? I’m afraid it can read past my body and that’s why it’s jumpy so much.

Thanks!

Post a picture. Maybe the sensor has too much stuff surrounding it and they all reflect sound. What happens if you take the sensor and point it to the ceiling? Will it be stable?

All sorts of possibilities. I’d first do what liudr said then make sure the Vcc supply is stable and check for other sources of electrical noise. You might want to look at the actual readings to see if there is something obvious. Also, you should verify your code for determining the distance.

Also, if you are pointing at a person that is moving, you are probably reading the closest part of their body. So, swinging arms, moving feet/knees might cause the problems.

What is the fastest rate of readings on PING sensor ? maybe You could use faster rates