This is only a preview of the October 2010 issue of Silicon Chip. You can view 27 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 High-Quality DAB+/FM Tuner, Pt.1":
Items relevant to "Digital Controller For Christmas Light Shows":
Items relevant to "Two Toslink-S/PDIF Audio Converters To Build":
Articles in this series:
Items relevant to "Build A GPS Boat Computer":
Purchase a printed copy of this issue for $10.00. |
GPS Boat Comp
For all the boaties out there, this one could literally be a life saver!
You’ll never be lost again: as well as telling you exactly where you
are at the moment, it will also show you your speed and heading and
can even navigate you back to your starting point – or to that secret
fishing spot! It can even tell you how much fuel you’re using, along
with a host of other vital information.
B
ack in January of this year we
described the GPS Car Computer, a project that used a low
cost GPS module to provide a variety
of data for the motorist.
The project essentially consisted of
a microcontroller, a display and a GPS
module and it was obvious from the
outset that it could be used for other
applications.
One reader, Nigel Hall of Dee Why
in Sydney (himself an avid boatie!),
was quick with the suggestion that
we should make a nautical version.
Nigel then went on to put in a lot of
his time into defining a typical set of
boating requirements and testing the
final product.
So here is the result – the GPS Boat
Computer, a small electronic device
intended to provide the weekend boater with a host of useful information.
It will show your speed in knots,
your heading, fuel consumption rate
and the total amount of fuel consumed. It will also show your latitude
and longitude and a compass needle
pointing north.
Possibly the most handy feature is
the ability of the GPS Boat Computer
to memorise up to eight of your favourite fishing or diving spots and
later guide you back to the exact same
78 Silicon Chip
spot – even if it is in the middle of
the ocean.
The hardware
This project illustrates a trend in
modern electronics… the use of intelligent and general function devices
that can be reprogrammed to suit a
variety of purposes.
An extreme example of this are the
Mars rovers Spirit and Opportunity.
They have been reprogrammed many
times to cope with the various conditions and terrain that they have met
during their exploration of the red
planet.
In a similar vein the GPS Boat Computer uses virtually the same hardware
and circuitry as the GPS Car Computer
described in January and February
2010. The major difference is in the
firmware which completely changes
the character of the device.
You do not need a PIC programmer
for this change in personality; the new
firmware can be loaded via USB from
your computer and the Car Computer
will become the GPS Boat Computer.
You could, if you wished, then load
the Car Computer firmware (also via
by Geoff Graham
USB) and flip back to that personality.
In fact, you could drive to the marina
with your GPS Car Computer, load
the new firmware (it only takes 20
seconds) and sail off with your GPS
Boat Computer!
This also means that if you want to
build this project from a kit you can
simply buy and build the kit of parts
for the GPS Car Computer (from Altronics) and upload the new firmware
to turn it into a GPS Boat Computer.
The only thing that you might need
to do is consider a different enclosure
– and we will talk about that shortly.
Using the GPS Boat Computer
The GPS Boat Computer is quite
easy to use. You have a number of
screens that show useful information
which you select by pressing the UP
or DOWN buttons. These buttons
will wrap around the available set of
screens when you have reached the
end. When you turn the GPS Boat
Computer off it will remember the last
screen and will automatically return to
that when power is reapplied.
All screens have something that can
be configured or changed. For example, when the clock screen is showing
you can set the time zone. To change
a setting you press the SET button
siliconchip.com.au
puter
The GPS Boat Computer in action on the water, in its spray proof housing designed
by Nigel Hall. It is showing the speed (in knots), a compass needle pointing in the
direction of north and the boat’s current bearing (159°). (courtesy Nigel Hall)
and then use the UP/DOWN buttons
to adjust the value. Pressing the SET
button a second time will save the
value and either take you to another
option or return to the main display.
Options
Some
options
are in the form of a question. The
screen above shows a typical example
of this and when presented with this
you select YES or NO by pressing the
UP/DOWN buttons then press the SET
button to confirm the selection.
Speed, compass and heading
When
you start
up the
GPS Boat
Computer for the very first time the
screen that you will see is shown
above. This displays your speed in
knots, a compass needle pointing
north and your heading in degrees. The
speed is averaged over a few seconds
and is reasonably accurate, even down
to one or two knots.
The compass and heading are both
derived from the change in latitude
and longitude as your boat moves
through the water. So if the boat is stasiliconchip.com.au
tionary, both of these will be blanked
to prevent them showing random and
incorrect values.
Pressing SET will enable you to
switch the display to reverse video
(green lettering on a black background). This might help in situations
of poor visibility caused by bright
sunlight.
Fuel consumption
Pressing
the DOWN
button will
take you to
the next screen. This shows your
current rate of fuel consumption and
the total fuel consumed. This data is
dependent on the installation of the
optional fuel flow sensor (described
later).
The instantaneous reading (litres/
hour or gallons/hour) can be used to
adjust the speed of the engine for an
optimal cruising efficiency. To reduce
jitter in the display the reading is averaged over several seconds.
The total fuel consumption can be
used to estimate the amount of fuel
remaining in your tank. You would
normally reset the total to zero when
you fill the tank and this can be done
by pressing the SET button and using
the UP/DOWN buttons to select YES
at the prompt.
By pressing SET you can also calibrate the amount of fuel consumed.
The way to do this is quite straightforward. Fill the tank, zero the total
and take your boat for a run. When you
return, refill the tank to the same level
and use the calibration screen and the
UP/DOWN buttons to set the actual
amount of fuel consumed. If you enter
the amount consumed in litres then all
readings will be in litres, similarly if
you use gallons then all readings will
be in gallons.
Engine
run time
The next
screen is the engine run time shown
above. This is mostly used to determine when engine maintenance is
due. It is assumed that when +12V is
present on pin 2 of the 6 pin connector
that the engine is running, so this pin
would normally be connected to the
ignition circuit of the engine.
Point Of Interest (POI)
This powerful feature
will memorise your
October 2010 79
current location and later guide you
back to within a few metres of the
same spot. This is great for returning
to your favourite fishing spot, dive
location etc. To set a POI to the current
location you simply press SET when
on a POI screen then select YES when
prompted.
The POI screen illustrated will show
your distance to the location while
the needle and number will show the
bearing that you should take.
To return to a location you just follow the needle and watch the distance
count down. As you get closer the
distance display will switch to metres
with a resolution of one metre.
Because the Earth’s surface is spherical, accurate calculation of the heading
and distance would require the use of
spherical trigonometry and 64 bit floating point numbers… something that is
just not possible for our overloaded
microcontroller.
So we cheated and pretended that
the earth was flat and used simple
trigonometry and Pythagoras’ Theorem instead.
The result is that from a distance
the heading/distance will be a little
inaccurate but, as you get closer, the
accuracy will improve considerably.
Depending on the signal level and
other factors the GPS Boat Computer
will direct you to within a few metres
of the exact location – and that is pretty
good when you are looking for a spot
in the middle of the ocean.
The GPS Boat Computer will memorise up to eight points of interest and
these are shown in sequence when
you press the UP or DOWN buttons.
To reduce the number of screens that
you have to step through, only the first
three are shown by default.
However, it is easy to enable the other POI screens using the Hide/Show
function (see below for a description
of this function).
You can also use points of interest as
waypoints. To do this simply set them
in sequence (ie, POI #1, POI #2, etc).
When you reach one of them pressing
the DOWN button will show you the
next. This way it would be easy to run
from one waypoint to the next.
By pressing SET and selecting the
appropriate option you can also clear
a POI and that screen will not show
any directional data when you step
through it with the UP/DOWN buttons.
One facility that would have been
really handy would have been the ability to manually enter the coordinates
of a POI. Unfortunately the microcontroller just did not have enough
program space for this function, so we
reluctantly had to leave it out.
Coordinates
The latitude and
longitude
screen displays your current location in degrees,
minutes and fraction of a minute. This
information (and much more) can also
be sent to your laptop via USB for use
by navigation and mapping software.
Signal
level
The signal level screen shows how many
satellites should be in the sky (the
number in the top left) and the number
that are currently being used by the
GPS module (bottom left). The bar
graph shows the signal level of every
satellite that can be detected but the
module may not use every one if some
of the levels are too low.
When you are on the signal level
screen you can adjust the backlight
The EM-408 GPS receiver module
used in this project (and of course
in the GPS car computer from last
January). It is available as part of
the kit from Altronics (as mentioned
earlier, the GPS Car Computer can
become the GPS Boat
Computer), as a separate
item from Altronics or from
a number of sources on the
internet. Other modules
might work; we know this
one does!
80 Silicon Chip
brightness for day and night conditions by pressing the SET button.
Clock
The last
screen displays the
current time in 12 hour (AM/PM)
format with the seconds shown on
the bottom right. The time is derived
from the GPS signal and is accurate to
within 100ms. 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).
Special Functions
The GPS Boat Computer has a couple of special functions that make it
easier to handle the various screens
that can be displayed.
The first function is Auto Scan mode
where the display will automatically
flip from one screen to the next every
three seconds. When it reaches the end
it will wrap around and continue on
from the top. When your hands are full
this is far easier than pressing the UP or
DOWN buttons to show a new screen.
To enter Auto Scan mode you
should simultaneously press both the
UP and DOWN buttons. To exit this
mode press any single button.
You may not want to see all the
screens as you cycle through them
so you can configure the unit to hide
some of them.
To set this up you must hold down
the UP button when you apply power.
This will put the unit into a mode
where you can set the following characteristics for each screen:
• Show.
• Hide in auto scan.
• Always hide.
When set to “Always hide” that
screen will be skipped as if it did not
exist. The “Hide in auto scan” setting
is useful if you want to hide some
screens during the Auto Scan mode
but still have them available when you
manually step through the screens. A
good example is the Engine Running
Time screen which you do not need
to see while in Auto Scan.
While configuring the Show/Hide
function the SET button will step you
through the three settings described
above and the UP and DOWN buttons will move you through the list
of screens available for configuration.
To exit this mode you simply resiliconchip.com.au
move and reapply the power.
Measuring Fuel Flow
One of the features of the GPS Boat
Computer is its ability to measure the
amount of fuel consumed by the engine in litres or gallons per hour and as
a total. This function is optional so you
can ignore this section if you wish to.
There are two choices when it comes
to measuring fuel consumption. If your
engine is diesel or fuel-injected you
can measure the length of time that
the fuel injectors are open. This is the
same technique as used in the GPS Car
Computer and only requires a connection to the fuel injector solenoid.
The voltage on the solenoid lead is
normally high and it is pulled low by
the engine management unit to open
the solenoid and inject fuel into the
cylinder. Normally the pressure in the
fuel line is reasonably constant and
therefore the time that the solenoid
is open directly corresponds to the
amount of fuel consumed.
If you have a carburetted engine
then the alternative is to use a paddle
wheel flow sensor. These have a miniature paddle wheel or small turbine
which is rotated by the flow, magnets
attached to the rotating shaft will then
cause a reed switch or a Hall Effect
sensor to switch on as the magnet
swings past. As a result we get a series
of pulses at the output, the faster the
pulse rate, the faster the flow.
Paddle wheel flow sensors are easy
to find but it is much harder to find one
that is suitable for use with fuel. This
is because the O-rings in a normal flow
sensor will perish in contact with fuel
and will eventually leak – which is a
very dangerous situation in any boat.
So, if you decide to use a flow sensor, check the specifications and only
use one that specifically states that it
is suitable for use with petrol or diesel
fuel. Also be aware that some O-rings
may be specified as OK with ordinary
(unleaded) petrol but may not be so
with petrol with ethanol additives.
We bought ours via eBay but this
particular product has since disappeared from their listings. RS Components (australia.rs–online.com) have
a suitable but expensive sensor (part
no. 508-2704).
A similar sensor is branded MGL
Avionics and is available from www.
lightflying.com.au or oregonlightsport.com and other online suppliers.
It is intended for experimental aircraft
siliconchip.com.au
The paddle wheel fuel flow sensor that
we purchased on eBay. It has three
connecting wires – one for ground,
one for +12V power and one for the
signal output. The output is open
collector so we soldered a 3.3kΩ
resistor between the signal lead
and +12V. This could
be squeezed inside
the 6-pin plug if there
is enough space.
(Courtesy Nigel Hall)
but is also suitable for our application.
The GPS Boat Computer itself can
be calibrated over a wide range so it
should work with almost any flow
sensor that has a pulse output. You
might also find a number of paddle
wheel sensors designed for marine
applications that provide a NMEA
2000 output in place of the simple
pulse output. NMEA 2000 is a complex
marine communications protocol and
regrettably beyond the capabilities of
the microcontroller in the GPS Boat
Computer.
Two different versions of the firmware are available from the SILICON
CHIP website, one for flow sensor
measurement and the other for fuel
injector measurement.
The file names are:
• GPS Boat Computer V1.0A Update.
hex – will use the paddle wheel
flow sensor.
• GPS Boat Computer V1.0B Update.
hex – will use the fuel injector
monitoring method.
Both are easily loaded via USB
from your computer and you can experiment by switching between them
if you wish.
If you do not want to use the fuel
consumption feature you can load either version of the firmware and ignore
the fuel consumption screen or hide
it by using the Show/Hide function
described earlier.
USB Interface
The GPS Boat Computer is equipped
with a USB interface that can be used
with a laptop computer for displaying your location on electronic maps,
recording you track and similar tasks.
Essentially, when the microcontroller
receives some data from the GPS module, it will also send a copy to your
laptop using a virtual serial connection
over USB.
You can see the data stream by using
a serial emulator such as PuTTY or
HyperTerminal but a better application
is to use software such as BSGPS or
The fuel flow sensor mounted in the fuel line of a Chrysler outboard as
recommended by the manufacturer, ie, vertically between the fuel pump and the
carburettor. (Courtesy Nigel Hall)
October 2010 81
OziExplorer to display your position
on an electronic map (use Google to
search for any of these names).
This type of software can use
scanned copies of your charts and
pinpoint your position on them.
If you search on the Internet you will
find a wealth of other software that will
allow you to navigate, log your movements, play with the GPS Module and
much more. You can also check www.
maps-gps-info.com/fgpfw.html where
almost 500 free GPS-related programs
are listed.
To use this feature you need to
install the Silicon Chip USB Serial
Port Driver on your laptop (available
from the SILICON CHIP website). This
will work with all modern versions
of Windows and full instructions are
included with the driver, so installation should be easy.
The GPS Boat Computer will be
listed on your laptop in the Device
Manager under Ports (COM and LPT)
as “Communications Port – Silicon
Chip USB Serial Port” with a specific
COM port number. When you configD1 1N5819
REG2 LP2950CZ-3.3
OUT
+5.3V
IN
GND
10 F
16V
11
+5.3V
4
Vdd
CVref
K
100k
32
Vdd
MCLR
1
2
RA0
+1.35V
+3.3V
4
Tx
3
Rx
2
GND
25
3.3k
RC1
RA3
Tx
6.8k
RE0
RC0
RB1
RB2
6
CON2
1
4
26
23
2
24
3
18
USB TYPE B
RD0
C1out
RD1
Rx
RD2
D–
RD3
D+
RD4
Vusb
RD5
RD6
220nF
RD7
SET
36
S1
UP
DOWN
S2
37
38
S3
13
X1 20MHz
22pF 22pF
14
7
8
6
15
5
3
4
RA1
IC1
PIC18F4550
33
-I/P
RB0
+5.3V
JP1
16
RC2
RB3
RA5
RB4
RB6
RB5
RE1
OSC1
RE2
RB7
OSC2
Vss
12
Vdd
CLK
CS2
CS1
A0
+12V
IN
A
19
2
5
1
EN
10
100 F
16V
OUT
470nF
D2
1N4004
K
10k
EM-408
GPS MODULE
+5.6V
GND
2x
100nF
22k
REG1 LM2940CT-5
A
220nF
5
V+
ure software on your computer you
will need to specify this number to
establish communications with the
GPS Boat Computer. If the software
also needs to know the communications parameters you can specify 9600
baud with one stop bit and no parity.
When using USB you should make
sure that there is not a jumper on
the pins marked JP1. This jumper is
intended for when you want to only
power the GPS Boat Computer via a
USB cable connected to your laptop.
However, in most cases the GPS Boat
LED+
Vcon
LCD
CONT
3
SG12232A LCD MODULE
RES E R/W
18 8 9
LED–
D7 D6 D5 D4 D3 D2 D1 D0 GND
17 16 15 14 13 12 11 10
1
VR1
10k
CON1
100nF
6-PIN
MINI DIN
20
6
5
3
4
2
34
1
35
19
20
21
82k*
22
27
28
29
30
3.3k
17
C
B
Q1
BC338
E
7
82k
39
(FUEL FLOW SENSOR INPUT)
9
+5.3V
82k
10
(ENGINE RUNTIME INPUT)
8.2k*
(NAVIGATION LIGHTS INPUT)
40
47k
Vss
31
47k
LDR1*
* SEE TEXT
1 2 3 4 5
PC BOARD
EM-408 CONNECTIONS
SC
2010
GPS BOAT COMPUTER
1N5819
1N4004
A
A
K
LM2940, LP2950
BC338
K
GND
B
E
C
IN
GND
OUT
Fig 1. The full schematic for the GPS Boat Computer. It is dominated by the microcontroller which is mostly
concerned with receiving data from the GPS module and driving the LCD. The other items of note are the GPS
module and the two voltage regulators which provide 5.3V and 3.3V.
82 Silicon Chip
siliconchip.com.au
Why every boatie needs one of
these: a true story!
The USB interface connects
to CON2 on the PC
board. Normally a boardmounting socket fits here
but it this case we need it
to be waterproof so it’s off
the board.
(Courtesy Nigel Hall).
Computer will be permanently connected to the boat’s battery
and so you should not install the jumper. Doing this would
cause 5.3V to appear on the USB connector and possibly
damage your laptop.
Circuit Details
Fig 1 shows the circuit diagram for the GPS Boat Computer.
It is identical to the GPS Car Computer with the addition
of a couple of resistors (in spare locations on the PC board)
and so it uses the same PC board and components.
The circuit is dominated by the PIC18F4550 microcontroller, a modern eight bit device manufactured by Microchip. This has a number of features that are important to us.
Firstly it has plenty of input/output pins as we need them
to drive the graphics LCD module. This module uses eight
signal lines for data and another 7 control lines, making for
a total of 15 pins that the micro needs to manage the display.
The LCD module is a graphical device which means that
we can turn off and on any pixel in its 122 by 32 pixels array. We use this capability to show a variety of fonts ranging
from large digits for good readability, to small letters when
space is restricted. We also display some graphic symbols
like a compass pointer.
The microcontroller also has full USB functionality built
in and we can simply connect the USB signal lines direct
to the chip. As described before, this allows us to send GPS
data to a laptop which can then use additional software and
maps to track our position.
The GPS module sends and receives data to/from the
microcontroller using a standard 4800 baud, 8-bit serial
protocol with voltage levels of about 2.7V for a logic high
and zero for a logic low.
The 18F4550 microcontroller needs a voltage higher than
2.7V to reliably detect a logical high. So we first feed the
data from the GPS module through an analog comparator
(in the 18F4550) to obtain voltage levels that can be used by
the micro. The GPS Car Computer article in January 2010
provides more detail of how this works.
Sending data to the GPS module is a little simpler. The
3.3kΩ and 6.8kΩ resistors form a voltage divider to drop
the 5V transmit data signal from the microcontroller to a
level compatible with the GPS module which runs at 3.3V.
The three front panel push buttons are connected directly
to pins 36, 37 and 38 of the microcontroller. Internal pullup resistors are used to hold the inputs at 5V and therefore
siliconchip.com.au
Purely by co-incidence, as this feature was being
prepared for publication one of the SILICON CHIP staff
members, who owns a boat, was talking to a young
acquaintance about boating in general.
The young man admitted that he had owned a boat
previously but had sold it after getting the fright of his
life, swearing off boating for good!
It transpired that he and some mates had taken the
boat out fishing one moonless night on Pittwater, north
of Sydney.
For those who don’t know the area, it is a long, wide
and relatively unpopulated waterway off Broken Bay,
which itself is the very deep estuary leading to the mouth
of the Hawkesbury River.
They’d been fishing for quite a while and in the early
hours of the morning it dawned on them that they didn’t
have a clue where they were. They could have been
anywhere between the southern end of Pittwater and
some 20km away in the Hawkesbury itself. They didn’t
know whether the lights they could see (kilometres away)
were the suburbs on the eastern side of Pittwater, those
on the northern side of Broken Bay or, indeed, the towns
on the Hawkesbury.
After driving around for some time trying (they didn’t
know how long) to get their bearings in the pitch black,
running low on fuel, they also didn’t know if they were
headed upstream, back towards their launch site, or even
straight out to sea (next stop, South America!) Compass?
What was that?
With no light and little or no swell to listen to, they didn’t
know if they were close to any shore (almost all rocky) or
thousands of metres from land. They were, quite literally,
panicking – and as any authority will tell you, panic can kill!
Fortunately, they eventually spotted the lights of a
larger boat at anchor and managed to wake the (rather
unhappy!) skipper to ask for help.
The story had a happy ending – with directions, they
managed to find the boat ramp around dawn – but it did
prompt the very relieved owner to get rid of his boat!
Now, just think of how much easier their lives would
have been if they had one of these GPS Boat Computers
on board: not only would it tell them where they were, it
would also navigate them back to their launching ramp
and/or any other “way points” they entered.
And if they had happened to find that elusive, productive
fishing spot (which they didn’t!) next time they went out
(which they didn’t!), they could have navigated straight
to it (which, of course, they didn’t!).
We believe that a device such as this should be mandatory in every small craft – just in case. We believe that
it’s as essential as life jackets and flares. Larger boats,
especially more recent ones, tend to have GPS navigation
and computing “built in” but small boats, by and large,
do not. Even a hand-held GPS would be better than
nothing but this device gives you extra features that the
hand-held units do not.
As our story shows, you don’t have to head offshore
to get yourself into trouble.
October 2010 83
*
10 F
10k
X1 20MHz
REG2
IC1 PIC18F4550
CON4
3.3k
100nF
S2
100nF
VR1
6.8k
10k S3
(TO LCD MODULE)
82k
100 F
LP2950
Q1
BC338
47k
1
10
3.3k
22k
82k
47k
CON3
CON1
Navigation Lights (pin1)
0V [Ground] (pin3)
Fuel Injector/Sensor (pin5)
R2
*
S1 470nF
R1
*
LDR
100k
CON2
CON5
1
REG1
LM2940
D1
5819
^
D2 1N4004
1
PIEZO BUZZER
220nF
100nF
4
JP1
TO GPS MODULE
22pF
2
220nF
3
22pF
^ PIEZO BUZZER NOT REQUIRED
IN GPS BOAT COMPUTER VERSION
DOUBLE-SIDED BOARD - TOP LAYER ONLY SHOWN
Fig.2: the PC board
component overlay,
D- (white)
along with the
D+ (green)
connections for
0V [ground] (black)
CON1 and CON2.
+5V(red)
shield
The options for
LDR or Nav Light
control (R1/R2/
LDR) are shown
Unused (pin6)
in the table
+12V Power (pin4)
Engine Running (pin2)
below.
1
LDR
Navigation Light
*LDR Install LDR
47kΩ resistor
*R1 8.2kΩ resistor Leave Empty
*R2
Leave Empty 82kΩ resistor
The completed PC board. This
prototype differs slightly from the
final board, particularly around
IC3 (REG2) and also the CON1
and CON2 connectors are shown
here on the PC board. The board
is compact but all components fit
in with plenty of space.
when a button is pushed the microcontroller will detect
this as an input dropping to 0V.
The remaining connections to the microcontroller are
standard. The 220nF capacitor on pin 18 provides smoothing for the micro’s internal 3.3V supply. A 20MHz crystal
connected to pins 13 and 14 provide the main clock for
the chip. Finally, the transistor Q1 connected to pin 17 is
used to control the brightness of the LCD backlight by pulse
width modulation (PWM).
The GPS Car Computer included a piezo buzzer for the
over speed alarm but this is not used by the GPS Boat
Computer firmware. We left it out of the circuit diagram
and you do not need to install it if your device will always
be operating as a GPS Boat Computer.
External Connections
All external connections are made through a 6 pin
connector, CON1. 0V and 12V are on pins 3 and 4 of the
connector and three other pins are used to monitor events
in the boat.
Pin 5 is used for the fuel injector solenoid or paddle wheel
flow sensor input. Pin 1 is used to detect when the boat’s
navigation lights are on (required if the LDR is not used)
and Pin 2 is used to detect when the engine is running. All
of these inputs use a voltage divider formed by 82kΩ and
47kΩ resistors to drop the input voltage to a level that is
compatible with the microcontroller.
If you are building the GPS Boat Computer from a GPS
Car Computer kit then the only additional components
that you need are an 82kΩ resistor at R4 and a 47kΩ
resistor at R5, both for the Engine Running Time input. R3 and R6 are left
vacant (as in the Car Computer) as
the associated input is also not used
in the GPS Boat Computer.
Note that when using the boat’s
navigation lights for
A close up of the circuitry
before being mounted in its sprayproof case. Again, this shows CON1 and
CON2 as being PC board mounting.
84 Silicon Chip
siliconchip.com.au
control a 47kΩ resistor is installed vertically in the position
marked for the LDR and pin 1 on CON1 must be wired to
the circuit powering the boat’s lights.
The microcontroller determines if it is day or night by
monitoring the voltage at pin 40. A high voltage means
that it is night and low means day. By using the following
table when you assemble the PC board you can tell the
Boat Computer that it is day or night via a light dependent
resistor (LDR) or the boat’s navigation lights.
Construction
All the components are mounted on a single PC board
which makes construction relatively easy. Fig.2 shows the
component overlay – follow this diagram rather than that
on any PC board, as some early PC boards had an incorrect
screen print overlay.
The PC board is double-sided and uses plated-through
holes so you need to take a little care with soldering. Use
a temperature-controlled soldering iron and only hold the
iron on a joint for a few seconds. With plated-through holes
it is difficult to remove a component so be careful that you
have selected the right component with the correct orientation before you apply the iron.
Start with the low profile components such as resistors
and work your way up to the taller components such as
the capacitors and transistor. Note that resistors R3 and R6
are marked on the PC board but not installed as they are
reserved for future expansion. Don’t install the microcontroller or the GPS and LCD modules just yet, as you need
to check the power supply voltages first.
Be careful with D1 and D2 as they look alike. The same
applies to Q1 (the transistor) and IC3 (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 PCB so that there is no danger
of the metal case shorting the connecting pads underneath.
The LM2940 regulator (IC2) sits on top of a small heatsink.
Use a small amount of thermal grease between the regulator
and the heatsink to ensure that the heatsink can do its job.
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 moved around to ensure that it has adequate clearance. Once this is correct you can tighten the screw and
nut. 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 a device like the
5.3V
siliconchip.com.au
100nFF
100n
22pFF
22p
22pFF
22p
TO GP
GPS
S MO
MODU
DULE
LE
CON5
CO
N5
1
10 F
10k
X1 20MHz
IC1
IC
1 PIC
PIC18F
18F4550
4550
3.3k
3.
3k
100nFF
100n
REG2
RE
G2
LP2950
LP
2950
D2 1N
1N4004
4004
220nFF
220n
Fig 3. Before you plug 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 correct voltages you
should check D1, D2,
IC2, IC3 and the power
connection.
3.3V
Parts List – GPS Boat Computer.
1 PC board, code 05101101, 140mm x 57mm
1 GlobalSat Technology EM-408 GPS module –
available from Altronics (K1131) or via the ’net.
1 SG12232A 122 x 32 dot matrix LCD
(Altronics Z7052)
1 20MHz low profile crystal (X1)
1 high output sealed mini buzzer, PCB mounting
(Altronics S6105)
1 2-pin header
1 20-pin header
1 20-way single row header socket
(8mm high socket base)
1 micro U-style heatsink for TO-220 (19x19x9.5mm)
Semiconductors
1 PIC18F4550-I/P microcontroller (IC1)
(available from www.futurlec.com)
1 LM2940CT-5 or LM2938ET-5.0 5.0V voltage
regulator – TO-220 package (IC2)
1 LP2950CZ-3.0 voltage regulator TO-92
Package 3.3V (IC3)
1 BC338 transistor (Q1)
1 1N4148 diode (D1)
1 1N5819 Schottky diode (D2)
Capacitors
1 100µF 16V electrolytic (105°C rating)
1 10µF 16V tantalum
1 470nF MKT
2 220nF MKT
3 100nF monolithic
2 22pF ceramic
Resistors (0.25W 5%)
1 10Ω
2 3.3kΩ
1 6.8kΩ 1 8.2kΩ 1 10kΩ
1 22kΩ
3 47kΩ
3 82kΩ
1 100kΩ
1 10kΩ trimpot (vertical mount, front adjust)
1 LDR (light dependent resistor) 10kΩ to 1MΩ
(Altronics Z1621) (optional – see text)
Parts List for the Sealed Case
1 UB3 box [Jaycar HB6013 (black) or HB6023 (grey)]
1 IP67 waterproof USB “type B” female chassis
connector, (Altronics P9725)
1 USB sealing cap (Altronics P9840)
[for when the USB connector is not in use]
1 IP67 6-pin locking chassis mount male connector
(Altronics P9366)
1 IP67 6-pin locking female line connector
(Altronics P9356)
3 SPST momentary pushbutton switches, black
solder tail (Altronics S1084 or Jaycar SP-0700)
6 PC Pin Sockets (Jaycar HP1260)
1 3mm thick Perspex or acrylic sheet, 3mm –
cut to size for UB3 box (Jaycar HM-9509)
4 12mm M3 tapped spacer**
4 10mm M3 untapped spacer**
4 20mm M3 screw**
4 6mm M3 screw**
1 10mm M3 screw** ** preferably nylon or
9 M3 star washer** marine-grade
4 M3 flat washer**
stainless steel
1 M3 nut**
100nFF
100n
6.8k
6.
8k
10k
October 2010 85
Microchip PICkit 3 during software
development.
With the case design shown there
is plenty of space between the main
board and the LCD module so you can
use an IC socket for IC1, which makes
fault-finding and testing much easier.
When handling the microcontroller
and LCD you should take the standard
precautions against electrostatic discharge which could zap these devices.
This means making sure that your
work surface, your soldering iron and
you, are all grounded.
The LCD is not installed yet but
its connectors can be. It plugs into a
20-pin connector on the main board
via a single row 20-pin header strip.
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
PCB and the shorter pins underneath.
Solder and trim 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 with the silk screen printing the
right way up).
The other wires should be soldered
in the same sequence as they emerge
from the connector.
then need to load the GPS Boat Computer firmware from your computer
using the USB interface.
Testing
The firmware for the microcontroller is loaded in a two step process
as illustrated in Fig 4.
First the full copy of the GPS Car
Computer firmware version 1.1 needs
to be programmed into a blank microcontroller using a PIC programmer. A
copy of this firmware can be found on
the SILICON CHIP website under Downloads for January 2010. You only need
to do this once and from then on new
firmware will always be loaded via the
USB interface.
If you built your device from a kit
of parts then the supplier should have
already programmed the chip for you
– so you can skip this and move onto
the next step.
As Fig.4 shows this firmware contains a bootloader. This is a small portion of software, 2KB in size, which sits
in the bottom of memory and watches
to see if the SET button is held down
while power is applied.
The best way to load this software
is to disconnect the GPS Boat Computer from a power source (eg, unplug CON1), place a jumper on JP1,
and connect the GPS Boat Computer
to your computer (via a USB cable
plugged into CON2) while holding
down the SET button. Placing the
jumper on JP1 means that the GPS
Boat Computer will be powered from
the USB interface.
When this condition is detected the
bootloader will take control of the USB
port and reconfigure it to pretend that
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.
With all components in place (except
the microcontroller, switches, GPS and
LCD) you should make a quick test to
ensure that the voltages are correct.
With 12V power applied you should
be able to measure about 5.3V between
pins 11 and 12 of the microcontroller
socket. Between pins 2 and 5 of the
GPS connector (CON5) you should be
a ble to measure 3.3V. Both could vary
by plus or minus 150mV.
Refer to Fig.3 for the measurement
points. If you cannot measure the correct voltages you should check D1, D2,
IC2, IC3 and the power connection.
You can now insert the pre-programmed PIC18F4550 into its socket
(again, follow the component overlay
on P84, as some PC boards show this
upside down!), then plug the LCD
and GPS into the PC board. When you
apply 12V power the LCD should immediately show the firmware version
followed by a message indicating that
it is searching for satellites.
You may need to adjust the 10kΩ
trimpot to get an image on the display
and then continue adjusting it for a
good contrast.
The device will start-up as a GPS Car
Computer as that is the initial firmware
loaded in the chip by the kit supplier.
As explained in the next section, you
GPS CAR
COMPUTER
GPS BOAT
COMPUTER
BOOT
LOADER
BOOT
LOADER
Fig.4a: a “factory fresh” or blank microcontroller
must first be programmed using a PIC programmer
such as the PICkit3. This will load two components,
a bootloader, which is responsible for future
program updates and the GPS Car Computer
firmware. If your microcontroller came in a kit then
the kit supplier should have already programmed
the microcontroller and you can skip this step.
86 Silicon Chip
Loading the firmware
Fig.4b: to load the GPS Boat Computer firmware,
you should hold down the SET button while
applying power. The bootloader will take control
and establish communications with your computer
over the USB interface, allowing you to upload new
firmware via USB – no programmer is required.
Using this method you can also load other updates
or revert to the GPS Car Computer firmware.
siliconchip.com.au
Fig.5: while the
electronics is
basically the same,
there are some
layout differences
between this
diagram and the
GPS Car Computer
from last January
– mostly to do with
ensuring moist
air or even the
occasional greenie
doesn’t play havoc
with the works!
THIN BEAD OF NEUTRAL
CURE SILICONE SEALANT
FRONT PANEL
PUSHBUTTON SWITCHES
FRONT PANEL
MOUNTING SCREWS
CLEAR FRONT PANEL
(RECESSED INSIDE THE UB3 BOX)
LCD MODULE
LCD MODULE PC BOARD
12mm LONG
UNTAPPED
SPACERS
20-WAY SIL SOCKET
10mm M3
TAPPED SPACERS
MAIN PC BOARD
BACK OF UB3 BOX
IP67 RATED
USB CONNECTOR
(CON2)
it is a Microchip PICDEM FS evaluation board. Your computer will recognise this new device and prompt you
to load the appropriate device driver
(included in the software package).
To upload the GPS Boat Computer
firmware you need to run software that
knows how to reprogram the PICDEM
FS board (which is what the microcontroller is pretending to be). As shown
in Fig.4 this software will overwrite
the upper portion of the firmware
while still leaving the bootloader (that
is stored in lower memory) in control.
When you subsequently remove and
reapply the power (without holding
down any buttons) the micro will run
the firmware in the upper portion of
memory and your gadget will have
changed to a GPS Boat Computer.
While this process might sound
complex reprogramming only takes 20
seconds and all the necessary software
and instructions are included in the
software package on the SILICON CHIP
website. The software package also
includes a USB-loadable version of the
GPS Car Computer firmware so that
you can go back to that if you need
to. However, you should note that all
settings will be lost if you do this.
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 carefully measuring the voltage between pin 4 and
pin 12, which should be between
siliconchip.com.au
20mm M3 SCREWS
WITH STAR
LOCKWASHERS
6-PIN MINIATURE IP67
LOCK DOWN CONNECTOR
(CON1)
1.2V and 1.5V. This voltage is created
by the internal voltage reference and
implies that the firmware is running
and that the microcontroller is OK. In
the absence of this voltage, check pins
13 and 14 with a ’scope for a 20MHz
sine wave, indicating that the main
clock is present.
Next is the LCD. First check the
voltage on pin 3 of the LCD (VCON) – 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 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 (watch
for bent pins!) 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,
6mm M3 MACHINE SCREWS
WITH STAR & FLAT WASHERS
ALL SCREWS, NUTS, WASHERS ETC SHOULD BE
MARINE GRADE STAINLESS STEEL
so that type of fault should be obvious.
Don’t worry if the GPS Boat Computer initially sits with the LCD showing a message saying “SEARCHING”.
The GPS module normally keeps
track of the available satellites in its
internal memory, which is kept alive
by a super capacitor. If this capacitor
has lost its charge, the module will
have to reload the tracking information from a satellite - and this can take
up to 15 minutes. This only happens
once, subsequently the GPS will use
its memory of the data and start up in
45 seconds or less.
If, after a long wait, the GPS module
still cannot get a signal you should
try moving the unit outside or near a
window so that it can “see” the sky.
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.
It is possible for the GPS module or
the microcontroller lock up or crash. If
this happens you can press and hold
the DOWN button while plugging the
GPS Boat Computer into power. This
will cause the microcontroller to reset
+12V
GPS BOAT
COMPUTER
CON 1, PIN 5
+0V
Fig.6: the connections we made to our flow sensor. The 3.3kΩ resistor is
required to pull up the output voltage as the sensor used an open-collector
output. Your sensor will probably be similar but check the documentation.
October 2010 87
Resistor Colour Codes
o
o
o
o
o
o
o
o
o
No. Value
1 100kΩ
3 82kΩ
3 47kΩ
1 22kΩ
1 10kΩ
1 8.2kΩ
1 6.8kΩ
2 3.3kΩ
1
10Ω
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 red brown
blue grey red brown
orange orange red brown
brown black black brown
itself to the default settings and send
a command to the GPS module also
resetting it to its factory defaults.
Spray Proof Enclosure
The original GPS Car Computer was
designed for use in a car and therefore
no attempt was made to protect its
internals from the elements. This is
definitely not acceptable in a marine
environment. We recommended a case
that can be completely sealed so that
the electronics are protected from corrosive salt air (it doesn’t even have to
be salt spray).
It’s not so much that the case needs
to be waterproof to stop water getting
in – if that situation occurs you’re in
much more trouble than a GPS Boat
Computer can assist with – but the
moist air on a boat usually gets into
everything and starts attacking any
metal it can.
Nigel Hall, who suggested the GPS
Boat Computer, also developed an alternative case and we describe it here.
Nigel’s design comprises a Jaycar UB3
“jiffy” box (130 x 67 x 43 mm) with a
front panel fabricated from a sheet of
clear Perspex or Acrylic.
The push buttons are mounted
on the front panel while the USB
connector (CON2) and the 6 pin connector (CON1) are panel mounting
components and are attached to the
rear panel. These connectors are IP67
rated (immersion up to 1m) and have
a rubber sealing washer which is best
installed on the inside of the box.
While the front panel push buttons
are not rated at such a high standard
they should be adequate.
These switches and connectors
replace the corresponding board
mounted components used in the GPS
Car Computer so they need to be wired
to the solder pads for the original components. Fig.2 illustrates the wiring
88 Silicon Chip
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
for the connectors (CON1 and CON2)
and this should be implemented using lightweight hookup wire running
from solder stakes on the PC board to
the connectors.
The front panel buttons also connect to the PC board with lightweight
hookup wire The best way to do this
is use short wires and PC pin sockets
(Jaycar HP1260) to plug the leads onto
pins soldered onto the main board.
This will allow you to easily remove
the front panel for testing without
having to use long and unsightly wires
which could be seen through the clear
front panel.
Assembly
As Fig.5 shows, the completed
assembly of main PC board and the
LCD module are separated by spacers
and mount using more spacers onto
the bottom of the box. When putting everything together it is best to
first attach the LCD module to the
main board using the 20mm machine
screws which run through the 12mm
Capacitor Codes
Value F value IEC Code EIA Code
470nF 0.47uF
470n
474
220nF 0.22uF
220n
224
100nF 0.1uF
100n
104
22pF
–
22p
22
untapped spacers and fasten onto the
10mm tapped spacers. This assembly
can then be easily lowered into the
box and secured by the 6mm screws
through the bottom of the box.
To allow the GPS module to fit in its
position you will need to trim some of
the plastic ribs. You’ll also need to drill
a hole in the rear so that the external
antenna connector can poke though.
This also helps to hold the module in
position. Normally you will not need
access to this connector so you can
cover the hole with a square of adhesive tape to keep the elements out.
Even better for waterproofing is a dob
of neutral-cure silicone sealant – but
you must be sure you’re never going
to connect an external antenna!
In the Jaycar UB3 box the top of the
mounting pillars (which secure the
front panel) sit about 3mm below the
top edge of the box. This allows you
to sit the front panel inside the edges
of the box and, using some marinegrade stainless steel screws (not the
ones supplied with the box!), securely
fasten the front panel to the mounting
pillars.
This cannot be easily achieved with
the Altronics version of the UB3 box,
as their mounting pillars extend to the
top of the box, preventing you from
The rear of the prototype spray-proof case showing the mounting screws, weatherproof connectors and the hole drilled for the GPS module’s external antenna
connector. This hole should be sealed when not in use. (courtesy Nigel Hall).
siliconchip.com.au
easily recessing the front panel. You
could grind down these pillars to allow
for recessing but achieving the same
level on each pillar migh be difficult.
For protection, immediately before
screwing the front panel in place (and
only after all testing and troubleshooting) a thin bead of silicone sealant can
be run around the edge of the Perspex
or Acrylic lid to properly seal it. As a
final touch you could, if you wished
to hide the electronics, attach a label
(with a cutout for the LCD) on the
inside surface of the clear front panel.
Wherever possible, the screws, nuts,
washers and spacers used should be
marine-grade stainless steel (which
you may have to source from a ships’
chandlery). Even with a sealed case
standard hardware will corrode on a
boat, often quite quickly.
One unfortunate outcome of a sealed
case is that it could get quite hot inside due to the heat generated by the
LM2940 regulator (IC2). To reduce this,
you could place an external 12Ω 5W
resistor in series with the 12V supply
(on pin 4 of CON1). This will reduce
the supply voltage to the GPS Boat
Computer by 3 volts and correspondingly reduce the heat generated by the
regulator by up to 40%.
Installation
There are five connections that you
need to make from the mini-DIN power
and input connector (CON1) to your
boat’s electrical system. These are illustrated in Fig.2 and consist of:
• Pin 4, which is the main power
(+12V) input to the GPS Boat Computer and should be connected to
a power source that is powered on
whenever you would want to use
the GPS Boat Computer. This is not
usually the engine ignition switch,
as there are times when you want
to know your position without the
engine running (eg, drifting over a
fishing ground).
As explained in the previous section, if you are using the sealed case
design you should also install an
external 15Ω 5W resistor in series
with the +12V supply to reduce the
heat generated inside the case. The
supply must also be protected with
a 500mA fuse either inline or via a
fuse block.
• Pin 3 is the ground (negative).
• Pin 2 should connect to the engine
ignition circuit and is used to determine the engine’s running time.
siliconchip.com.au
This input should be at +12V when
the engine is running and zero volts
when not.
• Pin 1 is used to control the brightness of the display when an LDR
is not used. It should be wired to
the circuit for the boat’s navigation
lights so that +12V is present on the
line when the navigation lights are
illuminated (ie, after sunset).
• Pin 5 is the input for the fuel consumption measurement and should
be connected to either the fuel injector solenoid or fuel flow sensor
depending on the version of the
firmware loaded.
• Pin 6 is not connected. It is available
for future development.
If you are using the fuel injector
sense method you will have to connect
pin 5 on CON1 to the negative lead
of one of the fuel injector solenoids,
preferably near the engine management unit as that position should be
more protected from salt spray and
other environmental hazards.
If you are using a paddle-wheel sensor you will probably need to connect
it to the same source of power used by
the GPS Boat Computer and install a
pull-up resistor on the output line
which connects to the GPS Boat Computer. Fig.6 shows the connections that
we made to our sensor – yours will
probably be similar.
The reason for the resistor is that
most paddle-wheel sensors have an
open collector output where a transistor in the sensor will pull the output
low and the resistor is needed to pull
it high again when the transistor is
turned off. Typically a 3.3kΩ resistor
wired to the 12V supply will be sufficient but your sensor might already
have the resistor built in, so check the
documentation.
You should also refer to the documentation for your device when determining how and where it should
be mounted.
Generally the manufacturer will
recommend that it be mounted vertically between the fuel pump and the
carburettor but before any pressure
regulator. This is to minimise the formation of vapour pockets.
So, that is the GPS Boat Computer.
All that is left is to wish you “happy
navigating” (and perhaps “great fishing!”).
For up to date errata, notes and
new firmware go to http://geoffg.net/
boatcomputer.html
SC
Helping to put you in Control
Control Equipment
Port Powered
Isolated RS232
to RS485 Converter
Optical isolation
effectively protects this RS-232 to RS
-485 converter from transient surges,
ground loop, and lightning.
TOD-008 $52.50+GST
Capacitive Proximity Switches Available in M12, M18 and
M30 diameter. They
are 4 wire NO+NC and
are available with NPN
or PNP outputs.
IBC-009 From $49.00+GST
DIN Rail Springcage Terminals.
So much faster to
use than screw terminals. A screwdriver is used to open
the terminal, allowing insertion of the wire.
TRM-215 From $0.99+GST
myPCLab
Compact Data Acquisition tool connects to
a PC via a USB port
and monitors 2 universal analog inputs
(Thermocouple, RTD, 4-20mA and
volts). NOV-010 $129 +GST
Split Core Current
Transformer. Want
to measure AC current
consumption. This
small current transformer outputs 020mA AC over 0-60A
AC primary current.
ALT-051 $29.95+GST
Freetronics Ethernet
Shield with POE. Let
your Arduino controller
do Twitter updates
automatically, serve
web pages, connect to web services,
display sensor data online, and control devices using a web browser.
FRA-002 $40.85+GST
Ph: 03 9782 5882
New, Easier to Use Website
www.oceancontrols.com.au
October 2010 89
|