Professional Documents
Culture Documents
com
Page 1 of 6
LEARN.PARALLAX.COM
TUTORIAL T!AC" PRO#!CT CO$T! T I$ PIRATIO$ CLA ! % !&!$T
Search
Tutorials
Tutoria!s <ome #ro e!!er C Bearnin% System #ro e!!er ,=3 Tutoria!s ,=3 Shie!d Tutoria!s ,4S)C Stam Tutoria!s S2 'obot Tutoria!s ,S4 'obotics Merit ,ad%e "ith the ,oe-,ot Microcontro!!er :ickStarts microMedic Aemos 'e&erence
Mi"ro"o$troller %i"&Starts
Microcontro!!er :ickStarts <ome 2-46is Foystick 261- Seria! BCA 0,ack!it1 "ith S eaker .-Airectiona! Ti!t Sensor 5-#osition S"itch
4!timeter Modu!e Com ass Modu!e 5-46is G#S Modu!e #M,-./ Gyrosco e Modu!e 5-46is Memsic 2125 Aua!-a6is 4cce!erometer #)2G111 7!trasonic Aistance Sensor #)' Sensor #ara!!a6 Continuous 'otation Ser$o #ara!!a6 Standard Ser$o #o!ar <eart 'ate 'ecei$er >T) Sensor Sound )m act Sensor
What It Can Do
Tracks u to 20 sate!!ites, "ith u dates at !east once a second #ro$ides %eo-!ocation data &or robots, $ehic!es, custom G#S units 'ecei$es si%na!s outdoors or indoors( usin% a bui!t-in antenna ()ndoor rece tion is de endent on !ocation "ithin the bui!din%, thickness o& construction materia!s, and other &actors* +or the most consistent resu!ts, the G#S recei$er shou!d ha$e a c!ear $ie" o& the sky* The #M,--./ is a se!&-contained %!oba! ositionin% sate!!ite 0G#S1 recei$er, ca ab!e o& ro$idin% accurate !atitude, !on%itude, a!titude, s eed, headin%, and other in&ormation use&u! &or na$i%ation* The data ro$ided by the modu!e is in the industry standard 2M3401/5 $2*2 &ormat, makin% it easy to inter ret and use* G#S data consists o& te6t sentences that contain !atitude, !on%itude, and other in&ormation* 3ach sentence consists o& a re&i6, !us one or more b!ocks o& data, each se arated by a comma* 7sin% a microcontro!!er, you can arse each sentence to e6tract 8ust the na$i%ation in&ormation you9re !ookin% &or* +or the e6am !es in this :ickStart on!y the !atitude and !on%itude in&ormation is arsed and rocessed*
;hi!e G#S recei$ers !ike the #M,--./ &o!!o" a standard data rotoco!, there can be $ariations bet"een makes and mode!s o& recei$ers in ho" the data is ro$ided* This :ickStart is s eci&ica!!y "ritten &or the #M,--./ modu!e, and the ro%rammin% e6am !es may not "ork ro er!y "ith other G#S recei$ers*
G,ee ;ire!ess #ack 7sin% 4rduino =b8ect Bibraries 7sin% #ro e!!er =b8ects 7sin% the #ara!!a6 Seria! Termina!
Parts List
#M,--./ G#S modu!e ,4S)C Stam <ome;ork ,oard, #ro e!!er ,=3, #ro e!!er >uickStart, or 4rduino 7no microcontro!!er 22 %au%e so!id conductor hooku "ire
Basic Wiring
h p!//learn.parallax.com/"#c$S ar /28%00
14/01/2014
Page 2 of 6
#o"er consum tion: -5 m4 H 5 @AC Communications: TTB or 'S-252 asynchronous seria! H ./00 b s Su orted 2M34 sentences: GG4, GS@, GS4, 'MC 0o tiona! @TG, GBB1 Aimensions: 1*25 6 1*25 6 *55 in 052 6 52 6 I mm1
+or ro er o eration the G#S modu!e re?uires a 1 to 5 minute "arm-u eriod, in order to ac?uire sate!!ite data* 4c?uisition time may be increased i& the modu!e is used indoors, or near radio inter&erence* 4 red B3A on the modu!e indicates sate!!ite !ock* ;hen the B3A is b!inkin%, the G#S modu!e is sti!! ac?uirin% data, and its out ut may not be re!iab!e* ;ait unti! the B3A is on steadi!y be&ore readin% the data &rom the modu!e*
BA IC
Do*n+oad BA IC ' {$STAMP BS2} ' {$PBASIC 2.5} LatDeg LatMin LatMinD LatSign LatDir LonDeg LonMin LonMinD LonSign LonDir Va! VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR
Byte Byte Word Byte Byte Byte Byte Word Byte Byte Word
'Ba"d rate# $non%in&erted'( n)*++ C,- .** n/0++ C,- *) Main( '1et 1PSRMC #tate2ent 3ro2 4in + S5RI- +6 n)*++6 7WAIT$8RMC68'6S9IP .:6 D5C2 LatDeg6 D5C2 LatMin6 S9IP .6 D5C LatMinD6 S9IP .6 LatSign6 D5C: LonDeg6 D5C2 LonMin6 S9IP .6 D5C LonMinD6 S9IP .6 LonSign; 1,S<B AddSign PA<S5 =0+
h p!//learn.parallax.com/"#c$S ar /28%00
14/01/2014
Page 3 of 6
wVal = (LatMin * 1000 / 6) + (LatMinD / 60) 'convert to min/seconds SE !"# 16$ n%600$ & E' ()(*LatDir$ DE+ LatDe,$ (-($ DE+. wVal$ ($ (/ wVal = (LonMin * 1000 / 6) + (LonMinD / 60) 'convert to min/seconds SE !"# 16$ n%600$ & E' ()(*LonDir$ DE+ LonDe,$ (-($ DE+. wVal$ + / 0!#! Main DE1"0 +
8ddSi,n9 :; LatSi,n = (S( #<E= LatDir = 1 ELSE LatDir = 0 E=D:; :; LonSi,n = (>( #<E= LonDir = 1 ELSE LonDir = 0 E=D:; E#" =
;hen this ro%ram is run, the ,4S)C Stam Aebu% Termina! "i!! automatica!!y o en*
Pro)e++er BO! and Pro)e++er 23ic( tart Propeller BOE Wiring Diagram
!!p"//learn.parallax.com/#$c%S!ar!/28&00
14/01/2014
Page 4 of 6
Do*n+oad Pro)e++er OBJ Debug GPS FS CON _CLKMOD _"(NF) * P-B (nit . /0
1Start FullDuplexSerialPlus ter2inal Debug3Start45%6 5,6 ,6 %%+7,,8 Debug3Str4String4")ea9ing GPS333"88 :aitCnt4Cl;Fre< = 7 & Cnt8 1Start GPS ob>e?t6 GPS ?onne?te9 to P@ GPS3(nit )epeat Debug3Str4String4%'6 %88 FS3SetPre?ision4@8 /0 :! GPS3Float_Latitu9e_Deg (/ /0 AB /loatNaN Debug3Str4FS3Float#oString4/088 lse Debug3Str4String4"CCC"88 1 Get latitu9e
Debug3Str4String4"6"88 /0 :! GPS3Float_Longitu9e_Deg 1 Get longitu9e (/ /0 AB /loatNaN Debug3Str4FS3Float#oString4/088 lse Debug3Str4String4"CCC"88 :aitCnt4Cl;Fre< D 7 & Cl;Fre< D E & Cnt8 D$# /loatNaN LONG F@FFF_FFFF 1Means Not a Nu2ber
Important! This ro%ram uses the &o!!o"in% ob8ect !ibraries, "hich are inc!uded in the do"n!oad* To use this ro%ram you must inc!ude these !ibraries in the same &o!der as the ro%ram &i!e* The !ibrary contains se$era! &i!es in a Ki archi$e* See instructions &or usin% #ro e!!er
!!p"//learn.parallax.com/#$c%S!ar!/28&00
14/01/2014
Page & of 6
ob8ect !ibraries &or more in&ormation* +!oatMath*s in +!oatStrin%*s in +u!!Au !e6Seria!#!us*s in G#SL+!oatLBite*s in G#SLStrL2M34LBite*s in
To $ie" the resu!ts o& the demonstration, a&ter u !oadin% is com !ete run the #ara!!a6 Seria! Termina! &rom the 'un menu, or ress +12* Momentari!y de ress the 'eset button on the #ro e!!er >uickStart board to restart the ro%ram*
Ard3ino Uno
Do*n+oad Ard3ino 450 Code ,or the P-B./08 1P Do*n+oad Ard3ino Pre.re+ease &ersion Code ,or the P-B./08 1P #include <SoftwareSerial.h> #include "./TinyGPS.h" TinyGPS ps! SoftwareSerial nss"#$ %&&'! void setup"' ) Serial.*e in"11&%00'! nss.*e in"+,00'! Serial.println""-eadin .
GPS"'!
void loop"' ) *ool newdata / false! unsi ned lon start / 0illis"'! while "0illis"' 1 start < &000' ) if "feed ps"'' newdata / true! . if "newdata' ) psdu0p" ps'! . .
// Get and process GPS data void psdu0p"TinyGPS 3 ps' ) float flat$ flon! unsi ned lon a e! ps.f4 et4position"3flat$ 3flon$ 3a e'! Serial.print"flat$ +'! Serial.print""$ "'! Serial.println"flon$ +'! . // 5eed data as it *eco0es availa*le *ool feed ps"' ) while "nss.availa*le"'' ) if " ps.encode"nss.read"''' return true! . return false! .
!!p"//learn.parallax.com/#$c%S!ar!/28&00
14/01/2014
Page 6 of 6
Important! The Arduino Pre-release versions of the IDE of the sketch uses the following object libraries, which must be downloaded se arately, and laced inside the Arduino !ibrary folder" # $ew%oft%erial # Tiny&P% %ee instructions for adding Arduino object libraries for additional information'
To view the results of the demonstration, after u loading is com lete click the %erial (onitor icon in the Arduino IDE' This dis lays the %erial (onitor window' (omentarily de ress the )eset button on the Arduino board to restart the sketch'
Printer-friendly version
h p!//learn.parallax.com/"#c$S ar /28%00
14/01/2014