1.
Introduction
A “follow me home” function is often found in cars. It
makes the headlights shine for a certain time after the engine is shutdown.
This allows the driver to find his home, get the key in the lock etc.
This device is a retrofitted PCB and can be used in
any car.
This circuit is based around the PIC18F2550 microcontroller.
This chip is actually a small computer contained in a single chip, including
RAM memory, EEPROM, I/O ports, CPU and
so on. When you buy this chip, it comes empty with no program on it. You have
to compile the source code and download the resulting machine code into it, using a PC and a small
programmer attached to the PC and the chip. To get yourself familiar with this
stuff, I suggest you first read this link: Getting started with microcontrollers.
2.
Description
The properties of the device:
- zero
standby power usage
- one-button
operation, LED illuminated pushbutton
- time
is adjustable from 30 seconds to 4 minutes in 8 steps
- each
step is visible by means of the dim level of the LED
- when
time is going, LED shows progress by means of reducing dim level
3.
Usage
The device is operated with a single pushbutton. It
will only work when the engine is shut down.
Press the pushbutton once to turn the headlights on
for 30 seconds. The LED will illuminate very little. Press again to add 30
seconds. The LED will illuminate a little bit more.
The headlights will go off after the selected time.
If you want the headlights to go off before that time,
keep the button pressed for 2 seconds.
4.
Connection
Colors of the wiring:
- LEFT
o Button:
§
Green: common
for LED cathode and pushbutton
§
Yellow: LED
anode
§
Orange: pushbutton
- RIGHT
o
Interface:
§
Blue: ground
§
Purple: +
continuous
§
Grey: +
switched
§
White: OUT to
headlight relay
5.
Schematic
diagram
6.
Explanation of the schematic
diagram
(Refer to the schematic diagram).
PAD1 is continuous 12V, PAD2 is ground. These two PADs
are the power IN connection. When the contact is ON, power is interrupted and
the device will be in OFF mode.
When the pushbutton is pressed, relay K1 is grounded
on the left side. Since the right side is on +12V, it will activate. The
voltage regulator gets powered and provides +5V to the PIC. The PIC starts
running and will first activate relay K4 to continue the power provision. It
will then start timing for 30 seconds and activate relay K3, providing power to
the headlights.
When the user presses the pushbutton again, this will
be polled by the PIC by means of contacts 3 and 4 of relay K1. The PIC will add
30 seconds (max. 8 times) to its internal time counter.
When the time counter is 0 the PIC will release all
relays, thereby putting the headlights and itself off.
7.
The
printed circuit board
The pcb is designed for smd components.
It is double sided and designed with Eagle (from Cadsoft).
PDF file (top, mirrored) to print on a transparent: Print-layout
PDF file (bottom) to print on a transparent: Print-layout
Link to Eagle file brd file containing the PCB..
8.
Programming
The software is written in C (PIC
C18 from Microchip).
It was first prototyped on a Dwengo experimental board
(http://www.dwengo.org).
Since this board uses a PIC18F4550, I designed two projects: one for PIC
18F4550 and one for PIC
18F2550 (the final design). The first one also uses the Dwengo library to
show some debug messages on the Dwengo LCD, the second one does not need the
Dwengo library.
You do not need the Dwengo board and library to build
this project, just the Microchip
MPLAB IDE and a PICkit2 compatible programmer will do.
Zip file containing all source code, header files and
project files: Link to MPLAB projects
Connection to a PIC programmer.
Pad 5-6-7-8-9 must be (temporary) wired to a PIC
programmer (5=-, 6=+, 7=VPP, 8=clock, 9=data), e.g. a PICkIt2 compatible
programmer.
Home Back to Electronic
Projects