39333Re: [SeattleRobotics] Re: query...
- Apr 27, 2009There are four effects that you have to worry about.
You are trying to measure the IR light emitted by the LED and reflected off
Effect 1: the obstacle may not reflect much IR. I don't find that's a big
problem. Most stuff you find in a living room reflect IRs pretty well. Even
black objects. Not all reflect to the same degree so you can't measure the
strength of the reflection to determine distance.
Effect 2: light falling sideways onto the IR receiver can overload it.
Hence, the receiver should be in a tube and the tube should be matt black
inside (and appear black in IR). I generally use some sleeve off a coax
cable which is probably not ideal. Be careful with light coming in the back
of the tube - that's caught me out in the past. You should mount the
receiver slightly forward of the LED because the LED will scatter some light
You can buy receivers with different angles of acceptance. The front of the
plastic casing acts as a lens. The angle is generally stated in the
receiver's spec sheet. For obstacle detection, you probably want a narrow
angle for both the receiver and LED. (But then you have to be careful that
the emitter and receiver are both pointing exactly the same way.) Remote
control IR receivers are good because the contain a 38kHz filter but they're
really bad because the have an extremely wide acceptance angle.
Effect 3: the wavelength of the IR matters. Obviously, the emitter and
receiver wavelengths must match. Some receivers have quite narrow
bandwidths. Is longer or shorter wavelength better? Shorter wavelengths mean
that the receiver is more sensitive to daylight which may swamp the IR
signal. Some IR receivers are "water clear" - they let in daylight. Some
have built-in IR filters - the plastic looks black. You probably want a
filter. You can also get sheets of filter by disassembling old VCRs, etc.
Effect 4: the background level of IR matters. If sunlight is falling on a
wall, then the wall will be emitting a lot of IR. The obstacle detector is
looking for the difference between the receiver's voltage when the LED is ON
vs OFF. It may not be able to see a sunlit wall. IR receivers aren't linear
so the extra IR from the LED may add 20mV to the receiver's signal in a dark
room but only 1mV in direct sunlight. The sensor should compensate for this
but many don't.
What do I do? I've designed by own, very cheap, sensor which I'm very
pleased with. I use short wavelength IR receivers in a water-clear case and
very bright red LEDs. The sensor responds to the bright red LED about as
well as it responds to it's recommended IR emitter - the LED is not the
right wavelength but it's much brighter. It's useful having visible red
light as you can see where the sensor is pointing. And any robot looks
better with glowing red eyes.
The detector measures the background light level (including daylight) then
turns on the LED and measures the light level again. By measuring the
background light level, I can compensate for the receiver's non-linear
response. I can get the same "answer" for the same distance/reflectance in
both darkness and a normal room. Direct sunlight is still a problem though.
As a bonus, I get a reading of the background light level which I can use
for "navigation". I get a light-level and obstacle detector for around
$0.60. It only requires 2 PIC pins. (In fact, I often power the LEDs off the
same pin as a motor's H-bridge so that's just one pin per sensor.)
- << Previous post in topic