I'm trying to perform an experiment where my aerial robot follows a
wall and then turns left when finding an opening (assuming the first
opening it sees is a 6 foot doorway on its left of course). I've done
it successfully with the Sharp GPSY0A02YK IR sensor but the plane moves
back and forth significantly because the sensor is quite noisy.
I wanted to compare the results of this experiment when using
ultrasonic sensors and I was wondering if someone could suggest one.
I'm looking at 3 in particular:
Maxsonar EZ-1: http://www.maxbotix.com
Please keep in mind that weight is an important factor.
Thanks in advance,
The EZ-1 will by far be the lowest weight, because it is a single horn
unit. The others use dual horns, so they have twice as much weight in
horns, and about double the PCB area to hold the dual horns.
I don't like to use the EZ-1 because it can't give detail on short
range (below 6 inches) otherwise, I and other people I've talked to are
as pleased as with performance of any you list. The SRF04 (cheaper, non
I2C, version of SRF08) gives very reliable ranges down to .1" I assume
the same for the SRF08, although since I don't like I2C communications,
I've used much less often than the SRF04. I've tried the PING and
written a working interface for it, but have very little practical
experience to say much about it.
I will say this. This spring with an SRF04, and this summer with a
SRF10 (even smaller dual horn unit with far worse directional specs.) I
tried to do wall scanning. I'd have serious doubts about using any of
the listed sonars for wall following from an airborne vehicle. I put
the sonars on a small bot in an arena, about 6 feet x 4 feet, rotated
the robot twice while collecting the returned data. Basically, with the
wild reflections I got, for a while, I couldn't figure out which were
the walls and which were the corners. I finally grasped the walls had
to be the closest returns, but the beams were so wide, that as soon as
you got away from almost perpendicular reflections from the walls, your
quality of return went to pieces. I went back to Sharps for my wall
For what its worth.
Randy M. Dumse
Caution: Objects in mirror are more confused than they appear
It sounds like this is the classical non-parallel wall problem. Only at
one instant in your scanning was the surface of the sensor parallel to
the wall. Remember that for sound just like light, the angle of
reflectance is equal to the angle of incidence. The fact that you get a
return beam for either is due to absorption of the light/sound of the
material you're reflecting against. You would get basically no reading
at all (or only distant echos) with an 100% acoustically reflective
wall, especially with a narrow beam. Infrared sensors also suffer from
these kinds of specular errors, depending on reflectivity of the surface
and angle of incidence.
Given a hard surface and a 45 degree incidence, you are about guaranteed
an incorrect reading when shooting an ultrasonic beam into a corner of a
room. The old Seattle Robotics document often cited for robot
ultrasonics shows this well:
Some ultrasonic transducers -- namely the Polaroid units -- sweep
frequencies because materials have different sound absorptions at
different frequencies. These later sensors typically use a single
frequency, and so they have no ability to overcome the problems of
reflections from different media. But at 3-5 times the cost, people
don't tend to use them as much.
If you use the human senses as the model, we detect gross proximity with
sound (also vision, but using more complicated visual analysis), local
proximity with sight (light), and immediate proximity with touch. The
same basic formula ought to work with robots, too. Ultrasonics have a
MUCH longer range than the IR sensors do, and they serve a purpose if
used in conjunction with other sensor techniques.
I've never figured out why it's important to know you're 0.1" away from
something. Can your motors stop that quickly? Odds are no, so it's
irrelevent information as far as avoiding obstacles go. I think it's
better not to be that close to something unless you intend it, and if
you do get that close, contact switching is cheaper, more reliable, and
more useful across a larger cross section of the robot's body. I suppose
it's nice to know your sensor is 0.1" from something, but that assumes
the object is conveniently directly in front of the sensor. Usually only
happens in test environments.
Also, with regards to what the first poster said, the Sharp GPxxx
sensors don't do all that well when mounted on moving objects, because
they integrate several triangulation readings over a full *50* msec. If
your frame is rotating during this time, the readings can be really
hoo-ey [to use a formal term :)]. I had one of these sensors mounted on
a panning servo, and had loads of trouble with inconsistent readings,
even with slow pans.
There is some evidence apparently that indicates the Sharp sensors do
better if mounted in vertical orientation for frames that are rotating
horizontally, but I never tried this myself.
Interesting. The only thing I can think of is that because these are PSD
devices, mounting vertically effectively creates a higher frequency
signal -- if mounted horizontally the change is slower, as that is the
axis of the PSD sensor inside the unit. This might suggest a
more-or-less asymmetrical field of view, and some inherent persistence
in the image projected onto the array -- kind of like what a cadmium
sulfide cell would exhibit.
Hi Gordon, I cannot get a direct link, but you might take a look at the
following appnote. Go here ...
and select ...
Document Library --> Optoeletronics --> Distance & Air sensors -->
Application Note Chapter 12 Use of Optical Sensors
Optoelectronic Device Applications Note pdf 1715.3K 6/10/2005
Nifty. Basically it says the way we've been using these things on a
moving robot has been wrong! It is "inadvisable" to mount them so that
the elements of the PSD array is parallel to the direction of the
motion. I didn't find that they said why, but the picture on page 7 is
I plan to redesign my sensor turrets to take this into account.
You might try some comparison measurements between vertical and
horizontal mounting, and see what happens.
Also, per Joe Jones' book I mentioned in the other post, all sensors
need backup for best results. I wouldn't put my flying R/C heli in the
hands of just one type.
Better, I think, to offer both methods. As the Budget Robotics turrets
use interchangable sensor boards, it's easy enough to offer an
alternative for vertical mounting, and let people use the one they want.
Looking at the document I think I know why.
The PSD (position sensitive detector) which is used to measure the location
of the reflected light spot seems to use only two photodiodes. The
reflected light spot must have a dispersal pattern where it's strongest in
the center of the spot and drops off after that. So the reflected light
spot is designed to fall on both sensors at the same time. The diode which
is closest to the center of the spot will have the strongest output. And
the effective position of the spot is calculated by the ratio of the
outputs of the two diodes.
Now, given this design, think about what happens if the object being
detected has an stripe or edge on it so that the spot falls across this
stripe. One side of the spot will reflect stronger than the other. When
this edge falls on, or between, the detectors, it will cause the detector
to incorrectly calculate the distance (one detector will be far stronger
not because of the real dot location, but because of the difference caused
by the edge.
But, if the edge is in line with the two photodiodes, the ratio will not be
effected, and it will still be able to detect a valid distance.
So it's not the motion that is a problem. The problem with the detector is
caused when the surface being detected has an edge which runs at any angle
which does not line up with the long length of the detector.
If the surface is moving, and it has any edges on it (like the lines draw
in the diagram) that cross the sensor, the sensor will give brief spikes of
invalid readings as the reflected spot passes over the edge. But if the
edge is in line with the sensor they won't create this error as it moves
past the sensor (or it will minimize the error).
So, it I'm right, the real trick I think is to pick an alignment of the
sensor to minimize the number of edges it will see which are not in line
with the sensor. Edges that align with the long axis of the sensor are
good, edges that are perpendicular to the long axis of the sensor will
If the bot is expected to be moving past vertical stripes, you need to
mount the sensor so it's vertical. If there will be lots of horizontal
stripes in it's field, it would be better to mount it horizontally.
If anyone has one of the sensors, it would be easy to test this theory
simply by using a piece of paper half dark and half light. Holding the
paper a constant distance from the sensor, move it back and forth so the
light dark boundary passes across the sensor and see what the distance
measure does. With the edge aligned on the same axis as the sensor, but
the paper moving on the other axis, there should be little error. But with
the edge turned the other way, moving in line with the sensor, you should
see a large jump in the sensor output as the spot passes over the edge.
You seem to be confusing some of the illustrations in that document.
Later they show a sensor with two sensing elements. That's for something
different. In a PSD sensor, specifically in a lateral effect PSD, there
is just one diode, which is designed to generate a varying resistance as
light strikes across its length. All diodes exhibit this response, but
this behavior is expressly developed in diodes for PS applications. If
you open up one of these Sharp sensors you see the PSD device has a very
large sensing window of maybe 3x3 millimenters. There's just one. There
are four leads: anode, cathode, and the two ohmic connectors for taking
The type of sensing you describe is also in use (like in a CD player)
but it works best with a more defined gaussian beam profile. You need a
laser operating in TEM00 mode to do these elements justice and (from my
own experience) even highly collimated light yields mediocre results. I
very seriously doubt this is how any of the Sharp distance judgement
You're right that it is not motion per se, but it is the effect of
changing distances caused by that motion. The change will be more abrupt
when the sensor is in the vertical. In whatever way the sensor is
averaging our those 32 "snapshots" it seems to favor the higher
resolution signal created by perpendicular motion rather than parallel
I think the stripes are there to make the drawing simpler. These sensors
are intended to measure distance and if the sensor is working correctly,
stripes on a piece of paper should have little or no effect. If what you
suggest DOES happen, these sensors aren't what Sharp says they are. They
are indeed reactive to changes in surface color and reflectance, and
they are supposed to be largely immune to these
It's not the illustration I was confusing, it was the wording. I'd cut and
paste it but it won't let me - I guess it's an image. It's the last two
paragraphs in 12.2.1 on the principle of operation.
The wording that led me to believe this was where it said, "an application
of photodiodes", (note the s), and where it made reference to the "ratio of
the two outputs". But now that you point out it's a single device, you are
probably right - there's no indication in the wording it was two diodes - I
just assumed it.
The document talks about where this was "explained" in section 5.5. Let me
look for a principle of operation of these PSDs and see if I can figure out
what's going on.
I think you are talking about detectors that measure phase shift in the
light which works when you want to get delta measurements accurate down to
the wavelength of the light. That's not what I was thinking about.
What I was suggesting makes them fairly immune to reflectance levels as
well because they measure the ratio of the two signals and not the absolute
value of the signals. The idea is that the intensity of the spot would be
constructed so that it created a bell curve with the center of the spot
being the brightest and the spot getting dimmer as you went out from the
center. The spacing of the two sensors would set so that within the
working range of the sensor, the center of the spot would be located on or
between the two sensors (never outside the sensor).
At the closest range, the center of the dot would be on the outside sensor
making it the strongest signal, and the inside sensor the weakest. At the
fairest range, this would be reversed, with the center of the dot in the
inside sensor. The ratio of the two signals would determine the location
of the center of the spot. The ratio might be 2:1 for example when the
distance was at one end of the range. If the reflectance of the surface
changed, it would reduce both signals by an equal percentage (in theory) so
the ratio would stay the same.
The sensor would only get confused, if the reflectance of the surface was
different from one side of the spot to the other. So only if a strong edge
was located in the middle of the spot would the sensor get confused.
What you are suggesting however, is that the spot is actually very small,
and travels across the face of the diode. And the two outputs change as a
function of the location of this spot on the surface.
I suspect the effect I'm thinking of happens anyways. I doubt the LED and
the optics (not to mention the variable reflective quality of the random
surface that is hit) will allow for a very accurate light dot to be focused
on the surface of the detector. I strongly suspect it's a fairly defuse
spot that covers a wide range of the detector. A laser pointer I have here
for example has a beam about 3mm wide which is what you say the surface of
the detector is. With a fixed focus lens system designed to operate over a
wide range of distances, I don't really understand how they could get a
high resolution spot.
So if this is the case, the sensor is still going to be performing some
sort of average of the light intensity over the length of the sensor
surface for the purpose of estimating where the center of the dot is. And
if this is so, I think it's still going to be momentarily confused when the
spot crosses a sharp change in the reflective surface.
Either way, it's easy to test how true this is. Anyone that has one of
these set up, can just move a target with a sharp reflective change back
and forth and see if it causes distance errors with one orientation and not
I'm going to go off now and see if I can find more on how these PSDs
actually work so I can learn something else new....
Add in motion that entails changes in depth (distance) and the sensor
will also average the effect of the motion. This is true of PID
sensors, which are normally positioned so that the two sensing elements
are horizontal. That arrangement accentuates the effect of the change,
which is exactly what you want in a PID sensor -- detect motion. If you
mount a PID sensor vertically, the sensitivity drops.
I suspect some variation but whether it will be enough to change overall
accuracy I don't know. One of the uses of these sensors -- the ones with
a closer image range -- is for paper handling in printers and printing
presses. If they were all that affected by the black ink they wouldn't
be as useful for this application.
Sharp has historically offered little hard theory of operation on the
PSDs they use in these IR sensors, though I'm sure somewhere on their
vast Web site they actually sell the damn things. But other people make
them, too. Look up 'lateral effect PSD' or words to that effect and you
should come up with something.
As I recall, the Sharp units have an led with a [fixed] focussing lens
on the Tx side, and a 1-D linear photodiode array, with another
focussing lens, on the Rx side. It takes something like 10 averages
over 50-msec of where the reflected spot falls on the array.
Since the accuracy of this device is a matter of geometrical
triangulation, small changes in geometry, especially regards
"orientation angle" of the object being sensed, will have large effects
on where the spot falls on the array. In addition, if the object is not
a flat surface and perpendicular to the sensors, but has some shape or
edges to it, and the object and/or sensor is moving during the 50-msec
integration period, then the spot will also jump around a lot, and the
output reading will be flukey [to use a hard engineering term].
Ultrasonic sonars have their own peculiar problems, but only take a
single reflective reading, and small changes in target orientation or
movements will not so as big an issue as they are for a system that
uses triangulation. The sensitivity of error versus change of angle,
etc, should be easy to figure out with a little trigonometry.
Actually, this tends to be a limitation of the low-end ultrasonic
sensors. The Polaroid sensors have always taken a series of pings (at
different frequencies no less), as do most of the industrial ultrasonic
Just re-read this: it's indeed confusing. Could be that the wording is
generally vague so the document can cover a wide variety of their sensor
I was wrong earlier in describing the four pins of the PSD in the Sharp
unit. I went back to my notes, which I made when I pulled one apart 4-5
years ago. The leads are described as "Anode 1," "Anode 2," and Cathode.
Two of the four leads are the cathode, to assist in soldering. I once
thought they had two diodes in them as well, but in further reading this
is just how the diode is construced internally. I can no longer find the
original Sharp document that described the sensor, but I recall it
described as a "pin photodiode" (singular). So Anode 1 and Anode 2 are
the differentiual "outputs" (I am assuming) and on these units there is
no separate direct output. Sorry for the additional confusion.
Here's some good technical stuff on these types of sensors I found...
http://www.sitek.se/section1.htm (PSD School - a 15 section paper on how to
design these sensors).
As you say, the 1D version of the sensor has 3 leads. It's got one
connection on the back of the material, and two on the front. Wherever the
light falls on the front cause it to generate a voltage which is a function
of how far the light is away from edge contacts.
This causes the device to measure the effective "center of gravity" of the
light hitting the sensor. So the type of effect I was talking about could
happen, but it's a function of how small the focused dot is on the surface
of the sensor. The smaller the dot, the less effect there would be.
The first technical document above goes into great detail in how to design
such a sensor including all the math for selecting lenses and calculating
dot sizes. I read a lot of it but not all of it.
Laser diodes it seems from the document do have extremely small light
source sizes (20x4 um) which can make for an extremely small dot on the
sensor if the optics are designed correctly and the dot is focused
accurately. However, as the more the target moves, the dot goes more and
more out of focus. So the dot size will be a function of the design, and
how much the target is allowed to move. So if you want the sensor to only
detect a range of movement (like the thickness of a sheet of paper) from a
distance of 10 mm then the optics can be precision focused to make a very
small dot on the sensor surface and create a highly accurate reading (a
.004 cm dot on a 3 mm sensor surface just doesn't cause much error when
half the dot goes dark and shifts the center of gravity of the dot by .001
But if you are talking about allowing the target to move 100 cm and you
aren't using some complex movable focus lens system (which I don't get the
impression these devices use), it seems to me it's not going to be able to
focus the dot very accurately on the sensor for the full range and it could
create a very large dot on the surface and the PSD will then be calculating
the center of gravity of the dot. So if the out of focus dot expands to 2
cm on a 3cm sensor, and half the dot goes dark as it passes over a edge on
the target, it could cause the center of gravity of the dot to shift by .5
cm which would be something like a 16% error.
So, end result, as I suspected, there will have to be some error caused by
a sharp reflective change on the surface just based on how these systems
work. But without knowing the exact design details of the sensor, I
couldn't begin to estimate whether the effect is a .001% error or a 20%
Here's another idea I just thought of for caring about the direction of
movement. If there is a sudden change in the depth of the target as it
moves (you scan past a step in the surface), then it's possible that the
dot could be momentarily hidden from the view of the receiving sensor
(which is at a slight angle from the transmitter). This could cause a
slight blip in the distance reading. Mounting it as they suggest could
prevent the blip. Maybe both this effect and the transition from light to
dark surface just causes more "blips" in the reading unless you mount it as
they suggest relative to the motion. And if you had a stair-step effect in
the right direction combined with a color change, you might get double the
effect. (like scanning a light object going past on a dark conveyor belt).
For applications where the target is well known, I can see where effects
like this might make it useful to mount the sensor in a way to minimize the
noise caused by these effects (like measuring the thickness of boards going
past on a conveyor belt). But for robotics use where you can't control the
environment there's going to be so much noise and unpredictable results
that the minor effects that I talked about seem like they would be
insignificant making it of no real concern which way you mount it.
How much do these sensors cost? Where can you get one cheaply? I'm feeling
motivated to buy one and play with it now....
A really good web ref to understand PSD's is on the second page of this
Realize the conductive surface across the diode face is resistive. So
photons generate currents somewhere across the device where the light
falls, but to exit the diode, it has to go to one of the two terminals
through the resistive material. So the currents will favor the closer
of the two terminals (path of least resistance). The ratio of the
currents tells where the light fell.
Randy M. Dumse
Caution: Objects in mirror are more confused than they appear
Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here.
All logos and trade names are the property of their respective owners.