1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

How to work with Infrared transistor (Sensor) in normal daylight.

Discussion in 'Robotics & Mechatronics' started by sandeep041, Apr 5, 2010.

  1. sandeep041

    sandeep041 New Member

    Joined:
    Mar 1, 2010
    Messages:
    8
    Likes:
    0
    I am working on a project involving a robot to follow a dark line. I hv used a IR sensor to detect the dark(black) line.

    I am following the notes from here:
    http://www.seas.upenn.edu/ese111/robot/Robot.html

    1) Now the problem is I am noting tht the sensor is developing potentials from the day light. But as in tht article above I want to use the LED as the source for radiation. How do I achieve tht.

    2) Is there any other sensor which I can be replaced for tht( if tht is easier to work with).

    Thanks guys in advance:):)
     
  2. Vizier87

    Vizier87 Active Member

    Joined:
    May 12, 2009
    Messages:
    1,495
    Likes:
    12
    Location:
    Johor Bahru, Malaysia
    use LDRs for LED lighting detection.
     
  3. upand_at_them

    upand_at_them Member

    Joined:
    Apr 23, 2005
    Messages:
    609
    Likes:
    8
    Location:
    Pennsylvania, U.S.
    LDR's respond slower than phototransistors, though. And they're going to have the same problem, being affected by sunlight. Can you shroud the detectors to prevent sunlight coming in?
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Vizier87

    Vizier87 Active Member

    Joined:
    May 12, 2009
    Messages:
    1,495
    Likes:
    12
    Location:
    Johor Bahru, Malaysia

    of course they do. but you can avoid that by setting a threshold using op-amps, since the intensity of an LED light is constant compared to sunlight and at close proximity to the LDR,the LED wins in terms of intensity.
     
  6. Hero999

    Hero999 Banned

    Joined:
    Apr 6, 2006
    Messages:
    14,902
    Likes:
    79
    Location:
    England
    Any optical sensor is going to be activated by daylight which contains all wavelengths from infrared to ultraviolet.

    What you need to do, is pulse the LED on and off at a certain frequency (for example 32kHz) and use a filter to ensure that your circuit only responds to that frequency.

    You can buy IR sensor modules which the filter built-in.
     
  7. Triode

    Triode Member

    Joined:
    Feb 11, 2009
    Messages:
    925
    Likes:
    22
    Location:
    Bay Area
    Also, though I havent done it, I think using a second light sensor for a reference should take care of this. If you're not using a microcontroller I think it can be done with a Dedicated voltage comparator.
     
  8. Slorn

    Slorn New Member

    Joined:
    Oct 20, 2009
    Messages:
    17
    Likes:
    1
    Take a look here. The page explains how to make a sensor insensitive to ambient light just like you want.
     
  9. magnatro

    magnatro New Member

    Joined:
    Mar 23, 2010
    Messages:
    295
    Likes:
    0
    Location:
    India
    if you want the ldr or the phototransistor you can do this:
    take an ordinary projector film, expose it to the ir radiation, devolop it, and you have made an IR filter..!
     
  10. upand_at_them

    upand_at_them Member

    Joined:
    Apr 23, 2005
    Messages:
    609
    Likes:
    8
    Location:
    Pennsylvania, U.S.
    This technique seems curious the way it was implemented. I wonder if the author actually tested it. The output is pulled high by default and the sensor pulls it low. So the "LED off" reading would be higher than the "LED on" reading and, hence, the result would be negative and unreliable. Am I missing something on this?
     
  11. Slorn

    Slorn New Member

    Joined:
    Oct 20, 2009
    Messages:
    17
    Likes:
    1
    Hi upand_at_them

    The technique was used in an obstacle avoidance robot last year and works fine. There is no reason why more IR light can not be represented by a lower voltage. That does not make de result unreliable.

    If the second measurement is lower than the first, there is reflected light falling on the photodiode. This means there is an obstacle. If the second measurement is equal to the first there is no reflected light an and no object

    Slorn
     
  12. upand_at_them

    upand_at_them Member

    Joined:
    Apr 23, 2005
    Messages:
    609
    Likes:
    8
    Location:
    Pennsylvania, U.S.
    That's my point, more light will result in a lower voltage. So the "total" variable will always be less than or equal to "ambient", but the result is "total - ambient".

    Edit: Also, I don't know the processor speed used in that example, but LEDs aren't instantaneously on or off. They have a rise and fall time. I would wait 5-10uS between setting the LED and reading the sensor. And the LED should probably be turned off at the end of the routine instead of leaving it on...save on batteries.
     
    Last edited: Apr 13, 2010
  13. Slorn

    Slorn New Member

    Joined:
    Oct 20, 2009
    Messages:
    17
    Likes:
    1
    You're right, there is a mistake in the code. It should be ambient - total. Thanks for pointing that out. The principle is correct though: measure the ambient light and the total light separately; subtract them to get the reflected light.
     
  14. wimh

    wimh New Member

    Joined:
    Apr 13, 2010
    Messages:
    2
    Likes:
    0
    Good point about the rise/fall time. The ADC routine we used had a 125 us delay after the channel selection though so in our case it wouldn't have been a problem, but I can imagine that in some cases you'll need to account for this.
     
    Last edited: Apr 13, 2010
  15. upand_at_them

    upand_at_them Member

    Joined:
    Apr 23, 2005
    Messages:
    609
    Likes:
    8
    Location:
    Pennsylvania, U.S.
    Slorn, this got me to thinking...Is "int" an unsigned 8-bit value? If so, then you may have had it right the first time:

    Maximum ADC = 255
    ambient light reading = LEDoff
    ambient light offset = 255 - LEDoff
    actual reading = LEDon + (255 - LEDoff)....yes, add, because the offset brought the value low it needs to be added back in
    ...so this should be the same as LEDon - LEDoff (because of rollover)
     
  16. wimh

    wimh New Member

    Joined:
    Apr 13, 2010
    Messages:
    2
    Likes:
    0
    @upand_at_them:
    I just checked our original code, it computed LEDon - LEDoff + 1023 (our PIC's ADC is 10 bits) -- which would in turn be interpreted just as a raw reading, i.e. as running from 1023 (no light) and going down for increasing reflection...
     
  17. upand_at_them

    upand_at_them Member

    Joined:
    Apr 23, 2005
    Messages:
    609
    Likes:
    8
    Location:
    Pennsylvania, U.S.
    Didn't mean to be picky, guys. I just happened to be working on something similar for a line-following robot.
     
  18. Sudhanshu Nimbalkar

    Sudhanshu Nimbalkar New Member

    Joined:
    Jan 16, 2014
    Messages:
    1
    Likes:
    0
    If you want to just make a line following robot you can just cover the IR sending receiving pair so that no external light reach the sensor.
     
  19. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)
    Hi Sudhanshu Nimbalkar, welcome to ETO!

    This thread is from April of 2010--nearly 3 years ago. Chances are the OP has either received the answers he was looking for or moved on. There's generally no need to bring old threads back from the dead ;)

    Regards,
    Matt
     

Share This Page