/Projects/Automatic headlight sensor mod for Audi A3 8P

If you ever wanted to have your car headlights turned on after entering the tunnel and turned off upon exiting - this is a DIY project for you. The wiring is for Audi A3 8P but with slight modifications it could be connected to other vehicles as well.

Buy it on Tindie

Schematics and source code are available for download by clicking on the red download button after the article content.


The vehicle electronics (Bordnetz) does not see this device as anything added to the car, it will remain thinking that there is just an original switch connected there, but you will actually have the same functionality that comes with cars that already have this sensor installed in the factory, except for the automatic wipers as the original sensor also has this functionality. Originally fitted sensors are located above the rear-view mirror on a special mount that is hard to retrofit without installing different windshield as well, so this DIY project makes sense if you need your headlights automatically controlled by intensity of ambient lighting. Vehicles with factory fitted light sensors also have a different light switch that has an AUTO position. In this project we don't want to change the original switch we currently have but we still somehow want that AUTO position as well. This was actually done in firmware.

original audi lightswitch
Original light switch with no light-sensor (left) vs original light switch with factory sensor and AUTO position (right)

Having lights turned ON at all times?
Some states require headlights to be turned ON all the times (night and day) while vehicle is driving, like the place where I live, and it might seem that this mod is useless in these cases. For this reason I had my car programmed using VCDS to have the headlights turned on at 70 percent intensity at all times with rear parking lights turned OFF. This saves some power and gas and also prolongs the life of rear parking light bulbs and licence plate bulbs. The intensity of 70 percent is the minimum that halogen bulbs require in order to re-generate after being turned OFF and anything below 70 will actually shorten their life (I also read somewhere that this is 80 percent so I can not guarantee). With this dimmed setup when I turn the lights ON manually, the headlights intensity goes up to 100 percent and also turns ON the rear parking lights as well as the licence plate lights. The same thing happens when this device turns them ON when I enter the tunnel, garrage or when the night falls.

The device is very simple, it consists of PIC microcontroller, LDR CdS cell, a very low current SPDT relay, power regulator IC, some diodes and some passives. Basic idea is to somehow override manual switch with this tiny relay without making car electronics believe that something has been retrofitted.


The device powers itself from the original installation and consumes just a few mA which is perfect, because we do not want to damage the car electronics by consuming too much current from the installation of the light switch. It sits between the car electronics and existing light switch and because of that I had to make an adapter cable to avoid damaging existing car installation. It turned out that a simple male+female pin header with some wire was enough to create this adapter.


As already mentioned we also need that AUTO position to sometimes turn these automatic headlights OFF. I did this in firmware and now when I want to enable/disable the device I simply start the car and then I have 15 seconds to manually turn the lights ON/OFF 5 times. This procedure will enable/disable (toggle) the virtual AUTO position and confirm that by blinking the headlights 5 times (for enabled) or 2 times (for disabled). The current enabled/disabled state is saved in EEPROM for next startup.
Lights will turn ON when CdS cell detects the darkness for at least ~1.5 seconds. They will turn OFF when the CdS detects illumination for at least ~10 seconds. This filter prevents lights from turning OFF while drigin under strong street lights.
Setting the turn-on point is done with trimmer resistor and LED is there to show whether PIC microcontroller detected the brightness or darkness.
All device features are explained in the video (enable subtitles!), and can be figured out by looking at the schematics and the code.




Author (sent by): Trax

Download counter: 302

Rating: (2.91, votes 931)


Date: 13-04-2018

Lokalna verzija ove stranice: Automatsko svjetlo za Audi A3 8P

870_audi a3 headlight switch mod.zip

Bookmark and Share Comments (4)

comment [4]

Trenutno nemam, ali mozda napravi 10tak komada i stavim na prodaju. Koja bi vam realno cijena odgovarala za ovaj jedan uredjaj, da preracunam isplati li mi se raditi ili ne.

comment [3]

Da li imate ovakav uređaj za prodaju, treba mi za Audi A3 8P?

comment [2]

Great work, but I can't see any code nor details :-) Maybe you are still working on it?
IP: n/a

comment [1]

I'm following your great DIY. This is with Arduino. http://fritzing.org/projects/audi-a3-8pa-automatic-day-light-sensor-dlr. I will share the arduino code also, need to solder PCB first and fine tune.

Comment page:

add comment


e-mail (will not be published)


How much is = also add letter "a" at the end of your result! Eg.: 7a

Please log-in!

You can log-in on forum link: Login page. After logging-in, return to this page and click refresh in your browser.

site friends

sponsored links