SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By richardv2
#41730
So I ordered a bunch of QRD1114's for a line-following robot to use as black/white sensors.

Most schematics I've ever seen put a 270 ohm or 330 ohm current limiting resistor in a (regulated) 5-volt setup. So my math would be:

I = E / R = 5v / 270 ohms = 18.5 ma
and
I = E / R = 5v / 330 ohms = 15.1 ma

..and the data sheet for the QED1114 says the max current for this device is 50 ma, so it looks like I'm seriously underpowering the LED.

I = E / R = 5v / 100 = 50 ma
and I verified that a 100 ohm resistor gives me the full 50 milliamps.

The problem: I probably don't want to run these LEDs maxed out. Don't want to waste power - might burn out the LED faster, etc. So I want to reduce the power until I do *NOT* loose sensor sensitivity. I plan to run experiments at 50 ma, and down in increments until I see some change or some degradation of my results. I also see a problem that if I get it "just right", I could be low enough to get blown out by higher than expected ambient lighting if my light shielding isn't perfect.

The question: How would you conduct the experiment I mention above? What am I looking for to tell me I have the right LED current?
By jasonharper
#41732
richardv2 wrote:Most schematics I've ever seen put a 270 ohm or 330 ohm current limiting resistor in a (regulated) 5-volt setup. So my math would be:

I = E / R = 5v / 270 ohms = 18.5 ma
and
I = E / R = 5v / 330 ohms = 15.1 ma
That would only be valid if you assume that the entire voltage is being dropped by the resistor, and no voltage at all is being used by the LED. You need to either measure the actual voltage across the resistor, OR look up the specified forward voltage of the LED and subtract that from 5V (both methods should give about the same results).

I took a quick look at the QRD1114 datasheet, and I only see "50 mA" mentioned in the Absolute Maximum Ratings section. Those are limits that cannot be even momentarily exceeded without risking damage to the device: they are certainly not intended as recommendations for normal operation! Most of the operating parameters are specified at a current of 20 mA, that's a much more reasonable target.
User avatar
By bigglez
#41740
Greetings (No Name Supplied),
richardv2 wrote:The problem: I probably don't want to run these LEDs maxed out. Don't want to waste power - might burn out the LED faster, etc.
Be aware that device data sheets carry 'typical' and
'abs max' data, the latter should never be used for
a design, and is given to allow the design to avoid
conditions that would likely damage or change the
device.
richardv2 wrote:The question: How would you conduct the experiment I mention above? What am I looking for to tell me I have the right LED current?
You have several variables to consider. Firstly, the
final project is expected to find and track a line
under mostly controlled conditions. Things that are
beyond you immediate control are the ambient lighting
and the contrast ratio of the line compared to the
background.

Your testing experiments should try to fix all variables
except one at a time and collect data. For example you
might want to know the maximum distance from the
target to the LED and photodetector for a given LED
current. Another experiment would be to determine
the minimum contrast ratio for a typical line and
background.

Your detector assembly needs to shielded or have
a method of cancelling the ambient light. A colour
gel filter on the detector would improve the ratio
of ambient light to LED specific light.

Another improvement would be to modulate the
LED so that the photodetector ignores ambient light
(a DC or low frequency component) but responds to
the AC component from the modulation. An AC
amplifer is easier to design and build, and gives
lower drift over time, temperature, and power supply
variations.

The LED doesn't have a linear transfer function,
so too little drive and there is no light, while too
much drive and the light saturates. The ideal operating
point is before stauration, as greater drive is wasted.

The signal from the detector depends upon the
transfer ratio of the LED and detector pair, and
upon the reflectivity of the target (the line and
the background). Assuming a black line on a white
background, or the inverse, the photo detector
needs to accurate identify each type. It might
require an AGC amplifier and feedback loop or
peak detector to adjust the gain of the
photodetector before the data is sliced to get a
digital signal.

What are other designer's doing in this area?

Comments Welcome!
By richardv2
#41767
DUH!!! I read down to tye "Typical" section of the data sheet to get the *real* specs of 1.7 volts and 20mA, so I'm working with that.
I used 5v - 1.7v = 3.3v
R = E / I = 3.3v / .02 = 165 ohms, so I put in a 180 ohm resistor.

I used a 3 X 5 card with black stripes to see what happened, and I typically get ~0.10v with white and ~3.2v over black, so I seem to have a detectable difference.

Turning off ceiling lights and going with light from outside as ambient, I get just a little different reading, so still OK.

