Interior light delay + keyless remote entry module

Or how to improve the car's user experience by adding what seems to be nowdays straightforward technologies…

Why?

It has all begun when the interior light delay module of my Chevrolet Malibu Classic died.
I noticed that it wasn't working good for some time: the interior light stayed ON all night a few times, or also stayed OFF when I opened the door the morning a few other times…

After some research I found out the part is GM #463498, but damn it costs a fortune!
$59.95 + $33.74 for shipping to France, $93.69 for delayed interior light, no way!

I opened the part to see if I can see obvious damaged components, but nothing except for the TO-220 shaped transistor that become VERY hot when the module is plugged (burn your finger to the touch). After some research on the web, that's the part that usually fail and this reference isn't produced nor available for years now…

lightdelay_3.jpg

Arount the same time, a friend of mine gave me a non working remote keyless entry module with its two wireless remotes (three buttons: lock, unlock, trunk release) which I decided to use on my car if possible: the car have central locking and electric tailgate release, a keyless system would be a good improvment.

The main microcontroller on that kit was fried so impossible to use as is, but I managed to salvage the 433MHz RF receiver. Both remotes works fine as well, and there's a blue LED I can put on the dash to mimic an alarm (or at least have a visual Lock status).

lightdelay_18.jpg

So I decided to build from scratch a mix interior light delay + remote keyless entry module using both these non working parts, and some COTS (commercial off-the-shelf) I already had at home.

On the electronic side

The most convenient way is reusing the genuine interior light module board as it can be plugged directly to the car's wiring.

lightdelay_6.jpg

Regarding the wiring from the car:

  • A - Interior lights, high impedance (open circuit) to keep them OFF, ground to turn them ON. All current from all interior lights goes through this wire.
  • B - Ground.
  • C - Battery voltage, hot at all time through a 20A fuse, same fuse that the one for the interior lights.
  • D - Door push button signal, high impedance when both front doors closed, ground when one of the front door is opened.
  • E - Key battery signal, high impedance when ignition key is OFF, battery voltage when ignition key is ON (engine ON or OFF).

I also need to access other parts of the wiring for the remote keyless entry part of the module, such as:

  • Lock/Unlock signals, wired in parallel with the inputs of the car central locking on the right of the passenger's feet behind the carpet.
  • Trunk release signal, wired in parallel right after the Trunk release button in the glovebox.
  • Turn signal, wired in parallel right after the direction assembly outlet near the direction column. It provides directly the battery voltage to the front and rear turn bulbs without going through the blinker nor the direction assembly. The European wiring has plugged both front and rear bulbs of each side on the front outputs of the direction assembly: the rear outputs aren't plugged at all, which means I only need two turn signals, left and right.

lightdelay_17.jpg

The part list used for this module is the following:

  • The original light delay module with all components desoldered to be able to plug my own module easily to the car wiring,
  • A Pro micro module which is Arduino compatible for the logic part of my own module,
  • A DC/DC step down converter to have a 5v from the battery with no heat and a good efficiency when powering both the Arduino and the relay,
  • The salvaged 433MHz RF receiver (but would also work the same with a 433MHz receiver like this one with a quarter or half wavelength long (17.2cm or 34.4cm) wire as antenna),
  • The two remotes (same as these ones, but can work with any 433MHz remotes…),
  • The blue LED with its mount insert,
  • Two optocouplers (PC817) used to adapt the voltage for the door push button signal and the key battery signal,
  • A Pololu 5V relay module I planned to use on a previous project but never did,
  • Five SPST 5V Relays, enough to switch battery voltage for the Lock, Unlock, Trunk release, Turn signals left and right,
  • A driver circuit (ULN2003) which is the easiest way to manage the relays and the LED,
  • A few resistors (1k and 10k, 1/4W), some terminal connectors, two prototype PCBs, some wires, a soldering iron, tape, hot glue, Rilsan collars, nylon sheath, shrink sleeves…

All in all it costs me less than $20, the salvaged parts don't really cost much either. I used these parts mostly because I had them on hand: I didn't want to order specific parts for that.
Given the number of components to use, for practical reasons I chose to make two circuits linked by 6 wires.

lightdelay_15.jpg

The bottom part has the 5 inputs/outputs as the genuine interior light delay module and use the original circuit board, and the top part has only outputs to drive the remote keyless entry part of the module.

The two parts are separated by 35~40cm wires, so I can plug the bottom part where the original interior light delay module is plugged under the dash on the driver's side, and the top part under the dash behind the climate control unit which is harder to access and cleaner. I was careful to wire these five signals neatly (brazing with shrink sleeves, wires similar as the genuine ones…).

The blue LED is fixed on top center of the dash, near the windshield.

On the software side

The logic part uses two interdependent finite-state automatons running at the same time.

lightdelay_16.jpg

