GPS Code/Wiring Question
NWCCTV
Posts: 3,629
I am thinking of adding GPS to my Wild Thumper but I want to test it out and see how well it works outside in my limited space. I downloaded some Spin code from the OBEX but before I go any further I need to verify the attached diagram. The wiring diagram states to run Blue Wire to the Emitter, P10 to Base and Collector to Ground. So, what exactly does this mean? Do I run P10 to a spot on my breadboard and connect the Blue Wire there and they both then go to Vss? I am somewhat confused on that statement and do not want to burn out my GPS.
┌──────────┐
N/C ─┤ │
N/C ─┤ │
Vss ─┤Black │
Vdd(5v)─┤Red │
┌──────────┤Blue │
│ P15 ─┤Yellow │
│ └──────────┘
│
│ *Blue wire to the Emitter
P10─ ─────────*P10 to the Base
│ *Collector to Ground
└──Vss
}'-----------------------------------------
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
CR = 13
LF = 10
OBJ
PST : "Parallax Serial Terminal"
GPS : "GPS_Float_Lite"
FS : "FloatString"
Serial : "FullDuplexSerial"
VAR
Long Counter
Long Lat, Lon
PUB Main
counter := 0 'The counter is here so that you can see how fast the code is executing
PST.Start(9600) 'Starts the PST at 9600 baud to view data and messages
PST.Clear 'Clears the PST of any data or characters
waitcnt(clkfreq*2+cnt)
PST.str(string("GPS Warmup"))
waitcnt(clkfreq*10+cnt) 'Gives the GPS 10 seconds to warm up
PST.Newline
PST.str(string("Disabling S/N"))
Serial.Start(15,10,0,4800) 'Starts a serial line that will be used to re-configure the GPS from
'static navigatino to constant navigation
Disable_Static_Nav
PST.Newline
PST.str(string("Complete"))
waitcnt(clkfreq+cnt)
PST.Clear
Serial.stop 'Stops the serial line that re-configured the GPS, allowing us to use the
'same I/O pins in the GPS_Float_Lite object to receive the newly configured
'data.
GPS.Init 'Starts the GPS_Float_Lite object
FS.SetPrecision(7) 'Sets FloatString's precision to 7 digits(the maximum value)
repeat
Lat := GPS.Float_Latitude_Deg '
Lon := GPS.Float_Longitude_Deg
Display
counter++
if counter == 50000
counter := 0
waitcnt(clkfreq/2+cnt)
PRI Display
PST.Home
PST.str(string("Lat: "))
PST.str(FS.FloatToString(Lat))
PST.str(string(" "))
PST.Newline
PST.Newline
PST.str(string("Lon: "))
PST.str(FS.FloatToString(Lon))
PST.str(string(" "))
PST.Newline
PST.Newline
PST.str(string("Cnt: "))
PST.dec(counter)
PST.str(string(" "))
PRI Disable_Static_Nav | i
waitcnt(cnt + clkfreq)
Serial.str(string("$PSRF100,0,4800,8,1,0*0F", CR, LF)) 'Switch to SiRF binary protocol at 4800,8,N,1
'Diable Static Navigation
waitcnt(clkfreq + cnt)
repeat i from 0 to 9
Serial.tx(DisStatNav[i])
'Switch back To NMEA Protocol Message ID 129, leave only GGA and RMC strings and keep speed at 4800
waitcnt(clkfreq / 2 + cnt)
repeat i from 0 to 31
Serial.tx(BackToNMEA[i])
DAT
floatNaN LONG $7FFF_FFFF 'NaN code
'SiRF Disable Static Navigation, Message ID 143
DisStatNav byte $A0,$A2,$00,$02,$8F,$00,$00,$8F,$B0,$B3
'Switch back To NMEA Protocol Message ID 129 at 4800 bauds, leave on GGA and RMC strings updating oce per second.
BackToNMEA byte $A0,$A2,$00,$18,$81,$02,$01,$01,$00,$01
byte $00,$01,$00,$01,$01,$01,$00,$01,$00,$01
byte $00,$01,$00,$01,$00,$01,$12,$C0,$01,$61
byte $B0, $B3

Comments
That symbol is for a PNP transistor...
File:Transistor PNP symbol.png - Wikimedia Commons
Place a 'common' PNP transistor into a breadboard:
Connect the blue wire to the PNP transistor's emitter.
Connect the Prop's P10 to the PNP transistor's base. (A resistor may be needed between P10 and the base)
Connect the PNP transistor's collector to ground.
dgately
Where did the diagram come from (from what spin project does that file exist?)? If that schematic is actually correct, you could use any pot the following transistors.
Generic amplifier PNP transistor choices:
2N3906
2N2907
You should look at a data sheet of one of these.
As far as the resistor to use, start high and use the highest that allows the Prop to receive data :-) I would start at 1K and reduce as far as down to 330 Ohm... (Just a guess, you may want advise from much more knowledgable forum folk).
The resistor is just protection since P10 will be an input... My assumption is that it's there just in-case there's a surge when the board and the GPS are turned on.
dgately
EDIT: Not sure why I did not pick up on the diagram being of a transistor. I know what emitter, base and collector are from. Must be working on this project too much. Time to take a break!!!
http://learn.parallax.com/project/constant-navigation-gps/wire-emitter-follower-circuit