Car headlights autostart

I recently bought an old car with a major setback - the headlights do not start automatically.
I am used from the previous one to simply leave the light switch on and as soon as I start the ignition, the lights went on and shine.
So I was searching the internet for some hints. As usual - I found a Czech company that came with a device to do exactly as I needed - unfortunately, the company no longer operates on the market and the device is no longer in stock.
However, they had a short description - it's actually a relay, controlled by micro-controller. The micro-controller senses the voltage of the car mains and as soon as it jumps over 13V, the relay is switched and the headlights are on.
This gave me an idea - I know, that when engine is running, the voltage of the so-called "12V" is somewhere around 13.5V.
And, when the engine is off, the voltage is less than 12V, depending on the battery.
So I have an idea for a simple circuit - voltage regulator such as LP2950ACZ (5V, 100mA, 100uA iddle current), ATtiny45, voltage divider connected to pin 3, relay connected to pin 5 using 1kOhm resistor and simple NPN transistor). Of course, some diode to ensure correct polarity, fuse for the device, capacitors to survive the engine start and filtering, and so on.
I already tried the voltage measurement using the divider - I used quite high resistor values to minimize current usage - total of 1.47MOhm (1Mohm to 470kOhm).
I tested the measurements using TinyDebugSerial and I was surprised. Even when powering using 5.05V USB bus, the measurements are pretty solid and reliable. I went and tested the internal reference voltage to test auto-sensing of VCC, but that turned to be not so exact and from my perspective useless - the voltage regulator does pretty good job making 5V.
Now I am looking into additional thing - I am running the device on 8MHz because of the TinyDebugSerial.
But, I'd like to utilize some powersaving - it's enough to measure the current twice per second.
I also think about scaling down the frequency using clock divider, but I heard it's not a good idea as the programming is disabled that way.
This is just a heads-up for anyone trying to achieve the same. I'll be posting the final code and schematics, including test video :wink:

The oil pressure switch will tell you when the engine is running, its only powered by the ignition circuit.
Connect a relay in circuit to turn the lights on when there is oil pressure and ignition power present.

How simpler can it be?

Tom........ :slight_smile:

Perhaps not so clever to sense the 13.5 volt or even the oil pressure to turn on the lights. If the engine stops or you lose charging the lights will go out.

Best to have a relay powered when the ignition is on.

Personally I dislike these systems, always a chance of losing both headlights should someting fail.

Maybe you can use a light sensor ,an led can be used to sense light , and you can use it to actuate the relay.

Sincire appology - for some reason I forgot to turn on the notification and I did not even noticed that someone answered.
Again, sorry.

I have to have something to turn the lights on automaticaly - already paid 60€ in fines for forgetting to turn them on :frowning:

I like the oil-pressure sensor idea, sounds reasonable and I can build it using simple circuit. Thanks.

You should use a combination of light sensing and oil pressure not just one thing to make sure its more accurate sensing behaviour.

There is always some fraction of accessories in the car that power is cut off to when the car is turned off/no key (like the radio). Just poke around in your fuse block and find one.