LDR with PIC

Status
Not open for further replies.
ok!!5n,you already no the maximum current a PIC can whithstand(i.e 25mA),THen the voltage u talked about so just find the resistance(R=V/I),Then set the ports of the pic
 
Hi!!i am doing my final project,i am about to use 2 LDR configered as voltage dividers to the NE555 timer,laser touch to reduce their resistance,so i am not interested in using this timer IC,I would like to use PIC(microcontroller),The question is how am i going to control voltage input to the pic coz when i reduce LDR2 resistance the pic must give the high output and low when i focus the laser beam on LDR1.
 
Inside PIC there are A/D converter circuit,so just write a code on what you want,all those will be done by PIC BUT remember that PIC normaly understand 0 and 1
 
Se up the LDR with a 100k resistor and 10k "stop resistor."

Use 5v supply.

Connect DMM across LDR. It must read more than about 3v5.
Now point laser at LDR It must read less than 1v5.

If this happens, you can use digital input of PIC.
 
Or if your LDR doesn't have the required range to transit Digital hi/lo states...u can use a weak pullup with an open collector NPN transistor to act as a digital input to the PIC. Just bias the transistor to work with the LDR range.
 
All LDR's have the required range. What are you talking about ????????????????????

The LDR's range viz. digital hi/lo states depends on the other resistances making up the voltage divider as well as the supply voltage. Not all LDR have the same resistance vs illumination spec.
 
will these give me enough input voltage to the PIC/Timer IC?I am interested in how am i going to control Pic with the 2 LDR's?


Since an LDR is a resistor that is rated by its DARK resistance eg:
https://www.newark.com/jsp/search/b...tk=gensearch&Ntt=LDR&Ntx=mode+matchallpartial

You need to determine the following:
1) at what light level do u want the LDR to trigger a state change in the PIC input.
2) What voltage is the trigger point for your state change.

If your application is not concerned with precise levels of light and just bright or dark, using a PIC without an ADC to precisely sample the voltage across the LDR is fine. If u need to respond to LEVELS of brightness then u need to use a PIC with an ADC to sample the different voltage drops (V=IR) caused by R changing due to lighting.


In the former you simply need to establish voltage divider matched to the selected LDR resistance, ( Colin was asking about 'range') to enable , say, a digital HI when LDR has low (bright light) resistance or a digital LOW for Darkness or hi LDR resistance.

Consider this LDR:
https://www.newark.com/excelitas-te...0-series/dp/99F5218?in_merch=Popular Products

The spec sheet indicates a max lit resistance of 72K and min dark resistance of 500K with a 5sec max response time.

To be safe let's work with a PIC input pin HI state of > 70% of Vcc and a LOW state of <30% Vcc.

with Vcc=5V we have HI @ > 3.5V and LOW at < 1.5V at the pic input pin.


A voltage divider is formed with the LDR connected to Vcc then to a fixed resistor (Rf) which is then connected to ground and the LDR/Rf junction is connected to a digital input Pin of the PIC.

To achieve 3.5V at the LDR/Rf junction with the LDR @ 72K we have:

the ratio of LDR to Rf of 30% : 70%

Thus Rf should be 70/30 * 72k= 168K. Go with the nearest standard value of 180K.

With a dark LDR of 500K the voltage at the Pic input will be:

180/(500+180) *5 = 1.32V which satisfies the LOW state voltage of < 1.5.

Your Pic input will go high when the LDR is lit and low when dark.
 
Last edited:
Not wanting to complicate things but you should give preference to using a Schmitt trigger type PIC input for the previous posted solution.

see here:
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…