| ..................
|
Modified 04/10/03
This GPS-related schematic and source code
are intended for demonstration purposes only.
They are offered "as-is". Use at your own risk.
Nothing precludes good navigation practices.
Code and circuits (and more) are here.
Introduction
This circuit is an eight-point LED display unit that uses NMEA-0183
data from a GPS receiver. Although the GPS provides accuracy to a tenth
of a degree, that kind of accuracy is not really necessary in the automotive use
for which I designed this display.
Specifications
- Power: 10-16VDC at ~20mA
- Data: NMEA-0183 2.0 format (4800 baud, TTL level, RMC data sentence)
Construction
Mount eight LEDs in a radial pattern every 45°, such as illustrated below. I also
put in three LED's in the center with a series resistor to make them dimmer than the
eight outer LEDs.
Operation
Apply power to the GPS and to the display. After the
GPS initializes, the display should show heading by illuminating one
of the eight LEDs.
If the GPS sends a "satellite warning flag" or if there is an RS232 framing (baud rate)
error, or if data stops for over four seconds, the display will go dark.
Technical Reference
HARDWARE
- The PIC is configured for power-on delay and brownout reset to guarantee
proper resetting of the PIC. MCLR is not used.
- I wired the circuit in midair so that I could pot it in polyester resin.
I first epoxied the LEDs to a piece of paper in the desired configuration,
wired the circuit, then later constructed a cardboard "dam" around the periphery
to contain the resin while it hardened.
- After pouring in the blue resin and letting it harden overnight,
I ground the block face and edges down to the desired dimensions
and buffed the surfaces. The unit is approximately 1.5" wide.
- Because I potted this unit, I brought out the programming port connections
at the back of the unit, as illustrated
below, in case I wanted to change the program at some
point (and I already have.)
SOFTWARE
- Basic sequence: The main loop code selects the NMEA-0183 $GPRMC data sentence
that will be looked for among the multiple sentences in the data stream from the GPS.
The serial stream is received by the hardware UART and serviced by the RDA
serial interrupt. After the beginning of the sentence is identified as $GPRMC, the
remainder of the sentence is saved in RAM. When the end of the sentence is
received, the main loop calls the parsing routine to extract certain data
fields for display, specifically the heading data (based on true north)
and the local magnetic variation that is used to convert true heading to
magnetic heading. The display is updated at the rate at which the GPS sends
it's data stream out (every two seconds in the case of the GARMIN-38.)
- The code doesn't capture and check the checksum characters at the
end of the data sentence.
- Below is the data sentence stream that is transmitted from my Garmin 38
every two seconds at 4800 baud. The RMC sentence is the only one the
repeater uses. The heading and magnetic variation fields are red.
This is similar to what you should see from your GPS
if you look at the data stream with HyperTerm or Procomm or similar
terminal emulators.
$GPGLL,4400.000,N,07143.125,W,020822,A*35
$PGRMZ,584,f,3*12
$PGRMM,WGS 84*06
$GPBOD,347.7,T,004.3,M,MOB,R2NHB*23
$GPRTE,1,1,c,0,TYC,R2NHB,MOB*01
$GPWPL,4119.832,N,07205.454,W,TYC*16
$GPRMC,020824,A,4400.000,N,07143.125,W,000.0,038.6,161201,016.6,W*7C
$GPRMB,A,9.99,L,R2NHB,MOB,4437.379,N,07300.351,W,066.9,304.5,,V*66
$GPGGA,020824,4400.000,N,07143.125,W,1,00,2.0,177.9,M,-32.2,M,,*7F
$GPGSA,A,3,,,,,,,,,,,,,10.1,2.0,3.0*03
$GPGSV,1,1,00,,,,,,,,,,,,,,,,*79
$PGRME,15.0,M,22.5,M,15.0,M*1B
- If you find that you are not seeing any LED's illuminate and you know
that you are getting a data stream from the GPS, it could be that you have
the GPS receiver sitting on your bench inside a structure and therefore
not able to receive satellites. In that case your GPS deliberately puts
out the warning ("V" character instead of the "A" character you see in
those sentences above.) My Garmin 38 has a simulation mode that enables
me to avoid these errors and make it work on the bench.
CORRECTIONS OR UPDATES
|