This is only a preview of the January 2010 issue of Silicon Chip. You can view 18 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "A Multi-Function GPS Car Computer, Pt.1":
Items relevant to "A Balanced Output Board for the Stereo DAC":
Items relevant to "Precision Temperature Logger & Controller, Pt.1":
Articles in this series:
Items relevant to "Voltage Interceptor For Cars With ECUs, Pt.2":
Items relevant to "Web Server In a Box, Pt.3":
Purchase a printed copy of this issue for $10.00. |
GPS
Pt.1: By Geoff Graham
Car Computer
This project was inspired by requests from a number of readers. Essentially
they said that the GPS module was great for obtaining a precise time . . . but
could we produce a project that used its full capabilities for use in a vehicle?
T
his is the result. It is small enough to sit on the dash also use graphic symbols.
The display uses a green LED backlight, with the brightor mount in the radio-sized (DIN) blank panels that
ness automatically changed between day and night settings,
many vehicles have.
It is also relatively simple to construct and uses just a which can be easily configured.
An USB interface allows you to plug the device into a
few active components on a single PC board with no other
wiring. There is no setup or calibration required – just plug laptop for a complete navigation experience with your position accurately pinpointed on a map. The USB interface also
it in and away you go!
allows you upload new firmware
It is designed for use in a
and re-program the device withmoving vehicle, where your atout any special hardware.
tention should not be distracted
GRAPHIC LCD
from the road for any longer
Block Diagram
than is necessary. Therefore
Fig.1 shows a block diagram
data, such as your speed, is disof the unit. The central item is
played in easily-readable 14mm
GPS
USB TO
MICROCONTROLLER
a 40-pin microcontroller which
high digits, while a button press
MODULE
LAPTOP
does most of the work, includwill show other data as needed.
ing receiving data from the GPS
You can also set it to autoLDR OR
module, driving the LCD and
matically step through the data
FUEL INJECTOR
HEADLIGHTS
communicating via USB.
screens for complete hands-off
THREE PUSHBUTTONS
The GPS module used is the
operation.
EM-408 which we have used in
A key component is the Fig.1: conceptually, the GPS Car Computer is quite
a number of previous projects.
graphic LCD which allowed a simple. The microcontroller takes data from the
Once every second this transmits
great deal of design flexibility. GPS module, monitors a number of external signals,
your current speed, position,
Three fonts are used ranging formats the data for display and sends it to the LCD.
from a jumbo font to a small While doing this it can also manage communications etc as a serial data stream to the
microcontroller.
detailed font, while some areas with your laptop via USB.
28 Silicon Chip
siliconchip.com.au
FEATURES:
When a complete set of data has
image is reversed in firmware and
been collected the microcontrolthe data lines are reversed (D0 on
• Digital speedometer
ler will calculate parameters such
the microcontroller connects to
• Over-speed alarm
as the fuel economy and format
D7 on the LCD, etc).
the data for display. This data is
An additional output (pin 17
• Fuel economy meter
then sent at high speed to the LCD
or RC2) is used to control the
• Distance and time to destination
so that the display updates very
backlight of the LCD. The mi• Digital clock with GPS accuracy
quickly – in the blink of an eye!
crocontroller generates a square
The microcontroller also moniwave on this pin which, via Q1,
• Altitude in metres
tors a number of inputs, the three
rapidly switches the backlight
• Heading and compass
pushbutton switches, a light
LEDs off and on. By varying the
• Current latitude and longitude
dependent resistor (or the car’s
duty cycle of this waveform the
headlights) for night/day detecmicrocontroller can smoothly
• A USB 2.0 interface so that you
can
tion and a signal from the fuel
control the backlight brightness
use it with your laptop for navigation
injector system used in measuring
from off to full on.
or uploading firmware changes...
fuel economy. It also controls the
The firmware allows you to set
backlight brightness of the LCD
separate levels of the backlight
and communicates over USB to
brightness for day and night,
a laptop.
determined by a light sensor or
The only other items of note are two voltage regulators the vehicle headlights. When the microcontroller detects a
which supply 5V for the microcontroller and 3.3V for the transition between day and night it will change the brightness
GPS module. The device can be powered from the vehicle gradually over a period of about a minute. This is done so that
12V battery or from a computer’s USB interface.
the driver is not distracted by a sudden change in brightness.
The main PC board is very small at 123 x 43mm and
The crystal (X1) on pins 13 and 14 provides the main clock.
piggybacks onto the LCD readout – the complete display/ Within the microcontroller the 20MHz crystal frequency is
PC board stack is about 25mm high. The dimensions were divided by 5 to give 4MHz and then multiplied by 12 in a
deliberately kept small so that the complete unit could be phase locked loop (PLL) to generate the processor clock of
mounted in many places in addition to sitting on top of the 48MHz. This is further divided by 4 to drive the USB 2.0
dashboard.
interface and also divided by 4096 to generate an interrupt
to the CPU every 85µS.
Circuit Details
Continuing in a clockwise direction around the circuit
Fig.3 shows the full circuit diagram of the GPS Car Com- diagram, the three pushbuttons go straight to inputs on the
puter. As discussed before, it is not very complex and is microcontroller which are pulled high by internal resistors.
dominated by the microcontroller, a Microchip PIC18F4550. As a result a button press causes the input to be pulled low.
This is mostly concerned with driving the graphic LCD via The firmware switches the pullup resistors off and on as
an 8-bit bus (D0 to D7) and seven control lines.
needed, so if you use an oscilloscope on these inputs you
The LCD is mounted upside down so that the data lines will not see a simple DC voltage.
are physically on the bottom of the PC board (viewed from
Pin 18 (VUSB) of the microcontroller connects to an
the front) and do not short against the GPS module which internal 3.3V regulator which is used to power the USB
must be mounted on top. To accommodate this, the display interface within the chip. The 220nF capacitor on that pin
External Antenna Connector
MMCX type for external GPS
antenna (on back of box)
USB 2.0 Interface
For navigation software on a
laptop or loading new
firmware. (On end of box).
Light Detector
LDR (on end of box) for
day/night control (vehicle light
power can be used instead).
Power and Signals
6-pin mini-DIN socket (on
end of box) for power and
external signal input.
GPS CAR COMPUTER
SET
SILICON
CHIP
SET Button
Switches to an option screen associated with the
currently displayed screen. Using the UP/DOWN
buttons allow you to change the value of the
chosen option. Pressing SET again will save the
option and return to the original display screen.
siliconchip.com.au
GRAPHIC DISPLAY
120 x 32 pixel LCD readout
UP Button
Will switch to the previous
display. When setting an
option will increase the value.
DOWN Button
Will switch to the next display.
When setting an option will
decrease the value.
Fig.2: there are only three push-button controls on the
GPS Car Computer – just as you would want to minimise
the time your eyes are distracted from the road. Having said
that, it’s delightfully easy to use.
January 2010 29
helps suppress ripple and noise in the regulator.
The data lines (D+ and D-) from the USB socket connect
directly to pins 24 and 23 respectively of the microcontroller. This is one of the great features of the Microchip
microcontrollers; you do not need external resistors, transceivers or any sort of supporting components. Everything to
do with the USB connection is taken care of within the chip.
Jumper JP1 is used to prevent a conflict with the USB
power source when the GPS Car Computer is permanently
powered from a 12V supply. The need for this is explained
in the section on assembly options.
GPS Module
The interface to the EM-408 GPS module has some tricks
D1 1N5819
REG2 LP2950CZ-3.3
OUT
+5.3V
IN
GND
10 F
16V
11
+5.3V
4
2
+3.3V
Vdd
CVref
EM-408
GPS MODULE
1
4
Tx
3
Rx
2
GND
3.3k
RC1
RE0
5
RA3
25
Tx
6
26
JP1
CON2
1
4
23
2
24
3
18
USB TYPE B
RC0
RA1
RB0
C1out
RB1
RB2
Rx
RD0
RD1
D–
RD2
D+
RD3
Vusb
RD4
220nF
RD5
RD6
SET
RD7
36
S1
DOWN
UP
37
S2
38
S3
13
X1 20MHz
22pF 22pF
14
10
100 F
16V
REG1 LM2940CT-5
OUT
RB3
RC2
16
7
8
6
15
5
3
4
A
470nF
D2
1N4004
K
19
Vdd
CLK
CS2
CS1
A0
33
+12V
IN
GND
2x
100nF
22k
2
6.8k
+5.3V
1
+5.6V
220nF
IC1
PIC18F4550
-I/P
5
EN
MCLR
A
K
100k
32
Vdd
RA0
10k
V+
to it that need a little explanation. The signal line from the
microcontroller’s pin 25 to the module’s receive data input
(Rx) is simple enough. The microcontroller runs at over 5V
while the GPS module runs at 3.3V, so the two resistors
are necessary to drop the microcontroller’s output voltage
to a safe level for the module.
The transmit data from the module to the microcontroller
is where the problems occur. The voltage level on the EM408’s transmit line is a little lower than the standard TTL
threshold for a high logic level.
This, coupled with noise and temperature variations
will cause intermittent errors in the data stream as read
by the microcontroller.
If you refer to Fig.4 you can see that we overcome this
LED+
Vcon
LCD
CONT
3
SG12232A LCD MODULE
RES E R/W
18 8 9
LED–
VR1
10k
CON1
100nF
6-PIN
MINI DIN
20
6
D7 D6 D5 D4 D3 D2 D1 D0 GND
17 16 15 14 13 12 11 10
1
5
3
4
2
34
1
35
19
20
21
82k*
22
27
28
29
30
3.3k
17
C
B
Q1
BC338
E
RB4
RB6
RB5
RE1
RE2
OSC1
RB7
OSC2
RA5
Vss
12
82k
39
9
10
40
+5.3V
7
+
Vss
31
8.2k*
47k
PIEZO
BUZZER
RESISTORS IN RED ARE NOT
INSTALLED AT PRESENT
(RESERVED FOR FUTURE EXPANSION)
LDR1*
* OPTIONAL
1 2 3 4 5
PC BOARD
EM-408 CONNECTIONS
SC
2010
GPS CAR COMPUTER
1N5819
1N4004
A
A
K
LM2940, LP2950
BC338
K
GND
B
E
C
IN
GND
OUT
Fig.3: the full schematic for the GPS Display. It is dominated by the microcontroller which is mostly concerned with
receiving data from the GPS module and driving the LCD. The only other items of note are two regulators which
provide 5.3V and 3.3V.
30 Silicon Chip
siliconchip.com.au
SERIAL DATA (NOT
TTL COMPATIBLE)
4
2
EM-408
GPS MODULE
Tx
4
TTL COMPATIBLE
SERIAL DATA
+12V
PIC 18F4550
1.35V
REFERENCE
COMPARATOR
5
ENGINE
MANAGEMENT
SYSTEM
TO GPS DISPLAY
(CON1 PIN 5)
+12V
6
26 Rx
FUEL INJECTOR
SOLENOID
0V
UART
Fig.4: because the EM-408
GPS module does not deliver
standard TTL voltage levels we must convert the signal.
This is done by a comparator which compares the signal
to a 1.35V reference, both of which are integrated in the
microcontroller. The output of the comparator is a TTL
compatible signal which is fed to the UART, also within
the microcontroller.
issue by feeding the transmit data to the non-inverting input
of an analog comparator circuit within the microcontroller
(pin 5 or RA3).
The microcontroller is also set up to generate a 1.35V
reference voltage which is available on pin 4 (CVREF). This
in turn is connected to the inverting input of the comparator on pin 2 (RA0).
The result is that the transmit data signal from the EM408 is compared to 1.35V and the clean, TTL-compatible,
output is available on pin 6 (C1OUT), which is connected to
the input to the serial data receiver (UART) at pin 26 (Rx).
Power Supply
The main power is derived from the vehicle’s 12V battery
present at pin 4 of the DIN input/output connector. REG1
is a 5V linear regulator designed for automotive use so it
can withstand large voltage spikes, momentay reversal of
the input voltage and other abuses that are common in the
auto environment.
Fig.5: a simplified diagram of the fuel injector control
in a standard petrol engine. The positive lead of the
injector is at 12V and the engine management pulls the
negative lead to zero potential to open the solenoid and
inject fuel into the inlet manifold. It is this signal that
you should feed to the GPS Car Computer.
With the backlight turned on full, the regulator will
dissipate almost 1W so it is mounted on a small heatsink.
Silicon diode D2 in the common leg of the regulator serves
to raise its output to 5.6V, then the 1N5819 Schottky diode
in series with the output (D1) will drop about 0.3V resulting
in an output of about 5.3V for the LCD and microcontroller.
This is done for a number of reasons. First, diode D1
serves to isolate the main power supply if the GPS Car
Computer Display is plugged into a USB port. If D1 was
not present, the 5V supply from the USB port would also
try to drive the output pin of the voltage regulator, resulting
in an excessive current from the USB source.
The second feature of this circuit is that it provides a
5.3V supply to the LCD. This is needed because the contrast of the LCD is controlled by the voltage on pin 3 (Vo)
with reference to the voltage on pin 2 (Vdd). For normal
contrast the voltage on pin 3 should be about -4.9V to -5.1V
compared to pin 2 - although this varies with temperature
and manufacturing tolerances.
Without going into the subtle details, this means that
either the supply voltage on pin 2 of the LCD must be
noticeably higher than 5.1V or we must be prepared to
The GPS Car Computer mounts on the
Jiffy Box lid, which becomes the base . . . with the LCD readout
showing through a cutout in the base . . . which becomes the front panel.
siliconchip.com.au
January 2010 31
47k
CON1
82k
220nF
10
3.3k
22k
82k*
S1 470nF
100k
LDR*
8.2k*
CON2
CON5
1
10 F
10k
LP2950
X1 20MHz
IC1 PIC18F4550
Q1
BC338
CON4
3.3k
100nF
External connections
All external connections are made through CON1, a 6
pin mini DIN connector. Ground and 12V are on pins 3
and 4 (respectively) of the connector. An external input
from the vehicle’s headlight’s circuit can be wired to pin 1
to control the day/night backlight brightness (more on this
in the section on assembly options).
Pin 5 of the connector can be wired to a fuel injector
solenoid if you want to implement the fuel economy meter
function. The 82K and 47K resistors serve to drop the vehicle
voltage levels to 5V for the microcontroller.
There are also two spare connections (pins 6 and 2) which
can be connected to pins 9 and 10 of the microcontroller.
These are unused and available for future use. They can
be set by the firmware to be digital inputs, digital outputs
or analog inputs.
TO-220
M3 x 10mm
Fig.7: the 5V regulator
REGULATOR
SCREW
HEATSINK
can dissipate up to
SILICONE
1W so it must be
GREASE
mounted on a
heatsink. A smear of
heat transfer
M3 STAR LOCKWASHER & NUT
compound must be PC BOARD
applied between the
regulator and the heatsink. Before tightening the bolt
check that the heatsink clears the nearby solder pads.
Only after you have tightened the nut and bolt should
you solder the regulator’s leads to the PC board.
32 Silicon Chip
REG1
LM2940
100nF
VR1
6.8k
10k S3
(TO LCD MODULE)
1
supply a negative voltage to pin 3 to get a proper level of
contrast. Our approach of using D1 and D2 to give 5.3V is
much simpler than generating a negative voltage.
The final benefit of this power supply design is that we
can use the 5.6V (via a 10 current limiting resistor) for
driving the backlight LEDs.
Given the various voltage drops involved (about 3.6V
across the LEDs and 0.7V across Q1) it is much easier to get
full brightness from a supply that is a bit higher than 5V.
This arrangement also means that the backlight is automatically disabled when a USB power source is used –
handy because the USB interface on your computer would
be overloaded if the backlight was enabled.
The second voltage regulator, REG2, is a 3.3V device that
supplies the GPS module. It has a low dropout voltage,
so it is happy with the 2V voltage differential between its
input and output and it comes in a TO92 package, which
is convenient as there is not much space on our PC board.
100 F
S2
REG2
D1
5819
PIEZO BUZZER
1
Future firmware updates could use these to measure
voltages (eg, battery voltage or sensor outputs), detect
digital inputs (eg, switch closure or tachometer output)
or set them to be an output to control something.
PC board
The GPS Car Computer is built on a single PC board
coded 05101101. The PC board is double sided and uses
plated-through holes thereby allowing us to keep the
size small.
This type of PC board is actually easier to assemble
than the single sided version commonly used. This is
because the board is coated in a varnish (called solder
resist) which protects tracks and areas that should not
be soldered. It also has the position and values of the
components printed on the top side of the board which
means that assembly is mostly an exercise in following
the diagrams.
When soldering this type of board you should observe
normal good soldering practice. Use a temperature
controlled iron set to about 360°C with a fine tip (0.8mm
chisel is good). Use fine resin-cored solder (0.8mm or
less) and don’t hold the iron on a joint for more than
three or four seconds.
The use of plated-through holes means that you don’t
need to install links but it does mean that it is difficult
to remove a component after it has been soldered in. So,
take care before you apply the soldering iron – check that
the component is the right value and orientated correctly.
The best way to remove a component from a board with
plated through holes is to cut its leads close to the body,
then pull the leads out with pliers while applying heat
to the solder pad. You can then use de-soldering braid
or a solder sucker to remove the excess solder from the
pad and hole.
5.3V
+
–
Fig.8: before you solder in
the microcontroller and
connect the GPS
module you should
check that these
voltages are present.
Both have a tolerance
of ±150mV. If you
cannot measure the
IC1 PIC18F4550
correct voltages you
should check D1, D2,
IC2, IC3 and the
power connection.
–
1
3.3V
+
CON5
LP2950
D2 1N4004
1
220nF
D2 1N4004
4
JP1
100nF
2
22pF
3
CON3
Fig.6: component overlay for
the main PC board. Components
marked with an asterisk (*) are
optional – their use is explained in
the text. The GPS module “plugs
into” the header socket, CON5,
while the LCD readout module
similarly plugs into the longer
socket, CON4.
22pF
TO GPS MODULE
siliconchip.com.au
Here’s a photo of the GPS
Car Computer to match
the overlay at left. In this
case, the LDR option is
used to control the day/
night function. This an
early prototype and the silk
screen legend will be slightly
different in the final board.
If you want to make your own PC board, PDF and (zipped)
EPS files can be downloaded from the SILICON CHIP website.
However, given the fact that it is a double-sided board
AND has plated-through holes, home fabrication is a lot
more difficult than standard (single-sided) boards.
Gerber format design files for the board, (used by most
PCB fabricators) have been uploaded to BatchPCB and you
can order it from them by following this link: http://tinyurl.
com/ybulgcy. Many other PCB fabricators will also make the
board for you and http://opencircuits.com/PCB_Manufacturers lists a large number of these companies. Of course,
kit suppliers will include the board as part of the kit.
Assembly options
Before you start soldering there are a few of assembly
options that you need to consider.
The first is the control of the backlight brightness. The
microcontroller determines if it is day or night by the voltage on pin 40 (RB7). When it is above about 1.4V it is night;
less than that it is daytime.
By rearranging the components on this input you can use
a light dependent resistor (LDR) or the car’s headlight circuit
to switch between the night and day brightness levels. The
following table lists the components used:
LDR
Control
LDR Install LDR
R1
8.2k resistor
R2
Leave Empty
Headlight
Control
47k resistor
Leave Empty
82k resistor
Note that for headlight control the 47k resistor is installed vertically in the position marked for the LDR.
You also need to decide how you will wire up the power
and other leads going to the mini DIN plug. If you are in-
stalling the GPS Car Computer permanently you should
connect the negative to the chassis and the positive power
lead to a spare position in the fuse panel (if there is one)
with a 500mA fuse.
It may be easier to connect to a permanent 12V source
and wire via an inline 3AG fuseholder with fuse.
Refer to the Features Panel later in this article for the
connection of power and other signals to the DIN connector. If you have decided on headlight brightness control
you should wire pin 1 of the DIN connector to the vehicle
wiring so that the voltage is at 12V when the headlights
are turned on.
A connection between pin 5 and a fuel injector is also
necessary if you want to use the fuel economy feature.
Fig.6 shows a typical circuit used in a modern car. You
need to locate a negative solenoid lead and connect to that.
The crude method would be to pierce the insulation of
the wiring at the solenoid in the engine bay. This would
expose the wire to corrosion and other dangers.
A more elegant and reliable method would be to locate
the engine management unit, normally behind the firewall
in the passenger compartment and connect to the appropriate lead there.
If you need to move the GPS Car Computer around, the
best approach would be to wire the power leads to a cigarette
lighter style plug with the positive power lead connected
to the tip and the negative lead to the side wings. Most of
LONG PINS
PLASTIC
SPACER
SHORT PINS
SOLDER PINS
ON TOP
(TOP)
LONG PINS
ON TOP
(BOTTOM)
Fig.9: the tactile
TACTILE PUSHBUTTON
switches must sit
SWITCH
GAP APPROX
1mm above the PC
1mm
board so that the
actuating rod will
PINS PROTRUDE
protrude far enough
THROUGH
PC
BOARD
through the front
FOR SOLDERING
panel. This spacing
is achieved by making sure that the switch leads only
protrude by a fraction of a millimetre on the underside
of the PC board.
siliconchip.com.au
TRIM OFF
PINS
LCD MODULE
PC BOARD
(TOP)
(BOTTOM)
REMOVE
PLASTIC SPACER
Fig.10: the LCD has 20 pins which plug into the socket
on the main PC board. Insert the long pins of the pin
header from the underside of the display so that the
plastic spacer is flush with the underside. Solder the
pins on the top, lever off the plastic spacer and trim the
pins on the top of the LCD board.
January 2010 33
This photo shows how to remove the plastic spacer on the
underside of the display board using a small screwdriver.
You must remove the spacer so that the LCD can snugly
mate with the main PC board. The pins on top of the board
have already been trimmed. (Refer also to Fig.10).
Here’s the partially
assembled connector on the
LCD. Note that the plastic spacer is
on the underside with the long pins
running up through the LCD board.
The pins have been soldered on top.
these connectors have a fuse in the body of the connector
but if not, you should insert an in-line fuse holder fitted
with a 500mA fuse.
Another option for you to consider is jumper JP1, which
is used to isolate the USB 5V supply. Normally this is left
in place so that you can power the unit from either USB or
12V sources. You cannot use both simultaneously as this
would place 5.3V from the GPS Car Computer on the USB
5V line from your computer, possibly causing damage.
However, in some cases you might want to permanently
wire the unit to 12V but still need to connect it to a comLEFT-HAND END
puter via USB. To cover this eventuality JP1 is provided.
When the jumper is removed, the USB cannot power the
device, thereby removing any possible conflict.
Construction
Start assembly by soldering the 20-pin socket for the LCD
to the PC board. Ensure that it sits fully flush with the PC
board before you start soldering.
The reason for starting with this socket is that it allows
you to temporarily place the LCD display on top of this
socket while positioning the other components.
RIGHT-HAND END
FRONT PANEL (BOTTOM OF BOX)
14
19
C
16
18
29
71
13
B
A
32
LCD CUTOUT
71 x 29mm
13
B
16
A
13
B
32
29
15
16
B
A
D
114
13
17
74
8
15
E
A
25
A
A
HOLE DRILLING DETAILS
HOLES A: 3.0mm DIAM.
HOLES B: 5.0mm DIAM.
HOLE C: 10mm DIAM.
HOLE D: 16mm DIAM.
HOLE E: 6.0mm DIAM.
36
77
ALL DIMENSIONS IN
MILLIMETRES
(FOR EXT GPS
ANTENNA)
NOTE: HOLE B IN LH END
IS ONLY NEEDED IF
THE LDR IS INSTALLED
A
REAR PANEL (LID OF BOX)
Fig.12: the drill holes and cutout required for the front panel, left and right ends and the box lid (which becomes the base).
This diagram is reproduced at 80% – photocopy at 125% so that it can be used as a template. The centre hole in the lefthand end is only necessary if the LDR is installed. The holes in the right-hand end provide ventilation for the 5V regulator
– accuracy is not so important in positioning these holes.
34 Silicon Chip
siliconchip.com.au
PUSHBUTTON
CAP
Fig.11: this shows how the main
PC board and LCD are joined
together and mounted in the
UB3 jiffy box. It is important
that the actuators of the tactile
switches protrude far enough
that the caps will fit without
touching the front panel. It is
also important that the LCD
bezel is flush with the outside
surface of the front panel.
LABEL OVERLAPS LCD
BEZEL BY 3mm
20mm M3 SCREWS
WITH STAR
LOCKWASHERS
TOP OF LCD BEZEL LEVEL
WITH TOP OF FRONT PANEL
PUSHBUTTON
CAP
LCD MODULE BEZEL
LCD MODULE PC BOARD
20-WAY SIL SOCKET
MAIN PC BOARD
9mm LONG UNTAPPED SPACERS
15mm M3 TAPPED SPACERS
M3 NUTS, STAR LOCKWASHERS & FLAT WASHERS
BACK PANEL (LID OF UB3 BOX)
10mm M3 MACHINE SCREWS
This is important as there is limited clearance (6 to 8mm)
between the main PC board and the underside of the LCD
display and you need to be sure that the components on
the main PC board do not foul the LCD board before you
solder them in.
This particularly applies to the buzzer and trimpot, both
of which tend to have extra plastic on their underside. You
should cut this away with a sharp knife and make sure that
the body of the component sits flush on the PC board and
the top clears the LCD above.
Other components that you need to watch out for include
the transistor (Q1), the 3.3V regulator (REG2) and the 10F
capacitor. For now, continue with the low profile components such as resistors and diodes and then move on to
the taller components. At this stage, do not solder in the
microcontroller or the push button switches.
Note that resistors R3, R4, R5 and R6 are marked on the
PC board but not installed as they are reserved for future
expansion. Be careful with D1 and D2 as they look alike. The
same applies to Q1 (the transistor) and REG1 (the regulator),
both are in TO-92 packages and can easily be confused.
When soldering in the crystal (X1) ensure that it sits a
millimetre or two above the PC board so that there is no
danger of the metal case shorting the connecting pads
underneath.
The LM2940 regulator (REG1) sits on top of a small
heatsink as shown in Fig 7. Refer to this diagram for assembly instructions. Before screwing down the regulator
check that the heatsink does not touch the solder pads on
either side of the heatsink. The spacing is very close here
but the heatsink can be slid around to ensure that it has
adequate clearance.
Once this is correct you can tighten the nut and bolt.
Finally solder the regulator’s leads – this is left to last so
that the solder joint is not stressed.
The PC board has provision for an extra connector (CON3)
which also can be seen in photographs of the prototype.
Ignore this as it is intended for use with an In Circuit Debugger used only during software development.
Quick Test
With all components in place (except the microcontroller,
switches, GPS and LCD) we can make a quick test to ensure
that the voltages are correct.
With the power/signal cable plugged into the mini DIN
socket and the power turned on you should be able to
measure about 5.3V between pins 11 and 12 of the microcontroller. Between pins 2 and 5 of the GPS connector
(CON5) you should be able to measure 3.3V. Both could
vary by plus or minus 150mV.
Refer to Fig.8 for the measurement points. If you cannot
measure the correct voltages you should check D1, D2, REG1,
Loading New Firmware
The GPS Display includes the facility to reprogram itself
over the USB, this is sometimes called “flashing”. You don’t
need any programming hardware and it uses free software.
Full instructions will be included with any updates but the
following will give you the flavour of how it works.
To place the device into programming mode you hold
down the Set button while you plug it into a USB port on
your computer.
This causes the GPS Display to masquerade as a Microchip PICDEM FS USB board and, as far as your computer
is concerned, this is exactly what it is. This small deception
allows us to use software developed by Microchip to upload
new firmware to their own products – much easier than
developing our own.
Your computer will then ask for a device driver for the
siliconchip.com.au
PICDEM board. This is different from the virtual serial port
driver used to receive GPS data from the GPS Display and
will be included with any updates or can be downloaded
from the Microchip web site.
When the device driver has finished loading you can run
the programming software provided by Microchip for their
PICDEM FS USB board. This allows you to load the HEX
file and reprogram the device, which takes only 20 seconds
or so. You then unplug the USB cable and when you restart
your GPS Display it will be running the new firmware.
You don’t have to worry about a power failure or accidently unplugging something while it is programming. The
programming code will not be affected if something does
goes wrong, so you can always restart and try again or
reload your original firmware.
January 2010 35
REG2 and the power connection.
Final PC board assembly
Next you should install the microcontroller. This must be first
programmed with the file 0510110A.
hex (available for download from the
SILICON CHIP website) using a normal
PIC programmer.
When handling the microcontroller
and LCD you should take the standard
precautions against electro static discharge (ESD) which could zap these
devices. This means making sure that
your work surface, your soldering iron
and you are all grounded.
As there is not enough clearance
between the PC board and the LCD for
an IC socket, the microcontroller must
be directly soldered to the PC board.
Normally you would need to remove
it for reprogramming but as you can
upload new firmware by USB, this is
not a concern.
However, once you have soldered
the microcontroller you will not be
able to remove it without destroying
it. So, please read the next two paragraphs carefully.
Pin 1 of the microcontroller is
clearly marked on the PC board and
is the top right hand pin when the PC
board is viewed from the front. This
must be matched to the dimple marking pin 1 on the IC’s body. This means
that the microcontroller is installed
upside down compared to the other
components and the silk screen printing on the board.
Before you apply the soldering iron,
make sure that the part number printed
on the chip is inverted compared to
the printing on the PC board.
We understand that Altronics will
be producing a kit with a machine cut
front panel which will make construction much easier. This will also allow
each button cap to sit within a hole in
the front panel and consequently there
will be more space between the LCD
and PC board. The main advantage of
this is that an IC socket (supplied with
the kit) can be used for IC1 and you
do not need to panic over permanently
soldering it in.
When you have finished with the
microcontroller you can install the
three push button switches. These
have been left to last because they can
be easily damaged if the actuating rod
is accidently forced too far to the side
during assembly of the board.
As illustrated in Fig.9 the body of
36 Silicon Chip
GPS Car Computer - Features Summary
Automatic Scan
Simultaneously pressing both the Up and Down buttons will set auto scan. In this
mode the unit will step to the next screen every three seconds. Pressing either Up or
Down will terminate auto scan.
The data displayed can be configured as described below.
Show/Hide Display Screens
Holding down the Up button while applying power will enter a special mode to
configure what screens will be displayed or hidden.
Repeatedly pressing Set will select:
• Show (ie, the screen will always be displayed).
• Hidden when Auto Scan is operating, otherwise shown.
• Hidden Always. This is useful if, for example, the Fuel Economy Meter is not being
used – it can then be hidden to reduce the visual clutter.
Press Up or Down to move to the next screen to be configured. Remove power to
exit this mode.
USB 2.0 Interface
The GPS Display creates a virtual serial port over USB and you can use this to connect to your laptop to show the GPS output, plot your location on moving maps and
other functions using free and paid software.
You must load the SILICON CHIP Serial Device Driver on to your PC.
Firmware Updates
By holding down the Set button when plugging into a USB port the GPS Display will
accept firmware updates delivered via USB. Programming hardware is not required.
Low Signal
In a low signal situation or when first turned on the GPS Display will display a message and a count of the number of satellites found at that time.
Pressing the Set button will show the Current Signal Levels screen described on
the next page.
Full Reset
Pressing the Down button for a couple of seconds while applying power will reset
the GPS module and all configurable parameters to the factory/design defaults.
Automatic Brightness Control
The brightness of the LCD backlight can be configured separately for day and night.
Control of day/night can be from the vehicle headlights or from a light dependent
resistor (LDR).
When switching from day and night the brightness is slowly changed over a minute
or so to avoid distracting the driver.
Power and Signal Connector
Pin 3 is ground
Pin 4 is +12V power input
PIN 5:
PIN 6:
Pin 5 is the fuel injector input. Connect
HEADLIGHTS
SPARE
to the negative wire of a fuel injector (this
PIN 4:
is pulled to ground when the injector
PIN 3:
+12V POWER
GROUND
solenoid is activated).
Pin 1 is the vehicle headlights input.
PIN 1:
PIN 2:
It will control the day/night brightness of
FUEL INJECTOR
SPARE
the backlight. This input is optional and
is disabled if a light dependent resistor
is used.
Pins 2 and 6 are spare input/output lines for future enhancement. In this version
they are left unconnected.
siliconchip.com.au
GPS Car Computer – Readout Summary
Digital Clock
All data is updated once a second.
The currently displayed screen and all settings are saved in non-volatile memory and
recalled on power up.
Shows the current time in 12 hour (AM/PM) format. The seconds are shown
in the bottom right. The time is derived from the GPS signal and is accurate
to within 100mS (ie, any error is undetectable to a human observer).
Pressing the Set button will allow adjustment of the time in steps of half
an hour (ie, this sets the time zone – the exact time is always derived from
the GPS satellites).
Digital Speedometer with Over-Speed Alarm
The digital speedometer will display your speed up to 250km/h. The current
setting of the over speed alarm is shown in the bottom right. An audible alarm
(two beeps) will sound when this speed is exceeded and the speedo display
will switch to reverse video. Built in hysteresis prevents it from continuously
beeping if you stay near this speed.
The Set button will change the threshold or completely turn it off when set
to zero.
Fuel Economy Meter
The length of the black bar shows the relative fuel consumption for the distance
travelled (equivalent to litres per 100km). The longer the bar, the higher the fuel consumption so you would normally adjust your driving to keep the bar as short as possible.
The graph is not calibrated but the sensitivity (ie, full scale) can be adjusted by
pressing the Set button. This allows you to adjust it to suit different vehicles.
Distance and Time to a Destination
This display will count down the distance and time (in hours and minutes) to a
destination. The time is based on your average speed over the last ten minutes, so if
you get onto a slow road the time to your destination will increase accordingly. This
display is reasonably accurate; the error is about one kilometre in 100.
Press the Set button to setup the initial distance to the destination.
Heading, Compass and Altitude
The number on the left is the current heading (direction of the vehicle) in degrees.
The needle can show either the heading or point to the north – this is configured by
pressing the Set button. The numeric reading will always show the heading.
Your current altitude in metres is shown on the right of the screen.
Latitude and Longitude
Your current latitude and longitude. This is shown as degrees, minutes and fraction
of a minute and updates continuously as you drive.
This is accurate to within a few metres depending on the number of satellites that
can be found in the sky. This information (and much more) can be sent to your laptop
via USB for use by navigation and mapping software.
Current Signal Levels
Shows how many satellites should be in the sky and the number that is currently being
used by the GPS module. The bar graph shows the signal level of every satellite that can
be detected. The module will not use a satellite if its signal level is below a threshold.
By pressing the Set button you can adjust the backlight brightness for day and
night conditions. Day/Night is determined by a light sensor or your car’s headlights.
siliconchip.com.au
January 2010 37
the switches must sit 1mm above the PC board. This is
necessary so that the actuating rod will protrude far enough
through the front panel. This spacing is easily achieved
by making sure that the switch leads only protrude by a
fraction of a millimetre on the underside of the PC board
before soldering.
The next assembly step is the connecting pins on the
Parts List – GPS Car Computer
1 PC board, code 05101101, 140mm x 57mm
1 EM-408 GPS module manufactured by GlobalSat
Technology (available from www.altronics.com.au)
1 SG12232A 122 x 32 dot matrix LCD (Altronics Z7052)
1 20MHz low profile crystal (X1)
1 buzzer – sealed mini PC board type, high output
(Altronics S6105)
1 light dependent resistor, 10k to 1M
(Altronics Z1621) *
3 tactile switches with 22mm actuating shaft
(Altronics S1119)
3 button caps 7.5mm diameter (Altronics S1482)
1 mini DIN socket, 6 pin, PC board mounting
1 mini DIN plug, 6-pin
1 B-type USB socket, PC board mounting
1 2-pin header
1 20-pin header
1 20-way header socket, single row (8mm high socket
base)
1 U-style micro heatsink for TO-220 (19 x 19 x 9.5mm)
1 UB3 jiffy box (130 x 67 x 43 mm)
4 15mm metal M3 tapped spacer
4 9mm metal M3 untapped spacer
4 20mm M3 bolt
5 10mm M3 bolt
9 M3 Star washer
4 M3 flat washer
5 M3 nut
Semiconductors
1 PIC18F4550-I/P microcontroller (IC1) programmed
with 0510110A.hex
1 LM2940CT-5 or LM2938ET-5.0 TO-220 5V voltage
regulator (REG1)
1 LP2950CZ-3.3 TO-92 3.3V voltage regulator (REG2)
1 BC338 transistor (Q1)
1 1N4004 diode (D1)
1 1N5819 Schottky diode (D2)
Capacitors
1 100F 16V electrolytic (105°C rating)
1 10F 16V tantalum
1 470nF MKT
(code 470n or 0.47F)
2 220nF MKT
(code 220n or 0.22F)
3 100nF monolithic
(code 100n or 0.1F)
2 22pF ceramic
(code 22p)
Resistors (0.25W 5%)
1 100k 2 82k* 2 47k* 1 22k 1 10k
1 8.2k* 1 6.8k
2 3.3k
1 10
1 10k trimpot, vertical mount front adjust
* = Optional – see text
38 Silicon Chip
LCD. Start by inserting the long pins of the 20 way pin
header strip through the matching holes on the LCD from
the bottom. The plastic spacer should be flush on the
underside of the display’s PC board and the shorter pins
underneath. See Fig 10.
Solder the pins on the top of the board while ensuring
that the spacer underneath remains flush with the board.
Then remove the plastic spacer leaving just the pins. This
is best done with a fine screwdriver – lever down one end
of the spacer by a few millimetres, then the other end followed by the middle. After repeating this a few times the
plastic spacer will slide off the pins.
The GPS module is supplied with a cable with identical connectors on each end. Cut off one of the connectors,
bare the wires and solder to the pads marked CON5. The
grey wire goes to pad 1 which is marked accordingly (the
left hand pad when viewing the board from the top). The
other wires should be soldered in the same sequence as
they emerge from the connector.
As a final check, closely inspect the board with a high
power magnifying glass. Carefully check every solder joint
for blobs, shorts or poor joints.
You can now plug the LCD and GPS into the PC board.
When you apply 12V power your GPS Car Computer should
immediately start by showing the firmware version followed
by a message indicating that it is searching for satellites.
You will probably have to adjust the 10k trimpot to get
an image on the display and then continue adjusting it for
a good contrast. Consult the troubleshooting section if you
run into problems.
The housing
The combined PC board and LCD is 123mm wide, 44mm
high and about 25mm deep when viewed from the front.
This means that it can be mounted in a standard car radio
sized cut out in the dashboard. Many vehicles have this
and are intended for holding small items. The PC board and
LCD will even fit in the smaller radio slot found in newer
vehicles. When mounted in this way and with a suitable
front panel the GPS Car Computer appears to be part of the
vehicle’s instrumentation.
In this type of installation you will probably have to either
extend the leads to the GPS module so that it can be moved
to a more sensitive position in the vehicle or purchase and
attach an external antenna. The antenna connector on the
GPS module is an MMCX type and you should easily find
a suitable antenna on the Internet (just google for “GPS
antenna MMCX”). Getting a good signal level is very much
dependent on the design of the vehicle and the position
of the GPS Car Computer, so experimentation will be the
order of the day.
We decided to mount our prototype in a standard UB3
“jiffy box” so that it could be portable. The stacked PC board
and LCD are mounted on the lid of the box, which becomes
the back panel as shown in Fig.11. When the complete assembly is slid into the box the LCD bezel and the shafts of
the push buttons will protrude through the base of the box
(which becomes the front) as also shown in this diagram,
the result is a neat appearance without visible screws.
The LCD bezel should protrude through the front panel
so that its front face is flush with the box’s outer surface.
This means that there will be no need for a window or front
glass for the LCD and the front panel label will cover any
siliconchip.com.au
Fig.13: front panel artwork
for the GPS Car Computer,
reproduced same size, ready for
photocopying as described in the
text. This can also be downloaded
from siliconchip.com.au
GPS CAR COMPUTER
SET
SILICON
CHIP
roughness in the cut out. To get this flush appearance you
should use the spacers, washers and nuts as illustrated in
Fig.11. If your result is not flush (due to tolerances in the
hardware) you may need to add or remove some washers.
To prepare the box you should drill and cut holes as illustrated in Fig.12.
These diagrams are reproduced at 80% so if you photocopy them at 125% they can be used as direct templates
for positioning the holes and cutout. If you have purchased
the Altronics kit you should follow their instructions as
their box will be already prepared and will use a slightly
differentRDG_SiliconChip_0110_egx350.pdf
sequence of spacers and
mounting hardware for
1 1/12/2009 2:58:02 PM
the PC board/LCD.
To finish the assembly you should copy the front panel
design in Fig.13 onto heavy-duty adhesive-backed paper
(Avery 936067 is a good choice) and then either hot laminate
it or cover the printed surface with adhesive backed clear
plastic of the type used to cover books. Then razor cut this
paper/plastic sandwich around the edges.
When you cut out the centre of the label for the LCD you
will notice that it is a little smaller than the LCD bezel.
This is deliberate, as shown in Fig.11 the label is designed
to overlap the LCD display bezel by a few millimetres.
This hides any roughness in the cutout in the front panel
and gives a clean, professional finish. Finally, peel off the
backing paper from the label and attach to the front panel.
C
M
Y
CM
MY
CY
CMY
K
siliconchip.com.au
January 2010 39
The GPS module sits horizontally on top of the PC
board and LCD boards with its antenna (the brown/silver
assembly on the top) pointing to the sky. This is its most
sensitive orientation.
To make space for the module you need to use a sharp
knife to remove the centre two plastic ribs on the top inside
of the box. The module should then sit with its external
antenna connector (the gold coloured connector) poking
through the hole in the back panel and held in place by the
surrounding box and PC board/LCD. If the module rattles
around inside the enclosure you will have to attach padding of some type to keep it still.
Troubleshooting
With only a few active components in this project it
should be easy to track down any faults. Firstly, check the
two supply voltages as described earlier as nothing much
will happen if they are not correct.
Next, check the microcontroller. This is best done by
measuring the voltage on pin 4 which should be between
1.2V and 1.5V. This voltage is created by the internal voltage reference and implies that the firmware is running,
has enabled the reference and configured it for the correct
voltage. In other words, it means that the microcontroller
is perfectly OK and running its program.
In the absence of this voltage, use an oscilloscope to check
for a 20MHz sinewave at pins 13 and 14, indicating that
the main clock is present. Also check the soldering around
the microcontroller for bridges, non soldered joints, etc.
If the microcontroller is working the next thing to check
is that the pushbuttons are OK. Use a multimeter to check
that the switches are open when not pressed and near zero
ohms when pressed.
If a button is stuck down it will cause the unit to go
into one of several special modes when power is applied
and that may trick you into thinking that the whole unit
is not working.
If the actuating arm of a switch is pushed too far to the
side this can also cause the switch to close. This can happen
if your drilling of the front panel is not accurate.
Next is the LCD. First check the voltage on pin 3 of the
LCD (Vo), it should be under 0.5V. This voltage is controlled
by the 10k trimpot (contrast) and if not correctly adjusted
the display will appear blank.
The microcontroller only sends data to the LCD and does
not expect any response. So, even with the LCD removed
or faulty, you should still see signals on the data lines to
Choosing a Microcontroller
Readers might be interested in
the background of why we chose
a PIC18F4550 microcontroller
for this project.
Originally the design started with
the Microchip PIC16F877A.
This has been around in variou
s incarnations for at least 10 yea
rs
(a long time in semiconductor
circles) and has long been the
chip
of choice when large pin cou
nts have been required. How
ever,
during development we ran into
a problem with its limited RAM
.
Searching through the Mic
rochip catalog we found the
PIC18F4550. This is a much mo
re modern chip which has 204
8
bytes of RAM – plenty for our
requirements. As a bonus it also
had four times the program me
mory, ran four times faster tha
n
the venerable PIC16F877A and
, if that was not enough, it include
d
a USB 2.0 interface to boot.
It had also been used in previou
s
SILICON CHIP projects so it was
not a total stranger.
The clincher was when we che
cked the Microchip price list.
The PIC18F4550 with all its fan
cy features was 20% cheaper tha
n
the plain old PIC16F877A!
As an American would say…
the decision was a “no brainer
”.
the LCD. If the LCD is blank or showing rubbish the only
things that you can do is check that it is plugged in correctly and that there are no solder bridges on the connector.
With the microcontroller running and the LCD showing
the startup message the only other fault would be with the
GPS module. The microcontroller will display an error
message if the module is not connected or running, so that
type of fault should be obvious.
The GPS Car Computer could also sit for a long time with
the LCD showing a message indicating that it is searching
for satellites. This indicates that the GPS module cannot
get a signal and moving the unit outside or near a window
should correct that. While it is searching you can press the
Set button to get the Signal Levels display – this will show
you how many satellites can be seen and their signal levels.
Assuming all is well, we’re ready to move into some of
the more esoteric aspects of operating the GPS Car Computer but alas, space has beaten us so that will have to wait
until next month.
However, as we said earlier, it really is very simple and
quite intuitive to operate, so between now and February
you’ll have a good opportunity to play with it yourself and
find out many of the good things it can do.
We’ve even given you a head start with the various LCD
SC
readout screens shown earlier!
Resistor Colour Codes
o
o
o
o
o
o
o
o
o
No.
Value
1
100k
2*
82k
2*
47k
1
22k
1
10k
1*
8.2k
1
6.8k
2
3.3k
1
10
* - Optional, see text
40 Silicon Chip
4-Band Code (1%)
brown black yellow brown
grey red orange brown
yellow violet orange brown
red red orange brown
brown black orange brown
grey red brown
blue grey red brown
orange orange red brown
brown blackblack brown
5-Band Code (1%)
brown black black orange brown
grey red black red brown
yellow violet black red brown
red red black red brown
brown black black red brown
grey red black brown brown
blue grey black brown brown
orange orange black brown brown
brown black black gold brown
siliconchip.com.au
|