I did notice the sensor is more distance sensitive than I thought, so I'll have to experiment with different distances. Looks like somewhere between 1/8 inch and 1/4 inch will be stable.

Thanks for your help.
By richardv2
#41770
Bigglez (or anybody)... Could you say a little more about modulation.

I had a suggestion to read the floor with the LED off, then with it on, in sequence to detect the differences and maybe even be able to run with no LED and just ambient light.

I've also read about a modulating the signal, say at 20Hz or 2KHz or whatever, then *training* the receiver to detect that, but I'm not sure how that would work.

I'll Google the topic and see what I can find, but I'd like to hear more from you.
By riden
#41772
richardv2 wrote:I did notice the sensor is more distance sensitive than I thought, so I'll have to experiment with different distances. Looks like somewhere between 1/8 inch and 1/4 inch will be stable.
If you look at Figure 5 on the datasheet, you will see that the optimum distance (i.e., greatest current output) is 20-30mm.

http://www.sparkfun.com/datasheets/BOT/QRD1114.pdf
richardv2 wrote:I had a suggestion to read the floor with the LED off, then with it on, in sequence to detect the differences and maybe even be able to run with no LED and just ambient light.
The reason that you would want to sample with the LED off and then with it on is to address ambient light issues. This can be especially important with fluorescent illumination. The QRD1114 is an IR device, so I'd doubt that you would want to run without powering the LED (unless you other ideas for a design).

As noted, you want to run near the typical current and not the maximum. It would help performance and will shorten the life of the device or even damage it if the current is exceeded.
User avatar
By bigglez
#41774
Greetings (No Name Supplied),
richardv2 wrote:Could you say a little more about modulation.

I had a suggestion to read the floor with the LED off, then with it on, in sequence to detect the differences and maybe even be able to run with no LED and just ambient light.

I've also read about a modulating the signal, say at 20Hz or 2KHz or whatever, then *training* the receiver to detect that, but I'm not sure how that would work.
Firstly, your photo-sensor is an analog device, but
your application is digital - you are only interested
in knowing if the target (line you are tracking) is
present or not.

The photodevice you have choosen has an IR
emitter (LED) and photodetector (photo transistor),
both are parallel to the package and covered by an
IR optical filter. This filter keeps ambient light out,
unless of course the ambient light is the same
frequency (hue or colour) as the IR pass band of
the filter.

The LED beam diverges and is also attenuated by
air, the power drops by the second power, and this
is also true of the return beam, so the overall loss is
really the fourth power. This means that doubling the
target distance decreases the signal by 2^4 = 16
times! Reading theprinciples of RADAR should help
you see how this is true.

Most likely you will need to boost the return signal
and slice it (i.e. get a binary value of zero or one)
that is understood by your processor.

If you modulate the LED by turning it on and off
you will get two readings from the detector. When the
LED is off you are measuring the ambient light,
which can be subtracted from the signal with the
LED on, to get a reading that cancels the ambient
light error. (At least up to the point where the
photodetector saturates).

Modulation should be slow enough that your
detector processing has time to finish. Perhaps
you only need 50 readings per second to do this?

Alternatively, you can modulate the LED at
a much higher frequency (1 - 10kHz) to produce
an AC signal at the photodetector (when it has
a target). As noted earlier, an AC signal is much
easier to amplify than a DC signal, everything
else being equal.

Comments Welcome!
By winston
#41871
riden wrote:If you look at Figure 5 on the datasheet, you will see that the optimum distance (i.e., greatest current output) is 20-30mm.
Hmm. The data sheet I'm looking at says 20-30 mils (i.e. 20-30 thousandths of an inch). Calling thousandths of an inch mils is always asking for confusion with mm!
By riden
#41881
winston wrote:
riden wrote:If you look at Figure 5 on the datasheet, you will see that the optimum distance (i.e., greatest current output) is 20-30mm.
Hmm. The data sheet I'm looking at says 20-30 mils (i.e. 20-30 thousandths of an inch). Calling thousandths of an inch mils is always asking for confusion with mm!
Whoops, my bad. You were right, my eyes saw 'mils' but my mind incorrectly substituted 'mm' for 'mils'. :oops: The interesting thing is that I have used these devices between 1/4 and 1/8 of an inch above the surface, which is well on the downside of the curve of the published curve. I'll have to double check the part numbers, but I am pretty sure they are QRD1114 parts.