Ok, this is one of those obscure questions that if it were asked of 100 average people, 100 of those people probably wouldn’t know. So I turn to the Dope, because I’m sure someone here knows the answer.
I’m building a project that involves using photoresistors to detect the brightness and angle of a light. I’ve programmed it to take a reading of the ambient light when it is first powered up before the light is turned on so I can compensate for any background lighting.
This works well until the ambient light changes. The sun comes out from behind a cloud, the sun goes behind a cloud, someone with a white shirt walks in front of the sensors, etc. Anytime the ambient light changes it plays hell with my readings and I have to reboot.
I’m thinking of turning off the light every 1 second or so and recalibrating based on the ambient light at that second, then turning back on the light.
Now for the question: How much time would it take to do this? Would the photoresistor be able to accurately read the ambient light the instant the light is turned off, or would it take some time for the resistance to change?
I would like to be able to turn the light off and then back on so quickly that it is hardly detectable by human eyes. But if the photoresistor can’t adjust that fast, I can turn the light off for a longer amount of time.
Your basic cadmium sulfide photo-resistor is a slow beast. It’ll take a tenth of a second or so to recognize a change in light intensity.
If you need speed, go with a photodiode.
Are you accepting alternate solutions from unqualified posters?
My thought: time average the input. Don’t look at a single momentary reading, just the average over the last 5 minutes (or whatever time period works best for you). That should eliminate the spikes that are fouling up your reading.
As Squink said, photoresistors are fairly slow to react. Also, even though you can cut power to your light fairly quickly, it won’t stop emitting light immediately. How long it continues to emit light depends on what type of light you are using. You may need to rather noticeably interrupt your light source for this to work reliably.
Ambient light generally doesn’t change too quickly. I think what you need here isn’t speed, but instead I think you need a second photoresistor just to detect the ambient light. Can you orient a second photoresistor so that it catches the ambient light without picking up the light you are trying to measure (or any reflections of it off of nearby walls or objects)?
What about a photovoltaic cell? Reason I suggest this is that I saw a prototype anti-collision device for light planes a number of years ago, and surprisingly, it used an array of small solar cells (yes) as the detectors - it worked by detecting the flashing wing lights from other aircraft, in daylight (so it was reacting to very small, very rapid changes in incident light).
Thank you. Turning off the light for 2/10th’s of a second or so and recalibrating will definitely work for my application.
My first thought of how to solve this was also another photoresistor. Unfortunately this proved to be ineffective because small changes in the background lighting skew my reading and a photoresist or oriented away from the light I need to detect won’t pick this up. For example, someone with a white shirt walks by and the amount of light received is increased.
I would love to use something more elaborate than photoresistors, but they are the only thing I have laying around. This is one of those projects that I’m building just because the idea hit me and no other reason. Photoresistors are the only thing I have that will detect light. I would most likely lose interest by the time I ordered a photo-diode or a photovoltaic cell and waited for it to arrive.
Anyway, thanks for the answers and suggestions everyone. I’m going to reprogram to shut the light down for about 1/4 second, long enough for the light to completely stop emitting and the photo-resistor to adjust.
Hmm. In a former life, I became a hero when I fixed a problem in a circuit using these because they were responding to 120Hz ripple from the ambient florescent lighting. I’d say the response time constant is a few milliseconds, not hundreds.
If you’ve got any of those old transistors that are in a little glass capsule covered by a metal can (they look like the OC201 on thispage), you can often pop off the can and they will be very responsive to light
Alternatively, any transistor in a metal can will do the same, if you very carefully cut the top of the can off with a junior hacksaw.
If you want to detect a specific light source while minimizing noise and interference from extraneous sources, the best approach is to modulate the light source, and design the receiver to detect the modulation. Sort of like a lock-in amplifier. There are *many *modulation techniques. I would need more info to provide a recommendation.