Author Topic: Line following robot - LDR question.  (Read 5331 times)

0 Members and 1 Guest are viewing this topic.

Offline prologTopic starter

  • Jr. Member
  • **
  • Posts: 9
  • Helpful? 0
Line following robot - LDR question.
« on: December 15, 2007, 11:06:13 AM »
I'm developing a line following robot with 8 LEDs and 8 LDRs as sensors

like this



I'm using PID algorithm..
I detect line by comparing the analog values of the LDRs with the threshold values..


Apparently, I always have to re-calibrate the threshold values for every new place.
Furthermore, the threshold values keep changing in accordance with the lighting pattern of the place..



Is there any smarter way to make the threshold values auto-adapt to any environment?



Thanks in advance...

Offline HDL_CinC_Dragon

  • Supreme Robot
  • *****
  • Posts: 1,261
  • Helpful? 5
Re: Line following robot - LDR question.
« Reply #1 on: December 15, 2007, 11:17:32 AM »
You could build a hood over the sensor bar so outside light cant get to the LDRs


BTW, theres 9 LEDs and 8 LDRs :P
United States Marine Corps
Infantry
Returns to society: 2014JAN11

paulstreats

  • Guest
Re: Line following robot - LDR question.
« Reply #2 on: December 15, 2007, 01:22:07 PM »
Quote
BTW, theres 9 LEDs and 8 LDRs

it not necessarry to pair them, the important thing is to have enough detectable light. I think the reason that there is 1 more LED is so that each LDR has a light source on either side. Think about it if say the left LDR didnt have an LED to its left. It would only get 50% of the light that the others are getting along with an inaccurate reading. :P


PS. 1)Turn the LED's off, 2)Take a reading,3)turn the LED's on, 4)Take a reading. 5)Subtract the 1st reading from the 2nd reading. (This takes a reading of just the background light, then a reading of the background light with the led lights. Then subtracts the background light reading leaving only the true value of the reflected LED light)
« Last Edit: December 15, 2007, 01:26:10 PM by paulstreats »

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: Line following robot - LDR question.
« Reply #3 on: December 15, 2007, 01:50:43 PM »
Hey Paul, check out this link: http://www.wrighthobbies.net/guides/linefollower.htm

About the LDRs, they are slow in response and the ADC conversion also takes time. Why not use IR LEDs and IR phototranzistors? They are digital and offer fast feedback so you can speed up your robot.
Check out the uBotino robot controller!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,702
  • Helpful? 173
    • Society of Robots
Re: Line following robot - LDR question.
« Reply #4 on: December 15, 2007, 05:06:05 PM »
Quote
Is there any smarter way to make the threshold values auto-adapt to any environment?
yeap, I call it auto-config.

Have your sensors during startup take readings of the line (physical angle your robot by 90 degrees so that all sensors are on the line) and the ground, add those two reading values, and divide by two for the threshold. This will have to be done for each sensor.

Quote
You could build a hood over the sensor bar so outside light cant get to the LDRs
do this!

Quote
About the LDRs, they are slow in response and the ADC conversion also takes time.
about ~50ms, depending on the size of your photoresistor. but if you modulate like paulstreats mentioned, then you'd want IR . . . but you'd still need a threshold.

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Line following robot - LDR question.
« Reply #5 on: December 15, 2007, 07:29:43 PM »
Why 8 sensors? Thats overkill !!! :D

I am doing line following with 5 and it detects turns of every angle , as well as knowing when there is a break in the line
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Line following robot - LDR question.
« Reply #6 on: December 15, 2007, 08:59:54 PM »
also why would the modulation paulstreats mentioned have to be IR?
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

paulstreats

  • Guest
Re: Line following robot - LDR question.
« Reply #7 on: December 15, 2007, 09:28:00 PM »
it can still be done with ldr's only its a very slow process.

I suppose that more sensors = more resolution. It can be done with just 3. or even 2 if you dont mind your robot veering left and right. There is a link ro-bot-x left above that shows a line follower with just 1 sensor (although with 1 sensor its entirely possible for the robot turn 180 degrees and go the wrong way)

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Line following robot - LDR question.
« Reply #8 on: December 15, 2007, 11:00:04 PM »
with only 3 you cannot detect sharp turns AND detect breaks in the line

only with 5
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline HDL_CinC_Dragon

  • Supreme Robot
  • *****
  • Posts: 1,261
  • Helpful? 5
Re: Line following robot - LDR question.
« Reply #9 on: December 16, 2007, 09:37:41 AM »
Quote
BTW, theres 9 LEDs and 8 LDRs

it not necessarry to pair them, the important thing is to have enough detectable light. I think the reason that there is 1 more LED is so that each LDR has a light source on either side. Think about it if say the left LDR didnt have an LED to its left. It would only get 50% of the light that the others are getting along with an inaccurate reading. :P
yea but i was only saying because he said 8 LEDs and 8 LDRs but theres 9 LEDs :P

But yeah, there is a benefit to having an LED on both sides of the LDRs as mentioned above
United States Marine Corps
Infantry
Returns to society: 2014JAN11

Offline prologTopic starter

  • Jr. Member
  • **
  • Posts: 9
  • Helpful? 0
Re: Line following robot - LDR question.
« Reply #10 on: December 19, 2007, 04:01:59 AM »
BTW, theres 9 LEDs and 8 LDRs :P
Thanks guys!



That pic is not mine, btw..
My sensor board is very similar to that though



Anyway,
what are phototransistors and how do they offer digital feedback?

How do IR LEDs differ from normal LEDs?


Thanks!

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Line following robot - LDR question.
« Reply #11 on: December 19, 2007, 05:18:16 AM »
the light they emit is invisible to the human eye, though cameras can pick up IR light

phototransistors work in basically the same way as the photoresistor, just for IR, think IR photoresisotr * which doesn't exist)
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: Line following robot - LDR question.
« Reply #12 on: December 19, 2007, 06:18:30 AM »
Check out this IR photoreflective sensor: http://www.wrighthobbies.net/catalog/product_info.php?cPath=34&products_id=105

The sensor has a IR LED that emits IR light that reflects of close distance (about 3/16 of an inch) objects back to the IR phototransistor. The phototransistor needs a pull up resistor of 10K and the IR LED a series resistor of about 330-470 ohm. The output will stay high until a reflection gets to the phototransistor and changes to low. This is very fast response and is digital, no need for ADC conversion.
Check out the uBotino robot controller!

Offline prologTopic starter

  • Jr. Member
  • **
  • Posts: 9
  • Helpful? 0
Re: Line following robot - LDR question.
« Reply #13 on: December 19, 2007, 10:51:33 AM »
Thanks :)

Offline Barnaby

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
    • Electrolympics
Re: Line following robot - LDR question.
« Reply #14 on: December 28, 2007, 12:29:57 PM »
My first line following robot has this same problem, I'm currently experimenting having an extra LDR on the top of the robot, to find the light level and callibrate the others accordingly, but I'm using comparators so that might not work with PIC's.
Thanks,
Barnaby
I am an amateur (very) robot builder.  By the last count, I have built:
1 (working) Robot
Have a look a it on my website!
http://electrolympics.bravehost.com

 


Get Your Ad Here