PDA

View Full Version : Automatic Headlights!!!



turbokinetic
04-13-2009, 05:16 AM
Just got through with an automatic lights system install on my 84 Century.

I got tired of accidentally leaving the dome light on, and having a dead battery; so I built and installed a lights controller that will prevent that.

It has a light sensor (hidden in the defroster vent) that the controller uses to determine if it is dark enough for lights.

Here is the operational description of the controller. I wrote the program for this controller about 2 years ago and have built 4 of them. Mom's car has one, my 86 T-Type has one, my service truck had one, and now my Olympia has one.

It took 865 lines of PBP program code to make this work glitch and error free. I do like creating programs because it is challenging to make it work exactly right!

Later,
David

------------
Automotive Lighting Control Module
v.4.1

Controls vehicle lighting systems based on various inputs and stored variables.

Operation:

Headlights:
Turn ON parking lights switch and headlights switch at the same time and headlights will come on regardless of light level or ignition switch position.
Leave Headlights Switch ON (w/o parking lights switch ON- requires switch modification) for automatic headlights mode.
Headlights and parking lights come on with ignition ON and light level below set point. (See Mode 1 to set)
When ignition is turned OFF while in Auto mode, the Reverse lights turn ON, and the headlights stay ON for a set amount of time after turning OFF ignition. (See Mode 2 to set time) This is to provide light while walking to your house, either way the car is parked.

Remote Control of Headlights using Keyless:
These functions work regardless of light level sensor reading.
With ignition OFF, press LOCK or UNLOCK and immediately repeat UNLOCK to turn ON headlights and rear lights using Keyless Entry.
With ignition OFF, press LOCK or UNLOCK and immediately repeat LOCK to turn OFF exterior lights before the time has expired and they have turned off automatically.
With 4 button remote keyless, pressing OPTION will toggle on or off the headlights.

Dome Light:
Open door or turn ON manual dome switch and Dome Light comes on. Light will stay ON until the safety timer turns it off to save the battery. (see mode 4 to set time) If ignition ON it will stay on indefinately.
The following actions will turn on the Dome Light for a short period of time: (See Mode 3 to set time) .
Open and then Close the car door.
Turn OFF ignition (if this option is active. See mode 7)
UNLOCK door (if this option is active. See mode 8)

The following actions will turn OFF the Dome Light:
Turn manual Dome Switch ON and back OFF.
Turn ON ignition. (if this option is active: See Mode 7)
Press LOCK on Keyless Entry (if this option is active: See Mode 8)

If the light level is not dark enough, the Manual Dome Switch is the only way to turn ON the dome light. See Mode 1 to set this level.

Dome Light Lock-Out. Turn Dome Light Switch ON-OFF-ON rapidly, and leave ON. Dome Light will go off and not come on again until Lock Out is cleared by turning off the Manual Dome Switch. This will prevent the dome light from turning on for any reason such as keeping out of view while exiting car after dark.

Parking Lights:
The Parking Lights operate whenever the Manual Parking Light switch is ON. They operate whenever the Automatic Headlights are ON.
They flash to indicate reception of signals from the Keyless Entry system. LOCK (1 flash), UNLOCK (2 flashes), and TR (3 flashes).
They flash once whenever Setup Switch is pressed.

Soft-ON/ Soft-OFF:
The dome light control is equipped with a PWM driver that lets the light start dim and build up to full brightness. The rate at which the light builds up can be adjusted. The rate at which it dims down can be adjusted sepatately. See modes 5 and 6.
The Power Darlington Switch is designed for intermittent use during the Soft-OFF and Soft-ON transitions. It has no heat sink. Once the lights are at full power, the Dome Bypass Relay closes and carries the load. The Power Darlington Switch turns off to prevent overheating. See connection diagram.

Light Sensor.
The controller uses a LDR (light dependant resistor) mounted in the defroster vent, exposed to the outside light through the windsheild. This is to determine the ambient light level. This sensor is active at all times the ignition is ON, as well as whenever any switches are changed, calling for a logic decision that is based on light level.

Module Status LEDs.

The Status LED on the board will flash rapidly after initial power-up for about 10 seconds. After this time the unit is ready.
When the ignition is ON, the LED will light whenever the ambient light level is below the setting stored in the module’s memory. Helpful for diagnosing system issues.
The Output Status LEDs illuminate when the CPU is activating any output. They are in a cluster near the output drivers.

Setup/ Operating Modes:

Press Setup Switch to advance modes. Lock and Unlock switches adjust the Setup Variables. Advancing from Mode 8 to Mode 0 (normal operation) saves changes to EEPROM.

Mode 0- Normal Operation: System operates normally. Variables are not altered. LED in module will turn ON when light level drops below threshold value (only if ignition is ON). Small blips of light about 4 times a second indicate normal operation with ignition off, or with ignition ON and a high light level.

Mode 1- Light Level: Press Setup Switch once. Parking Lights will flash once. LED in module will flash code 1. Press Setup Switch again to advance modes without altering existing value.
Press LOCK switch to save the current ambient light level as the Threshold Level below which the automatic functions will activate. When the daylight level reaches the point where you want headlights, enter Mode 1 and press LOCK.

