Detect fast movement using photodiode


Closed Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    Aug 2008
    Posts
    66

    Question Detect fast movement using photodiode

    I have used LDR and a LED to detect small objects moving across it ~ 1 cm.
    The object is 5mm x 5 mm.
    This design is useful to detect slow object.

    But I would like to detect very fast movement across LED and photodiode.

    However the output of a photodiode is analog. How do i go about interfacing this circuit to PIC16F877? To detect the photodiode input, I plan to enable PortB INTB interrupt so it will send a serial message to PC immediately. Is this circuit sufficient to detect fast movement or do I need IR or laser? The distance between tx and rx is ~1cm.

    Any suggestion is welcome.
    Last edited by Pic2008; - 21st November 2008 at 17:17.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    No need for analog.

    Tie the cathode of the photo diode to the PIC pin with a 10M ohm pull up. The anode of the photo diode to zero(ground). When no light is detected the PIC pin will go LOW.

    Used an IR diode for a dedicated light source.

    You will have to shield from ambient light to keep from having false readings.

    This is very similar to how a mouse works. Very fast and reliable.

    I have used this setup to detect parts moving in excess of 6 inches per second.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Aug 2008
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    That means I just connect the IR LED continously to 5V with series resistor , no need to modulate the IR Tx?

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Pic2008 View Post
    That means I just connect the IR LED continously to 5V with series resistor , no need to modulate the IR Tx?
    Correct.
    As long as you do a little shielding for ambient light. Basically you can look at the modulation used in IR remote control applications as a way of electronically shielding.

    Ty it. Take a photodiode, put a piece of heat shrink or something else around it so only the end can receive light. Connect it to a meter instead of the PIC, have sitting in a shadow. Hit the end of the photodiode with IR or some other light source and test.

    You can also reverse the photodiode connection and have it detect light instead of dark.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Word on the street is: Use a PIC with Schmitt trigger inputs for better results. Better results due to Schmitt triggers hysteresis's gives input port a snap action, dampens analog effect.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by Joe S. View Post
    Word on the street is: Use a PIC with Schmitt trigger inputs for better results. Better results due to Schmitt triggers hysteresis's gives input port a snap action, dampens analog effect.

    Yesss Joe ...

    Much better, as comparators directly can generate the interrupt ...

    Over that I'd try to use a compensation stage to correct for ambiant light ... look at the attached scheme ... left side of Transistor T2.

    Alain
    Attached Images Attached Images  
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Along the same lines, the data sheet for the part Alain points out has on page 11 another nice way of doing it.
    http://www.google.com/url?sa=t&sourc...SILdHEv5RRcHYQ
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Along the same lines, the data sheet for the part Alain points out has on page 11 another nice way of doing it.
    http://www.google.com/url?sa=t&sourc...SILdHEv5RRcHYQ
    Hi, Dave

    Not so nice ...

    as the goal, here, is to take care the detectors are not saturated by light ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi, Dave

    Not so nice ...

    as the goal, here, is to take care the detectors are not saturated by light ...

    Alain
    Maybe... but if the OPs part was to pass the two detectors causing the differential ?? then saturation may not be a problem ??

    I am going to try it some day. Just an idea.
    Dave
    Always wear safety glasses while programming.

  10. #10
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Lightbulb

    Quote Originally Posted by mackrackit View Post
    then saturation may not be a problem ??

    I am going to try it some day. Just an idea.
    Halas !!!

    when saturated ... your detectors won't "see" anything ... both of them !!!

    no differential signal nor ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  11. #11
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Halas !!!

    when saturated ... your detectors won't "see" anything ... both of them !!!

    no differential signal nor ...

    Alain
    I am thinking along the lines of both detectors being saturated but spaced maybe a centimeter or so apart. When the piece being detected cast a shadow on one and not the other then the differential. I guess it would only work if the light source was coming from one direction only........Darn, now I am back to square one
    Dave
    Always wear safety glasses while programming.

  12. #12
    Join Date
    Aug 2008
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Halas !!!

    when saturated ... your detectors won't "see" anything ... both of them !!!

    no differential signal nor ...

    Alain
    From that datesheet, it said that the circuit will not be sensitive to changes in light as the source ages, this means saturate right?

    That means I can't connect IR TX continously?

  13. #13
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Post

    Quote Originally Posted by Pic2008 View Post
    From that datesheet, it said that the circuit will not be sensitive to changes in light as the source ages, this means saturate right?

    That means I can't connect IR TX continously?
    Hi,

    That means aging will modify BOTH sources ... but "saturate" means the sensors ( not the source ...) cannot make any difference in light changes.

    just as if you look straight at the sun ... you can't distinguish anything more in the sky , even in front of you !!! ( the model plane you should fly is a "good" example here ... lol : little chanche for you to keep it in the air ... )

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Replies: 1
    Last Post: - 7th November 2007, 21:36
  2. Possible to detect I2C Device?
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th March 2007, 11:13
  3. code conversion
    By saturnX in forum mel PIC BASIC
    Replies: 19
    Last Post: - 3rd October 2005, 18:17
  4. Detect baud rate
    By Dick M in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 2nd July 2005, 22:10
  5. A/D on 16F877. How fast can I go?
    By atomski in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th April 2004, 07:51

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts