!!!!!THIS CIRCUIT NOT TO BE USED ON VEHICLES WITH MANUAL TRANSMISSION!!!!!!
This project details the use of RF modules, decoder/encoder, and a PIC to control an automobile remotely for keyless entry, alarm system, and keyless startup. The basic circuit is moderate in its' difficulty and requires some light knowledge of auto electrical systems. The code is simplified to help gain a better working knowledge of the circuit so don't persecute me because my code is redundant. The circuit operation is as follows.
Locking/Unlocking and Alarm:
The key chain transmitter has four buttons on
it. Two of the buttons are for lock and unlock of keyless entry system.
These two buttons are used for both actuating the door lock servos/motors and
also to arm or disarm the alarm system. When the lock button is pressed
the RF transmitter sends a digital signal that is generated by the encoder, on the receiving
end, the receiver takes this signal and sends it to the decoder which in turn
decodes it and drives the specified pin high for as long as the button is
being pressed on the key chain remote. The PIC sees this signal from the
decoder and takes two actions. First action is to apply a ground and a power
to the H Bridge for 250ms which operates the door lock actuators. The
second action is to arm the alarm system and begin monitoring the pin that the
door, trunk, hood, and motion/bump switches are attached to and activate the siren if
they are triggered (in this schematic the alarm takes power and ground from the vehicle
and requires only a small signal voltage to activate it, yours may be different,
be sure to use relays and power transistors when needed). When the Unlock
button is pressed the decoder applies power to the specified pin for as long as
the button is being pressed on the key chain remote. The PIC sees this
signal from the decoder and takes two actions. First action is to disarm
the alarm function and stop monitoring the door, trunk, hood, and motion/bump
switches. The second action is to apply a power and ground to the H bridge
for 250ms to open the door locks. Another feature that could be added to
this project since 3 I/O lines on the PIC remain unused, would be a blinking LED
to signal alarm status i.e. armed, disarmed, triggered.

Keyless Start:
The remaining two buttons on the key chain transmitter are used to start and kill the vehicles engine. **NOTE** THIS CIRCUIT NOT TO BE USED ON VEHICLES WITH MANUAL TRANSMISSION** When the start button is pressed on the key chain remote, as described above, the encoder and decoder work together to provide a signal to the PIC indicating the requested action. The PIC must see the crank signal for at least 2 seconds before it responds by checking to see if ignition power is already present. This is done to prevent accidental start once the vehicle is already running (This would be done better by monitoring coil negative terminal or engine speed sensor via the 'count' or frequency in' commands in PICBasic PRO). Then the PIC will provide power to the vehicles position 2 terminal (via a power transistor and relay) on the ignition switch. The 'position 2 terminal' refers to the wire or wires on the ignition switch that power the vehicles fuel and ignition systems when the key is it's normal 'run' position. At this point the PIC applies power to the starter motor going first through the neutral safety switch. This is done to keep the vehicle from accidentally being started while in gear and "sending your Chevy into your living room", to quote Bruce. The PIC keeps power to the starter motor until the specified time has elapsed (in this example 650ms). The time required to start the vehicle will vary from car to car so a better way to accomplish this is to use software that has a 'frequency in' instruction and can determine the engine speed by either monitoring the coil negative terminal or the engine's crankshaft sensor. Once the PIC has determined that the engine has exceeded it's normal cranking speed (in this example 600 RPM) then it can disengage the starter motor and the vehicle will run normally. The PIC will kill the engine by removing the power to the vehicles position 2 terminal if the brake pedal is depressed. This is done for two reasons: first, if someone was to break into the vehicle and try to steal it they would have to depress the brake pedal to engage the shift interlock solenoid to put the vehicle into gear, by doing so without the key in the ignition the vehicle will die. second, once you enter the vehicle and insert the key into position 2 the vehicle is now capable of running under it's own power, the keyless start system will disengaged once you depress the brake and put the vehicle into gear. The alarm function is disabled during keyless start since vibrations from engine startup and run could trigger the motion/bump sensors.
The 'kill' button on the key chain remote disengages the keyless start system in the same way that depressing the brake pedal does.
*NOTE* In this example the switches used to trigger alarm function and engine kill are taken on the ground side of the switches. If in your application the switches control the power side of the circuit instead of the ground, merely pull the lines low through a pull down resistor and reverse the code inside your PIC. In automobile electronics it isn't typically necessary to use a pull-up/pull down resistor but I included them in the schematic to be used as needed.
PIC Code:
symbol trisb = 134
symbol trisa = 133
symbol portb = 6
symbol porta = 5
poke trisa, 0
poke porta, 0
'set all port a pins low
poke portb, 0
'set all port b output pins low
input 0
'input from brake switch
input 1
'input from door,trunk,hood,motion/bump switches
output 2
'starter motor output control
output 3
'ignition power output control
input 4
'input from decoder "unlock"
input 5
'input from decoder "lock"
input 6
'input from decoder "crank"
input 7
'input from decoder "kill"
low 2
'make sure starter motor is stopped
low3
'make sure ignition power is off
start:
B0 = 0
'clear all memory bytes B0 through B6
B1 = 0
B2 = 0
B3 = 0
B4 = 0
B5 = 0
B6 = 0
button 7,1,255,0,B0,1,unlock
'check for unlock command
button 6,1,255,0,B1,1,lock
'check for lock command
button 5,1,255,0,B2,1,crank
'check for crank command
button 4,1,255,0,B3,1,kill
'check for engine kill command
button 0,0,255,0,B4,1,kill
'monitor brake switch for engine kill
goto start
unlock:
poke porta,1
'drive lock actuators to unlock position for 250 ms
pause 250
poke porta,0
'stop driving lock actuators
goto start
lock:
poke porta,2
'drive lock actuators to lock position for 250 ms
pause 250
poke porta,0
'stop driving lock actuators
subroutine:
button 1,0,255,0,B5,1,alarm
'if entry switches triggered then sound siren
button 7,1,255,0,B0,1,unlock
'check for unlock command
button 5,1,255,0,B2,1,crank
'check for crank command
button 4,1,255,0,B3,1,kill
'check for engine kill command
button 0,0,255,0,B4,1,kill
'monitor brake switch for engine kill
goto subroutine
alarm:
poke porta,2
'drive lock actuators to unlock position for 250 ms
pause 250
'wait 250 ms
poke porta,4
'sound alarm and stop driving lock actuators
goto start
crank:
b2 = 0
'clear memory location B2
pause 2000
'wait 2 seconds
button 5,1,255,0,B2,0,start
'if crank command is not still requested then goto start
input 3
if pin3 = 1 then start
'if ignition is already on do not crank
high 3
'return pin 3 to an output and set high which...
'turns on ignition power
high 2
'turn on starter motor
pause 650
'wait for engine to fire
low 2
'turn off starter motor
goto start
kill:
low 2
'turn off starter (if engauged)
low 3
'turn off ignition power
goto start
end