Mode 2- Headlights Delay: Press Setup Switch again. Parking lights will flash. LED will flash code 2. Press Setup Switch to advance modes without altering existing value. Otherwise, press LOCK to erase old Delay setting and set it to 10 seconds. Each additional press of LOCK adds another 10 seconds. (10 to 300 sec range)

Mode 3- Dome Light Delay: Press Setup Switch again. Parking lights will flash. LED will flash code 3. Press Setup Switch to advance modes without altering existing value. Otherwise, press LOCK to erase old Delay setting and set it to 10 seconds. Each additional press of LOCK adds another 10 seconds. (10 to 300 sec range)

Mode 4- Dome Light Safety Timer: Press Setup Switch again. Parking lights will flash. LED will flash code 4. Press Setup Switch to advance modes without altering existing value . Otherwise, press LOCK to erase old Delay setting and set it to 1 minute. Each additional press of LOCK adds another minute. (1 to 15 min range)

Mode 5- Soft-ON Delta Rate: Press Setup Switch again. Parking lights will flash. LED will flash code 5. Press Setup Switch to advance modes without altering existing setting. Otherwise, press LOCK to increase the speed at which the Dome Light turns ON. Press UNLOCK to decrease this speed. There are 10 steps to this setting. Each press changes the value one step. You can operate the manual Dome Switch to view the new setting before changing modes.

Mode 6- Soft-OFF Delta Rate: Press Setup Switch again. Parking lights will flash. LED will flash code 6. Press Setup Switch to advance modes without altering existing setting. Otherwise, press LOCK to increase the speed at which the Dome Light turns OFF. Press UNLOCK to decrease this speed. There are 10 steps to this setting. Each press changes the value one step. You can operate the manual Dome Switch to view the new setting before changing modes.

Mode 7- Ignition Controlled Dome Light: Press Setup Switch again. Parking lights will flash. LED will flash code 7. Press Setup Switch to advance modes without altering existing setting. Otherwise, press LOCK to turn ON this setting; or UNLOCK to turn it off. With this setitng ON, the dome light will turn ON when ignition is turned OFF. And OFF when the ignition is turned ON.

Mode 8- Lock Controlled Dome Light: Press Setup Switch again. Parking lights will flash. LED will flash code 8. Press Setup Switch to advance modes without altering existing setting. Otherwise, press LOCK to turn ON this setting; or UNLOCK to turn it off. With this setting ON, the dome light will turn ON when doors are UNLOCKED and OFF when they are LOCKED.

Press Setup Switch again to SAVE the CHANGES and return to Normal Operation. If you don’t advance to Mode 0 after changing settings, the controller will revert to the old settings next time battery power is lost.

Cutlass
04-13-2009, 02:07 PM
Dude that's sweet.

turbokinetic
04-13-2009, 03:09 PM
Dude that's sweet.

Thanks!

I tried to re-create the way the new cars auto lights work, plus added the remote function.

After learning to write programs, I notice errors in other programs alot! For instance, the remote keyless receiver has a bug. If you press the Trunk Release button and let go of the button before the trunk opens, the doors unlock. Go figure!

Later,
David

white89euro
04-22-2009, 03:55 AM
Nice work David!

My '87 Century has automatic headlights from the factory. Just wondering if any of the cars you mentioned came with such headlights as well. Also, could you tell us more about the equipment or parts you used, and how the programing was accomplished?

Thanks!

George

RIPBARNBURNER
04-22-2009, 12:36 PM
sweet mod! good job

turbokinetic
04-23-2009, 01:54 AM
Glad you guys like my headlight mod.

These cars could have come with Twilight Sentinel, but I am not sure what years. I know the H cars could have it.

The programming was done in PBP, which is a programming language adapted from BASIC. Same language I used to program the air chocks controller.

The programmable integrated circuit chip does all the work. Once you have written and compiled the program on the notebook computer, you send it into the PIC chip's flash memory, and then the PIC does what it is programmed to do.

See http://www.melabs.com for more info.

I had to disconnect all the door pin switches from the dome lights circuit, and route them to the PIC controller. That allows the controller to turn off the lights even though the doors stay open.

If you are curious, this text file (http://68.209.87.173/Temp/LCM_4i2.txt) is the actual source code for the lights controller.

I have adapted the code for several other applications, so there are sections of code with the ' character in front of it, which "comments out" that line of code.

The code looks kind of complicated, because it has to do more than one thing at once, and must continue to respond to inputs even though the program is actively doing other functions.

Later,
David

eurosport84
04-25-2009, 02:28 AM
Very impressive!

bubblebob88
04-25-2009, 02:30 PM
You never stop amazing us! Very cool mod!

SilentWing
04-25-2009, 11:30 PM
Now if you could only program something that stops the solenoids in my door from drawing power when the door is open I'll be set....

Last year I somehow managed to leave my door open overnight in the garage... coulda sworn I closed it but lo and behold I went to leave for work the next day and it was open.... outside of that I'm not worried about my dome lights now that they and my map lights are LED. Took out took out the lights that shine on the floor because I don't have a need for them.

If you ever do find out a way to defeat the door solenoid I'd be highly interested in any tips you could give.