# A circuit to fade-in and -out LEDs (DRLs) only when the car engine is running?

I would like to make a small hobby project to implement in my car. However, I would like to ask here as I do not have much experience with electronics.

Let's suppose that I have a switch which should turn on or off the daytime running lights (DRL) of the vehicle. These are separately installed and are consuming ~0,8 A from the battery (14,4 V when charged).

I would like to achieve the following effect (we assume that the ignition is turned on):

• when I close the switch and the engine is not running, the DRLs are off;
• when I close the switch and the engine is running, the DRLs are gradually turned on (fade-in for about 5 seconds (configurable));
• when I open the switch or the engine stops running, the DRLs are gradually turned off (fade-out for about 5 seconds (configurable)).

To me, it should be something like this:

simulate this circuit – Schematic created using CircuitLab

I think the schematic can get information whether the engine is running via:

• a voltage comparator - preferable, as it should be simple enough. If the car battery voltage V1 is above a certain (configurable) threshold, e.g., 13,3 V, then turn the rest of the schematic on;
• an inductive tachometer - shall be a bit harder and comprehensive to install.

Perhaps a time delay relay may also be used, but would not be very suitable as it wouldn't detect the engine stopping.

As possible solutions for the fade-in/fade-out effect, I though of a BJT with a RC (integrating) circuit to set the time constant. Nevertheless, perhaps the losses would be lower if a (MOS)FET is used because of the ~10W LEDs. I also read that a 555 in monostable mode would be suitable.

It is important that the transistor is positioned "high-side", i.e., it opens or closes the 12 V supply to the DRLs. Their negative pole is connected to ground (chassis) and the positive is currently fed through the simple on-off switch SW1.

Preferably, the solution should be as simple and inexpensive as possible, i.e., no Arduinos or microcontrollers if feasible :)

• Fading LED DRLs will be a LOT harder than you expect. LEDs are not lamps. They typically have a control circuit that regulates the current delivered to the LEDs over a wide range of bus voltages. Although this may be possible, there is also a good chance you will blow up the LED driver, especially if you "do not have much experience with electronics". – Trevor_G Apr 6 '17 at 16:02
• You can consider aftermarket DRL with light sensors but some cars today sense bulb failures and you need a better understanding of ALL functions to do this. Automatic switch in car? Twilight ON what if your headlight switch is off when running at night? – Sunnyskyguy EE75 Apr 6 '17 at 16:28
• @Trevor I don't know of many led circuits that will blow from pwm... – Passerby Apr 6 '17 at 16:48
• Why do you need to tell if the engine is running as opposed to simply the car being on? – Passerby Apr 6 '17 at 16:49
• @Trevor, the schematic of the DRLs I use can be found here: pdf; image (source, but it's in Bulgarian). Let's say that I have around 10 years of hobby-grade experience with electronics :) As you can see, the DRLs have a current generator. I do not use the "OFF" pin. The DRLs are hooked to the TFL (DRL) pin on the headlight switch on my 1999 Skoda Octavia Mk1 (very similar to a VW Golf MkIV). – ndandanov Apr 6 '17 at 18:26

Just an extended comment. EDIT Now here's my solution

"Drivers in Bulgaria must switch their car lights on from 1st November. According to the Traffic Act in Bulgaria, all drivers must put their vehicle's lights on whilst driving at any time, including daylight hours. This applies from 1 November to the 1 March 2010.Failure to have your lights on will result in a fine."

DRL's are mandatory here in Canada for many decades. Not so in the USA!

I read if you want to avoid fines from Bulgarian police you must go to CCI to have a certificate for approved DRL's. Yet for your location, DRL's are illegal at night, I think because too many LED chinese DRL's are very high glare. So I see you are trying to make it legal, yet diffusing the lens can avoid the glare by spreading out the Lumens to reduce intensity causing glare.

My understanding from reading some comments is your 1999 model car does DRL/TFL but does NOT have ability to detect other lights ON and DRL lights cannot be on at night under any condition or if any other headlamps/ park or fog lamps are on.

• when I close the switch and the engine is not running, the DRLs are off;
• when I close the switch and the engine is running, the DRLs are gradually turned on (fade-in for about 5 seconds (configurable));
• when I open the switch or the engine stops running, the DRLs are gradually turned off (fade-out for about 5 seconds (configurable)).

For Ignition On = 1, Engine on=1, Nite(time) = 1 , HL,headlamp On=1, Park Lamp , PL ON=1, (Output) DTL ON=1, slow ON=1+, Off=0, slow off =0+ , TFL signal =0 , 1

Let me try a Truth table if I understand correctly, otherwise copy and fix I am not sure how TFL signal works ( does it detect daylight? or dark ?)

IGN  ENG Nite HL  PkL DTL TFL
0    x    x   x   x   0   0
1    0    x   x   x   0   ?
1    1    0   x   x   1   ?
1    1    1   1   x   0+  ?
1    1    1   x   1   0+  ?   (parked)
1    1    1   0   0   1+  ?   (parked)


As I understand it, you want configurable slow ON/OFF DTR and disabled by Engine OFF sensor. Is that it? Analog or uC digital ? Make or buy?

• The headlight on and daytime off is simple enough with the normally closed part part of a relay. – Passerby Apr 6 '17 at 20:22
• and engine Off to AUX position relay,, configurable delay ON OFF no so simple., fixed ramp easy. I try never to suggest a design until ALL requirements are clear. – Sunnyskyguy EE75 Apr 6 '17 at 20:25
• @Tony, the DRLs have actually been required in every season for the past few years now. The laws are currently not clear, so it turns out that approval by the CCI is not required in order to have the DRLs legal. My goal now is not to diffuse the lens but rather to add aesthetics (and perhaps - longevity) by gradually switching the DRLs on and off. So, yes, configurable slow ON/OFF DRL and disabled by Engine OFF sensor. Analog is preferable. Make. The headlight switch on the Octavia takes care when to switch on or off the DRLs. In the schematic, consider it as the source V1. – ndandanov Apr 6 '17 at 20:42
• Analog slow ramp MAY burn out MOSFET, so PWM half bridge is needed that slews 0 to 100% or 100% to 0% in series is needed with variable ramp . I think reliability issues on those LEDs are lack of good heatsink, and not waterproof, so to reduce temp rise , I would reduce brightness and pull off 1 of the 3.6 Ohm resistors. and they will last more than twice as long. 50% drop for every 10'C rise in temp aging rate is common. Esthetic dimmer is possible external with SMPS type or PWM type but not handy. – Sunnyskyguy EE75 Apr 6 '17 at 20:51

Fairly simple to do. From the brutal force approach of varying dc to more advanced approach of utilizing a mcu.

My favorite approach, however is not as widely used. General to pulse train, one at frequency f and another at frequency f plus delta. At the rising edge, flip the led. Essentially it is the off beat concept that hams use.

If implemented with discrete parts, the two pulses train are of identical dc but out of phase.

It easier to implement this on a mcu, like an 8pdip attiny . keep a timer running. Set up two output compare channels, delta tick apart. In the isrs, flip the same output pin or pins where the led is attached too.

You can also figure in gamma correction as well. But the basic gist is the same.