Automatic parking lights+low beam(dipped lights) by night for my car

Hi, i want to use my arduino to control the main beam(daylight) and the low beam for my car using a photodiode
Currently i'l already using my arduino for many more functions and i already got a part of it already done.

What i'm currently thinking at is how to implement this function with as little intervention between the current circuit of the car. So the driver will be able to control the lights as usually but still have a switch for this

The car is controlling the light using 12v big relays on high side.
It will be easier to control those relays or to wire the lights to another relays(5v with, big amp rated)?
(I also control the front signal lights to dim them at 50% during daytime(like in USA) but using mosfets wired directly to the lights and everything works perfectly with no heat from the mosfet(p) or the control transistor)

Another question is how can i calibrate the sensor so it won't have a hotpoint where the lights will go like on off?

Do you think i'll need more then 1 photodiode?

Any other suggestions will help me a lot, any offtopic won't. :d

From the [Atmel 328 datasheet](http://Atmel products are not designed nor intended for use in automotive applications unless specifically).

"Atmel products are not designed nor intended for use in automotive applications unless specifically
designated by Atmel as automotive-grade."

For a safety item like headlights, I'd stay away from it. If it's off topic, so be it.

dougp:
From the [Atmel 328 datasheet](http://Atmel products are not designed nor intended for use in automotive applications unless specifically).

"Atmel products are not designed nor intended for use in automotive applications unless specifically
designated by Atmel as automotive-grade."

For a safety item like headlights, I'd stay away from it. If it's off topic, so be it.

It is offtopic :d but it can also be useful if you know why, just for my knowledge
This doesn't mean i won't do it. So i'm still waiting for answers/sugg. :d

EDIT:


I found this where i can find the 328p as a microcontroller for automotive

Whatever the suitability of the component ....There is nothing worse than driving at night and then the lights go out .
The resulting crash would probably not be covered by your insurance .

I wouldn't do it and on this basis I guess people are reluctant to advise .

Hi,
Do you see any car manufacturer advertising this feature?
Do you wonder why?

They are spending billions on an autonomous car, do they have auto low beam facility.

Are you one of these people who drive around on HIGH rather than LOW BEAM during the day?
I believe LOW BEAM in daylight is now essential, BUT NOT HIGH BEAM.

If you need this facility to be automated, then you need to forget about being a driver.

Tom... :slight_smile:
PS. This is not OFF TOPIC.

TomGeorge:
Hi,
Do you see any car manufacturer advertising this feature?
Do you wonder why?

They are spending billions on an autonomous car, do they have auto low beam facility.

Are you one of these people who drive around on HIGH rather than LOW BEAM during the day?
I believe LOW BEAM in daylight is now essential, BUT NOT HIGH BEAM.

If you need this facility to be automated, then you need to forget about being a driver.

Tom... :slight_smile:
PS. This is not OFF TOPIC.

My lack of knowledge in english can also lead to misunderstanding in this topic.
So to clarify this you need to understand what i'm thinking when i say:
1.main beam (those you turn on even on daylight)
2.low beam (those you turn on in the night)
3.high beam (those you turn on when you really need more light, and the road is clear)

Now i hope you know what i mean and correct me, because i didn't see any good representation of them on the google.

back to your post, i did not understand what are u trying to say, i don't want to automatize the high beams, only the main and low beams.

and to avoid bad reading situation like user hammy exampled i could do various solutions like:
1.using 2 photodiodes, with different positions,
2.sum the light in a time and do a average light when turning the headlight OFF, and a different time for average when turning on,
3.use a different arduino only for this job
4.calibrate my values same as a OEM function from a car that already have it.
5.and maybe many more that i'm looking for!

This is the kind of answers i'm waiting for: How to solve NOT how to avoid.

TomGeorge:
Hi,
Do you see any car manufacturer advertising this feature?
Do you wonder why?

Erm... I have one car that's 8 years old which automatically turns its headlights on at night. My mother has a car which also does the automatic high/low dipping and it's probably 5 years old.

Automatic high/low is a very hard problem. Even the latest cars still have problems if they see their own reflection in a shop window. So that's probably not feasible for an Arduino.

I think the safety aspects were already addressed:

prologikus:
implement this function with as little intervention between the current circuit of the car. So the driver will be able to control the lights as usually but still have a switch for this

I saw a design in an electronics magazine probably 20 years ago. As I remember it, the principle was to have a light sensor in the footwell of the car. That way it would not be fooled by street lights into thinking it was daytime. The difference between day and night is relatively easy to detect.

With an Arduino, you could have a delay so that it doesn't switch off immediately when the daylight condition is detected (passing car headlights) but does switch on as soon as dark is detected (driving into a tunnel.)

Wondering what OP really wants.
The normal light as used at night (and nowadays often during the day) is commonly called "dipped" (at least in UK English). The high beams are blinding and should only be used when the road ahead is clear.

If OP wants to switch their dipped lights automatically, that's quite easy and straightforward to do using a light sensor. The hard part here is make it absolutely reliable. Also nowadays in more and more places it's normal to have the dipped lights on during the day, which would make this whole switching moot.

If OP wants to switch their high beam (blinding light) that's a lot harder, as you need a camera and image processing to see whether there's any oncoming traffic. Light sensors won't do.

wvmarle:
Wondering what OP really wants.
The normal light as used at night (and nowadays often during the day) is commonly called "dipped" (at least in UK English). The high beams are blinding and should only be used when the road ahead is clear.

If OP wants to switch their dipped lights automatically, that's quite easy and straightforward to do using a light sensor. The hard part here is make it absolutely reliable. Also nowadays in more and more places it's normal to have the dipped lights on during the day, which would make this whole switching moot.

If OP wants to switch their high beam (blinding light) that's a lot harder, as you need a camera and image processing to see whether there's any oncoming traffic. Light sensors won't do.

To switch the so called dipped lights, and the" daylight beam" from the sunset light to the runrise light and only the daylight during the day.

As you say i need tips to make it rentable, to not be tricked by other car's lights or street lights as MorganS said.
I'm already thinking about some examples in post 5 and some questions in post 1

I saw oem modules for other cars who achieve this functions but i really don't understands why they cost so much... Are they using photodiodes or something else?

Hi,
I think you have two separate types of lighting.

Headlight HIGH,
Headlight LOW, beams for night driving.

Daylight RUNNING lights (DRL) that are separate, like AUDI and othe European cars have, they are usually the original Parker Lamps, tarted up by using LEDs and sculpting them around each light cluster.

Tom... :slight_smile:

TomGeorge:
Hi,
I think you have two separate types of lighting.

Headlight HIGH,
Headlight LOW, beams for night driving.

Daylight RUNNING lights (DRL) that are separate, like AUDI and othe European cars have, they are usually the original Parker Lamps, tarted up by using LEDs and sculpting them around each light cluster.

Daytime running lamp - Wikipedia

Tom... :slight_smile:

I don't know the difference between the us car lighting and the europa car lighting
I'm living in europe and my car lights switch looks like this:

In the top of the switch there are 3 states: off-daylight beams(how i call them)-low beam(there the daylight beams are turned on too

Street lights are so dim they're easy to ignore. You anyway have to switch on your lights well before it gets that low.

Lights from oncoming traffic are easy to block with a simple shade around your sensor, so it only receives light from above.

Commercial products cost a lot because of liability: manufacturers have to spend lots of time testing to get their product certified safe.

For you, it's mostly how much you care about other people's lives - which is to me also the most important. If you do something stupid that kills you I have a laugh and may put you up for a Darwin award (assuming you don't have children yet). If you hurt or even kill someone else due to you messing around with a basic safety feature of your car, that's a whole different story.

The hard part is to have something work one time, every time. Having a manual override (the normal light switch, switching the light on overriding whatever your system does) is a bare necessity as well. You may also consider designing it that it defaults to lights ON (so it has to actively switch the lights off). Having dipped headlights on during the day is no safety issue (it may improve safety even), having them accidentally go off at night is a much bigger issue.

wvmarle:
Street lights are so dim they're easy to ignore. You anyway have to switch on your lights well before it gets that low.

Lights from oncoming traffic are easy to block with a simple shade around your sensor, so it only receives light from above.

Commercial products cost a lot because of liability: manufacturers have to spend lots of time testing to get their product certified safe.

For you, it's mostly how much you care about other people's lives - which is to me also the most important. If you do something stupid that kills you I have a laugh and may put you up for a Darwin award (assuming you don't have children yet). If you hurt or even kill someone else due to you messing around with a basic safety feature of your car, that's a whole different story.

The hard part is to have something work one time, every time. Having a manual override (the normal light switch, switching the light on overriding whatever your system does) is a bare necessity as well. You may also consider designing it that it defaults to lights ON (so it has to actively switch the lights off). Having dipped headlights on during the day is no safety issue (it may improve safety even), having them accidentally go off at night is a much bigger issue.

You can see my switch in the prev post.
I'm thinking at using the position 0 + another diy switch to turn on the automatic lights.
Also, wiring up another 12v relay to the low beam to insert 12v into it(of course with a fuse)
This way i'm thinking if you want the lights to be on the you just turn the switch.

I'm also thinking at using a p mosfet so i can dim the lights slowly instead of turning them off instantly so the user can see and act if there is any bad reading.

But this way it can get really expensive since the mosfets need to be p channel and be able to handle a lot of amps

Hi,
What does your car owners manual say, looks like opel/astra from google search.
They refer to it as DRL, so they are glorified parking lamps, separate to your head lights.

As there are so many different light sources when you drive the road, interpreting what sort each one is will be the problem.

A number of light sensors, at different locations in the car, or a UV sensor detecting the Sun.
You would then need to check the amount of UV from the various types of street lights to avoid false readings.

Tom... :slight_smile:

prologikus:
But this way it can get really expensive since the mosfets need to be p channel and be able to handle a lot of amps

They're marginally more expensive than n-channel, still not really expensive. Maybe USD 1-2 a piece for a 20-30A, 60V in retail quantities, plus a bit for a heat sink.

wvmarle:
They're marginally more expensive than n-channel, still not really expensive. Maybe USD 1-2 a piece for a 20-30A, 60V in retail quantities, plus a bit for a heat sink.

Or maybe i can stack them in order to achieve lot of amps with less heat? Last time i used a p mosfet i drived it with a simple npn transistor because i did not find any cheap and good driver to work

Shouldn't be that much heat, a few W at full current.

wvmarle:
Shouldn't be that much heat, a few W at full current.

So you consider that using mosfet is better then relays in this scenario? :d
What do you think about irf5305pbf?

Specs look good.

MOSFET has the advantage of being able to dim (unless you have LED or other such type for headlights).

Relay has the advantage that you can simply switch the existing relay with your Arduino, less modification.

So... What is the best way of using(placing, etc) light resistors?

My main idea is to use 3 of them wired in parallel so i can have a average reading.
Placing them after the front inside mirror
One facing upwards with a little paper blocking the light from the front of the car.
One facing right and one facing left.
Maybe this way i'll get the lights from other cars and the street lights filtered a little bit.

Is this a good idea?