Let's Make Robots!

QRD1114 Resistor Values

Hi all,

I'm using a QRD1114 sensor for a line-follower. Datasheet: http://www.fairchildsemi.com/ds/QR/QRD1114.pdf

Im hooking it up with this schematic:

However, I'm unsure how the value for the 10K resistor was calculated? It's acting as a potential divider, right?

For the LED im guessing that the value of 220 was taken from doing:

R=(Input Voltage - Max Forward Voltage)/(Optimum forward current)

so: R = (5-1.7)/0.020 = 165

and 220 is closeish to this?

I'd appreciate any help!

Thanks in advance!

Michael 

http://hirobotblog.blogspot.co.uk/

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thanks again everyone who helped me out. Here's the story of the working system! Now I cant wait to get my motors! :P

http://hirobotblog.blogspot.co.uk/2012/07/ok.html

About the current limiting resistors used in series with the LEDs. As I also said in the shoutbox, I suggest you to experiment a little, try some values between 220ohm and 2.2Kohm.

  1. Hook up a single sensor to your arduino, using the internal pull up I mentioned earlier.
  2. Before applying current to the LED take your voltmeter and measure the voltage on the input to the Arduino. No IR light is present, you should measure something close to 5V. (avoid sunlight)
  3. Apply current to the LED through a 220ohm resistor, hold the sensor out in the air, make sure no light is reflected. Repeat the measurement. It should still read a pretty high voltage, ideally close to the one before.
  4. Take a piece of white paper and put it in front of the sensor, a few Cm's should be good.
  5. Repeat the measurement, now you should read a pretty low value on your voltmeter, close to zero volts.
  6. Now, put a black line on the white paper and watch the reading go high when the line is under the sensor.
  7. If the reading while over the black line is too low, say under 3V, try a bigger resistor, say 560ohm or even higher
  8. If the reading while over white is too high, say over 0.5V, try a smaller resistor, BUT NOT BELOW 220ohm

Fantastic! Thanks so much - your method was golden. did use 220 ohm current limiter in the end, but the main problem was a) my sensor's transitor box was poking out... this caused it to get a higher reading than the others and b) the trick was in choosing a threshold at which to say 1 or 0 ie on the line or not on the line. its up, working, and will be on my blog in a few minutes.

Thanks again, LMR!

Michael

http://hirobotblog.blogspot.co.uk/

First off, thanks for all your help. The LMR community is fantastic.

I've hooked up all the circuitry according to the schematic and finally thought i understood how it all worked...

However, I'm getting readings between about 300 and 700! This leaves out a huge margin between the 0 to 1023 that my arduino is capable of reading to. Coiuld it be a problem with the 10K resistor value? I was also powering an LCD display (you can see in the image) off of the 5V power line, so I thought that could mean i wasn't supplying enough voltage to the sensor. However, even after switching to an individual power line from a separate battery for the sensor, no luck.

Any ideas? Also, how would I go about powering an array of 7 of these sensors? Will they get enough voltage from sharing a single 5V power line?

Any help would be really appreciated - my deadline is coming up fast! :P

Michael

http://hirobotblog.blogspot.co.uk/

There shouldn't be a problem with the current actually. The Arduino is capable of supplying enough current to the LCD and the LEDs when using a battery pack. If you put the sensors closer to the ground you can get away with less than 20mA per LED, depending on how much intensity you need.

You can compensate for the values in software. So you're saying a light surface is 700 and a black surface is 300, right? Then just use the value in between, 400, as a threshold to determine if the sensor is on the line (700) or off the line.

Another thing you could do is solve this problem in hardware, you could use the 74HC14 inverting schmitt trigger, it is more sensitive than the schmitt triggers inside the AVR and therefore it can tell the difference better, even if the signal levels are not 5 or 0V.

The values are far enough apart so that the schmitt trigger will give you a 1 when the sensor is off the line (remember it's inverting)  and a 0 if you are on the line. Just connect the schmitt triggers outputs to your digital pins and you're good to go.

 

To solve the problem of ambient light you can just slip a bit of heatshrink tubing around each sensor. This also ensures that there is no crosstalk between the sensors.

Ah OK -

can you elaborate a a bit on how that pull up resistor works? (electronics newbie here)

Thanks in advance,

Michael

http://hirobotblog.blogspot.co.uk/

It's actually pretty easy. As mogul has said you can replace the 10k resistor by the internal pull up resistor in the AVR (on your Arduino).

To activate the internal pull up resistor is connected between the pin and the supply voltage internally, hence the name pull up, when the pin is declared as an input (pinMode(sensorPin, INPUT)) and then writing a logical '1' into the PORT register, in Arduino this would mean digitalWrite(sensorPin, HIGH).

Pull up or pull down (resistor between pin and ground) resitors are generally used to prevent false triggering of an external interrupt (special event that will interrupt the current program when one of the interrupt pins changes state) or to prevent a false reading from your pin via digitalRead(sensorPin). The false readings / triggerings can occur because the pin is left 'floating', meaning that it doesn't have a defined state.

Depending on how noisy (in terms of electromagnetic fields) your environment is, it's pretty random if you read a 0 or 1, because of the inductance of the traces and pins etc. (the longer the wire you connect to that pin, the more noise you will pick up, especially the 50/60Hz mains frequency).

If your Micro Controller supports an internal pullup on inputs, you could enable that and omit the 10K pullup completely. I dunno about the PIC's, but Arduinos and plain AVR's have them easily available.

Thats cool, eyah im using an arduino so ill look into that

Simply do something like the following (untested) code:

First:

  • #define sensorPin 8

In your setup()

  • pinMode(sensorPin, INPUT);
  • digitalWrite(sensorPin, HIGH);

And where you read it

  • digitalRead(sensorPin);