+ Post New Thread
Results 1 to 7 of 7
  1. #1
    Junior Member level 2
    Points: 478, Level: 4

    Join Date
    Sep 2010
    Posts
    20
    Helped
    0 / 0
    Points
    478
    Level
    4

    How do you connect LDR sensors with a PIC ??

    Hi

    How do you connect LDR sensors with a PIC ??

    Im writting a code to read from both LDRs and show the reading on LCD and I want to see if it's working
    but I dont know how to connect the LDRs with the PIC??

    •   Alt3rd October 2010, 14:28

      advertising

        
       

  2. #2
    Advanced Member level 3
    Points: 6,181, Level: 18

    Join Date
    Jun 2007
    Posts
    819
    Helped
    207 / 207
    Points
    6,181
    Level
    18

    Re: How do you connect LDR sensors with a PIC ??

    Connect the one terminal of the LDR to +5V then the other terminal to the Analog input of the PIC

    ---------- Post added at 13:46 ---------- Previous post was at 13:44 ----------

    drskippy.net/projects/ProgrammableLED.pdf



    •   Alt3rd October 2010, 14:46

      advertising

        
       

  3. #3
    Junior Member level 2
    Points: 478, Level: 4

    Join Date
    Sep 2010
    Posts
    20
    Helped
    0 / 0
    Points
    478
    Level
    4

    Re: How do you connect LDR sensors with a PIC ??

    I tried that it didn't work



    •   Alt3rd October 2010, 14:47

      advertising

        
       

  4. #4
    Advanced Member level 3
    Points: 6,181, Level: 18

    Join Date
    Jun 2007
    Posts
    819
    Helped
    207 / 207
    Points
    6,181
    Level
    18

    Re: How do you connect LDR sensors with a PIC ??

    Which didnt work? The LDR or the PIC? Can post your codes here?



  5. #5
    Junior Member level 2
    Points: 478, Level: 4

    Join Date
    Sep 2010
    Posts
    20
    Helped
    0 / 0
    Points
    478
    Level
    4

    Re: How do you connect LDR sensors with a PIC ??

    Iam using assembly program to sense the sun light using 2 LDR and compare them and rotate the motor to the sun direction
    Last edited by zeeba; 5th October 2010 at 07:28.



  6. #6
    Advanced Member level 5
    Points: 36,328, Level: 46

    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    5,951
    Helped
    1841 / 1841
    Points
    36,328
    Level
    46

    Re: How do you connect LDR sensors with a PIC ??

    It will not work with just the LDR. You need to measure voltage at one of the ADC inputs. The voltage comes from a potential divider made from a fixed resistor and the LDR in series with the ADC connected to the center. If you omit the fixed resistor the LDR will pull the PIC input high, even under dark conditions and the ADC will always read maximum voltage.

    Note that there are two ways you can connect this:
    1. LDR goes to the supply, resistor goes to ground.
    2. Resistor goes to supply, LDR goes to ground.

    Option 1 will give an increasing voltage as it gets brighter but you have to carry the supply line wherever the LDR is mounted. If it shorts to anything you could damage the supply or the wiring.
    Option 2 will give a decreasing voltage as it gets lighter but this is easy to compensate in software. It has the advantage that the LDR is grounded at one end and the resistor limits the current, giving some degree of protection.

    The optimum resistor value will give best voltage swing between lightest and darkest conditions. Typically, choose a value equal to the mid way between LDR dark and LDR light resistances.

    Brian.


    1 members found this post helpful.

  7. #7
    Full Member level 6
    Points: 2,358, Level: 11

    Join Date
    Sep 2009
    Location
    Some where In INDIA
    Posts
    333
    Helped
    69 / 69
    Points
    2,358
    Level
    11

    Connecting 5-ldr to PIC

    Hi all,
    We are planning to develop a Walking stick for Blinds. And we are planning to use 5 LDRs
    in it to sense Vehicle lights from
    1) Left
    2)Front-Left
    3)Front
    4)Front-Right
    5)Right

    Above The LDRs we are planning to put some Red LEDs to knotify the vehicles that a Visually Impaired person is in front of him.
    We need help in hardware designing/schematic.
    If this post is considered bad then I will start a new thread :???:
    else I will continue here

    Thanks
    Bluhole



+ Post New Thread
Please login