View Full Version : Ping Sensor Innaccuracies

Carl Lawhon
01-03-2009, 12:20 PM
For some reason the Ping sensor on my robot becomes very innaccurate and screwy whenever the motors are turned on and are running. The motors are relatively powerful and do vibrate the frame a good bit, so is it possible these vibrations are causing the problem?·The sensor·is always very accurate and consistent when the motors are not running.

(the robot uses a prop so thats why I put it in this forum)


Carl Lawhon

Mike Green
01-03-2009, 12:40 PM
It doesn't make sense that it would be mechanical noise from the motors.
It's much more likely that it's electrical noise from the motors getting into the lines from the Ping.
It would have to be either high amplitude mechanical vibration or ultrasonic vibrations to affect
the Ping the way you suggest. Maybe you need hefty electrical filtering on the motors.

Carl Lawhon
01-03-2009, 01:59 PM
Electrical noise seems like the most likely culprit now. Bear with me, I'm a bit of a newbie, but how would I go about putting in place this electrical filtering?

01-03-2009, 02:31 PM
Put some small ceramic capacitors across the motor windings, for starters. Also, add a couple ceramics as close to the pins of the PING as possible.

Carl Lawhon
01-04-2009, 09:55 AM
I did this but am still getting some "noise." Anybody have any other suggestions? What has worked for you guys in the past?

Ken Gracey
01-04-2009, 11:09 AM
Have you experimented with the Ping))) without the motors running? The "screwy behavior" may be the result of the Ping))) triggering off of nearby objects. If your robot is close to the flor (how close is it?) then Ping))) may be sounding from carpet or other side-field objects.

Ken Gracey

Carl Lawhon
01-04-2009, 11:47 AM
When the motors are not running the Ping is very accurate. There is no problem at all when they are not running. As for their height off the floor, they are about 1.5 feet off the ground. When I test I always point the ping at a flat object like a box. However, I have been struck by something that could be exacerbating any electrical interference there is: all my sensors are (stupidly, I know) mounted on an aluminum tower. This tower acts as something of an antenna that picks up any interference there is and carries it right up nice and close to the sensors. The sensors are about a foot away from the motors. However, the tower is, at its closest, only about an inch away from the motors. Problem? I think yes. I will replace the aluminum with plastic tomorrow and report back. If that doesn't work I was thinking about making some sort of Faraday Cage around the motors with aluminum or antistatic bags. (I have no idea if this actually will work, but in principle and at this late hour it sounds pretty good).

01-04-2009, 02:42 PM
I once had a stepper motor that squealed like a stuck pig on speed because of some oddball resonance condition, so I would not rule out mechanical noise right away. You might try dismounting the PING from the robot and test the PING while running the motors beside or behind it. If the motors are creating an ultrasonic squeal that the PING picks up via the air, then you'll have a greater chance of determining that with the PING separated from the robot. However, I suppose it's still possible that there's some kind of sonic mayhem taking place elsewhere in the frame of the robot, perhaps a bearing or other kind of friction playing havoc. If your efforts to reduce electrical interference don't work, consider various mechanical decoupling schemes - running only one motor, then the other, etc.

my two cents worth,

Carl Lawhon
01-04-2009, 11:03 PM
I will definitely try all those as well. Thanks Mark.

01-05-2009, 10:12 AM
Have you tried running the motors and the ping at the same time on different power supplies? That could rule out power supply noise. Also, what about your other sensors? Do they work?

01-06-2009, 01:16 AM
I am glad you brought this up, because I have been puzzling over inaccuracies in Ping sensors as well. I have a ping sensor mounted on a servo of a small walker and while it is often accurate, it sometimes is wildly off. You can see what I am working on at: http://www.youtube.com/watch?v=lI6ACgbyUj8 (http:// http://www.youtube.com/watch?v=lI6ACgbyUj8)

One problem I have notice is that the Ping sensor is that it isn't a very tight "beam". I have never found any information on the angle of the cone of sound coming out of a Ping. In general though you do not want to mount it so that it points parallel to a close wall or floor.

Is there anything special about using a Ping sensor with a prop that could cause it to be less accurate in some cases, either due to the controller timing or the prop I/O? I did not experience as much of a problem with a basic stamp. On the other hand, I never tried to sample as often or as fast with a Stamp.

Any experiences or advice in using a Ping with a Prop would be very helpful.

George Collins

Joćo Geada
01-06-2009, 04:40 AM
BTW, having experienced similar weird behavior from a PING! sensor, I eventually tracked a very large error to reflections coming from *behind* the sensor!
I solved that by putting 0.5" polystyrene foam directly behind the sensor and my readings become much more reliable.
My setup was a custom robot with a turret mounted PING controlled by a servo (much like the BOEBot PING mounting).
Since making that change I only get the occasional odd reading. And yes, decoupling capacitors were the first thing I looked at, but
as I had those everywhere and as motors and sensors were in different branches of the power supply system I was left scratching my
head until that "ah ha" moment.


01-06-2009, 04:59 AM
Just curious about the PING))) sensor's operation. Does it operate on a resonate frequency? The way military sonar works is a high amplitude signal which is a resonate frequency of the ceramic disks in the transmiter is passed into a stack of ceramic disks. The signal gets the disks vibrating which produces the high strength ping [though it's in audible frequencies, not ultrasonic like the PING)))]. I can't hear the PING))) sensor, obviously (though I don't think my dog likes it too much http://forums.parallax.com/images/smilies/lol.gif) so I can't tell if it's a pure frequency or just a bunch of noise. I would guess that it's pure since otherwise the receiver would trigger on false positives all over the place (there's a lot of high frequency squeal around - we just can't hear it). So, I imagine some kind of narrow band-pass filter, in which case the chances of it being stray noise is very slim as the noise would have to be at the resonate frequency to get past the filter - again this is all conjecture as I have not seen a schematic of the PING))) sensor.

I conclude, very unscientifically I might add, that your problem is due to electrical noise rather than mechanical noise and the noise is felt on your ping sensor line which causes false positives back at the prop.

Or it could be the same problem that Joao discovered, though I would chalk that up as a bug in the PING))). It should know how to mask out those close range objects - much like RADAR in the military knows that something 20cm away (i.e. the antenna boom) is a false positive and there is actual circuitry to filter those out (it doesn't even get to the firmware level).