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??
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??
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
I tried that it didn't work
Which didnt work? The LDR or the PIC? Can post your codes here?
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; 05-10-10 at 07:28.
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.
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