Distinguishing sunlight from artificial light?

What is the best/easiest way to distinguish artificial light from sunlight? UV photoresistors? IR sensor? I'd like to keep my project from activating when cars pass it by.

UV light level sensor, if you must use a sensor.... You can get em on eBay.

But wouldn't it make more sense to base it on how long it had seen light for?

You might even be able to do it with just the intensity of the light, particularly with careful placement of the light sensor

In the future I want to make an auto on/off feature for my headlights, it'd be mildly annoying if every car that came my way turned off my headlights.

2 birds.

Intensity should work. I'd try that first. The sun is thousands of times brighter than headlights or streetlights, even when it's cloudy or overcast.

And yes, use some delay/timing so a "flash" of light or a short-term shadow doesn't trigger the state. And, don't aim the sensor straight-ahead. Aim it toward the sky.

And of course, for safety and reliability include a manual "on" switch which totally bypasses the automatic electronics with a relay. (Maybe a 3-way on-off-auto switch.)

My car uses several sensors. It turns the lights on when the overall light level is low. It also turns the lights on when most light is coming from low down, such as from headlights and when the sun is low and might dazzle other drivers. There is a delay but it is quite short, about one second, so that the lights come on when entering a tunnel.

Russell.

The present fashion for automatically switching headlights is a nuisance and hazard to other road users.

The concept that it is somehow "safer" to dazzle oncoming drivers when lights are not necessary, making conditions more like night than daylight, beggars the imagination. :roll_eyes:

My observations with the 3 cars I have had with automatic headlights is that the sensor seems to be weighted to the blue end of the spectrum (maybe into UV).
I can be driving in bright sunshine near dawn/dusk and the headlights can be on. I can be driving around mid day in heavy cloud/rain and they don't come on.

In the days of incandescent bulbs it was easy, far more blue in sunlight...
With LEDs and fluorescent bulbs its much harder - you really want the
complete spectrum (LED lighting has sharpish blue peak and broad yellow one,
fluorescent has several sharp peaks all across the spectrum. Tungsten
is a smooth curve spectrum - thermal)

I think that if you pointed the sensor at the ground and adjusted it's sensitivity you could get it on during the day, and off at night, without having to worry about them going off with head lights.

colour temperature is the only thing i can think of.
Sunlight has a colour temp of about 6200 deg kelvin.

Filters can be had that can be selective to wavelength.

Edit

Dichoric filters can be a bit pricey though

Wow, lots of suggestions here. Here is my 2cents worth:
Aim the sensor toward the sky (straight up).
have a 1 second delay to turn on the lights, have a 20 second delay to turn off the lights.

Enough said!

A long time ago I saw a suggestion to aim the sensor into the footwell of your car. That is never illuminated by headlights or streetlights and any daylight will have a much higher intensity that is easily detected.