Fair enough.
How fast can a ldr react? Is a light sensitive diode/transistor suitable aswell?
Fair enough.
How fast can a ldr react? Is a light sensitive diode/transistor suitable aswell?
An LDR might be a little slow, depends on the speed you need. Photo transistor might work well too, again, you'll have to experiment a bit.
Ted's,
I'm a rooky at electronics, so what the other guys are suggesting is probably better, but here's how I use a CDS cell for detecting day and night on my circuit, and I think it would work here to, as long as no outside light can get to it. The part number is from digikey: PDV-P9203-ND The specs say:
Rise Time (Typ) 70ms
Fall Time (Typ) 15ms
I don't know, but I'll bet that would work for ya.
I connect one side directly to the +5V of my board, and the other side to a pin on the PIC. This is the code that I use, and it has worked really well. What I have found using this code, is that it works with pretty much any CDS cell. I had 5 different ones, and they all detected dark at about the same light level with this code. For really good measurement of changes in light level, I'm sure there are better, and more complicated, ways to do this, but this is great for detecting day or night (or light on/off). After reading how RC time works, I'm not real sure why the value of about 46 to 49 is consistently dark on all of the cells I tested, but hey it works.
DayNight VAR BYTE
DayOrNot VAR BIT
Low PORTB.5 'Pin Connected to CDS Cell
Pause 10
RCTime PORTB.5,0,DayNight 'Read rctime value into DayNight variable
If Daynight > 46 Then 'It's dark
DayOrNot = 0
Else 'It's Daylight
DayOrNot = 1
End If
Gary
FYI g-hoot,
http://en.wikipedia.org/wiki/Photoresistor
Now Ted has code for his project tooand what speed to expect.
![]()
Dave
Always wear safety glasses while programming.
Yeah, that green light thing nailed me a few years ago. Had a project working the way I wanted in the shop and never thought about how sun light has a different spectrum until I took it out side. All of my setting were off.
Dave
Always wear safety glasses while programming.
I like the symbol
I am going to use a device that looks similar to a CDS cell and a ldr, maybe it is a ldr. It is very flat and it's dimensions are 4mm x 4mm. Do you have an idea on how to keep the LDR on the led even though the camera is moving?
Bookmarks