General rules:

  • Lx: Light automaton state,
  • Rx: Remote automaton state,
  • TL: Light automaton timer,
  • TR: Remote automaton timer,
  • Both automatons are assessed every 100ms (10Hz frequency) so a timer of 10 means 1 second,
  • The timer of the corresponding automaton is reset each time its state evolve,
  • Every inputs are retrieved once before assessing the two automatons (the logical inputs like the door and key sensors as well as the remote button pressed, if any),
  • Every outputs are set after both automatons have been assessed,
  • At any time, only one state of each automaton is active (the active state of one automaton can be used as condition for the other automaton, and one automaton car define the active state of the other automaton).

Inputs:

  • DOOR: both front doors are closed,
  • /DOOR: one (or both) of the front door is opened,
  • KEY: the ignition key is OFF,
  • /KEY: the ignition key is ON,
  • REMOTEL: the remote button Lock has been pressed,
  • REMOTEU: the remote button Unlock has been pressed,
  • REMOTET: the remote button Trunk release has been pressed.

Outputs:

  • LIGHT: interior lights are ON,
  • LED: the blue LED is ON,
  • TURNS: both sides of turn signals are ON,
  • LOCK: the lock signal of the car central locking is active,
  • UNLOCK: the unlock signal of the car central locking is active,
  • TRUNK: the trunk release signal is active,
  • When not specified, the output is OFF/inactive.

The Arduino must remain active at all time: no sleep or power down state. Otherwise it would be impossible to monitor efficiently for the remotes frames. The deactivation of all unused microcontroller modules on the chip allow the consumption to stay under 15mA (Arduino + RF module active) while “idling”. Every Keyless Kit in the shops have similar consumption (if not higher…).

Regarding the remote button state retrieval, I use the RCSwitch library for Arduino which allows to easily capture and process the 433MHz remote signals. The remotes I have uses an EV1527 IC encoder that sends 24bits long frames: 20bits are used only for address coding (1048576 unique combinations), and 4bits are used for data (in this case: button Lock is 1, button Unlock is 2 and button Trunk release is 4).

I have developed a way to save the address 20bits of a new remote in the EEPROM of the Arduino, by pressing one of the three buttons during the first 15 seconds after the Arduino boot. I limited the number of remotes to three (but it's a variable in the code: the 1KB EEPROM of the Arduino could save up to 340 codes). When 3 remotes are already saved, if a new one is learned it overwrite the oldest one.

Each 100ms, before assessing both automatons, a code check if a new remote code has been received. If it's the case it checks the length (24bits) and the protocol (EV1527 IC encoder is protocol 1). If it matches, It compares the 20bits address with the three remotes saved. And finally if it also matches It retrieves the data part to generate the REMOTEL/REMOTEU/REMOTET input signals.

The two state automatons work roughly as follow:

  • When you close the doors with the ignition OFF: the interior light goes ON for 30 seconds and then goes OFF if the light was previously ON, or stays OFF otherwise.
  • When you open one door with the ignition OFF: the interior light goes ON for a maximum of 10 minutes and then goes OFF (timeout to save the battery).
  • When you close the doors with the ignition ON: the interior light goes OFF.
  • When you open one door with the ignition ON: the interior light goes ON.
  • When you turn the ignition ON with both doors closed: the interior light goes OFF.
  • When you turn the ignition ON with at least one door open: the interior light goes ON.
  • When you turn the ignition OFF with both doors closed: the interior light goes ON for 15 seconds and then goes OFF.
  • When you turn the ignition OFF with at least one door open: the interior light goes ON for a maximum of 10 minutes and then goes OFF (timeout to save the battery).
  • When you unlock the car (with the remote): the interior light goes ON for 30 seconds and then goes OFF.
  • When you lock the car (with the remote): the interior light goes OFF.
  • When the car is locked: the LED flashes every 10 seconds (ON for 1% of the time), and the interior light is always OFF.
  • The Lock function consists in: activate Lock signals while short blinking twice the turn signals and the LED.
  • The Unlock function consists in: activate Unlock signals while long blinking once the turn signals and the LED.
  • The Trunk release function consists in: activate Trunk signals while short blinking once the turn signals and the LED.
  • The Lock function is only available when the car is unlocked (LED doesn't flash), both doors are closed and the ignition is OFF.
  • The Unlock function is only available when the car is locked (LED flashes).
  • The Trunk release function is only available when the ignition is OFF (prevent opening the trunk while driving).
  • To activate the Trunk release function: press the Trunk release button on the remote once and then press it a second time after 400ms and within a 1 second timeout, or keep the button pressed for more than 400ms. It prevents inadvertently opening the trunk.
  • When the car is locked (LED flashes) if one door is opened or if the ignition is turned ON, the Unlock function is executed.

The Arduino code is available here.

What about some pictures!

Finally the pictures, it doesn't look much (tape covering the circuit, lot of hot glue and Rilsan to keep everything in place…) but it works as intended.

lightdelay_8.jpg
lightdelay_9.jpg
lightdelay_10.jpg
lightdelay_11.jpg
lightdelay_12.jpg
lightdelay_13.jpg
lightdelay_14.jpg