when using an ldr, make sure that it doesn't get wet! i had some ldr's (different types) in use in outdoor units. they worked well for about 1-2years, but suddenly, they started to indicate bright sun, as soon as it started to rain. seems that the transparent plastic cases of these units weren't best quality! tino ************************************************************************ ****************************** >-----Original Message----- >From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] >On Behalf Of William Bross >Sent: Monday, June 06, 2005 2:43 PM >To: Microcontroller discussion list - Public. >Subject: Re: [EE] Light level measurement with LDR > > >Peter: > >I've been using just the LDR and a pull up resistor for years >with great >results. >1. Set your PIC pin for digital input. >2. Look up the light and dark resistances of the LDR. >3. Size the pull up to make sure that the LDRs output swings >well above >and below the hi threshold level of the PIC pin. >4 Add a little hysteresis code to keep it in one state or the >other long >enough to keep it from 'flashing'. I typically use about 30 seconds. > >Can't get any more dirt bag or cheaper than this. > >Bill > >Peter Onion wrote: > >>Folks, >> >>I want to add a light level sensor to a clock I'm building so that at >>night the back light is dimmed. ( I could use the time of day, but >>sunrise/sun set calculations look a bit hard for a PIC (lots >of trig)). >> >>Has anyone got any simple circuit ideas to get a "reasonably linear" >>voltage from a typical LDR that has a log/log characteristic ? >> >>The **ideal** would be a linear output with Night = 0v and >Day = 5v to >>feed into a ADC on the PIC which will then program the PWM output to >>dim the back light. In practise something that gives a reasonable >>swing over the dawn/dusk periods will do the trick. >> >>Peter >> >> >> >> > >-- >http://www.piclist.com PIC/SX FAQ & list archive >View/change your membership options at >http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist