{"id":1655,"date":"2018-03-30T14:44:15","date_gmt":"2018-03-30T05:44:15","guid":{"rendered":"http:\/\/blog.moramcnt.com\/?p=1655"},"modified":"2018-03-30T14:46:25","modified_gmt":"2018-03-30T05:46:25","slug":"raspberry-pi3-gps-%ec%97%b0%eb%8f%99","status":"publish","type":"post","link":"http:\/\/blog.moramcnt.com\/?p=1655","title":{"rendered":"Raspberry Pi3 GPS \uc5f0\ub3d9"},"content":{"rendered":"<p>1. \ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 \ubc0f \uc124\uc815<br \/>\n1) \ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0<br \/>\n&#8211; GPS \uc5f0\ub3d9\uc744 \uc704\ud558\uc5ec NEO-6M \ubaa8\ub4c8\uc744 \uc774\uc6a9\ud558\uc600\ub2e4.<br \/>\n&#8211; NEO-6M\uc744 \ub77c\uc988\ubca0\ub9ac\ud30c\uc774\uc5d0 \uc5f0\uacb0\ud558\uae30 \uc704\ud574\uc11c NEO-6M\uc758 \ud540\uc744 \ub2e4\uc74c\uacfc \uac19\uc774 \uaf42\uc73c\uba74 \ub41c\ub2e4.<\/p>\n<table style=\"height: 200px;\" width=\"453\" border=\"1\">\n<tbody>\n<tr>\n<td style=\"width: 68.84px;\">NEO-6M<\/td>\n<td style=\"width: 68.83px;\">\ub77c\uc988\ubca0\ub9ac\ud30c\uc7743<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 68.84px;\">VCC<\/td>\n<td style=\"width: 68.83px;\">PIN01(3.3v)<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 68.84px;\">RX<\/td>\n<td style=\"width: 68.83px;\">PIN10(GPIO15)<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 68.84px;\">TX<\/td>\n<td style=\"width: 68.83px;\">PIN08(GPIP14)<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 68.84px;\">GND<\/td>\n<td style=\"width: 68.83px;\">PIN14<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><a href=\"http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2018\/03\/GPS\uc5f0\ub3d9.jpg\"><img decoding=\"async\" src=\"http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2018\/03\/GPS\uc5f0\ub3d9.jpg\" alt=\"\" width=\"400\"  class=\"alignnone size-full wp-image-1667\" \/><\/a><\/p>\n<p>2) \ub77c\uc988\ubca0\ub9ac\ud30c\uc774 \uc124\uc815<br \/>\nGPS\ub97c \uc2dc\ub9ac\uc5bc\ub85c \uc5f0\uacb0\ud558\uadc0 \uc704\ud574 \ub2e4\uc74c\uacfc \uac19\uc774 \uc124\uc815\uc744 \uc218\uc815\ud55c\ub2e4.<br \/>\n&#8211; cmdline.txt \ud30c\uc77c \uc218\uc815<\/p>\n<pre>\r\nsudo vi \/boot\/cmdline.txt\r\n<\/pre>\n<pre>\r\ndwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=53707d2f-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait\r\n<\/pre>\n<p>&#8211; \ud30c\uc774\uc36c3 \uc2dc\ub9ac\uc5bc\ub85c GPS \ub370\uc774\ud130\ub97c \ubc1b\uae30 \uc704\ud574 \uc2dc\ub9ac\uc5bc\ubaa8\ub4c8 \uc124\uce58<\/p>\n<pre>\r\nsudo apt-get install python3-serial\r\n<\/pre>\n<p>2. NMEA(National Marine Electronics Association) \ud504\ub85c\ud1a0\ucf5c \ubd84\uc11d<br \/>\n GPS \ubaa8\ub4c8\uc744 \uc5f0\uacb0\ud558\uba74 \ubb38\uc790\uc5f4\ub85c \ub41c GPS \ub370\uc774\ud130\uac00 \ub118\uc5b4\uc624\ub294\ub370 \uc774\ub97c NMEA \ub370\uc774\ud130\ub77c \ud558\uace0,<br \/>\n \uc6b0\ub9ac\ub294 \uc774 \ud3ec\ub9f7\uc744 \ud30c\uc2f1\ud558\uc5ec \ud544\uc694\ud55c \ub370\uc774\ud130\ub9cc \uac00\uc838\ub2e4 \uc0ac\uc6a9\ud558\uba74 \ub41c\ub2e4.<br \/>\n NMEA\uc758 \uc139\uc158\uc758 \ub2e4\uc74c\uacfc \uac19\ub2e4. \ud558\uc9c0\ub9cc \ub300\ubd80\ubd84 GPCGA\uc640 GPRMC\ub9cc \uc774\uc6a9\ud558\uac8c \ub41c\ub2e4.<\/p>\n<p>   1) $GPGGA: Global Positioning System Fix Data\uc758 \uc57d\uc5b4\ub85c \uc2dc\uac04 \ubc0f \uacbd\uc704\ub3c4 \uc88c\ud45c\ub97c \uad6c\ud560\ub54c \uc8fc\ub85c \uc4f0\uc778\ub2e4.<\/p>\n<pre>\r\n    Ex) $GPGGA,103022.132,3735.0079,N,12701.6446,E,1,04,5.4,50.1,M,20.6,M,0.0,0000*48\r\n       - 103022.132: \uc2dc\uac04\r\n       - 3735.0079 : \uc704\ub3c4\r\n       - N\uc740 \ubd81\uc704\r\n       - 12701.6446 : \uacbd\ub3c4\r\n       - E : \ub3d9\uacbd\r\n       - 1 : Fix\uc758 \uc885\ub958 [0 : \uc704\uc131\uc774 \uc548 \uc7a1\ud600 Invalid, 1 : GPS\uc5d0\uc11c \uc81c\uacf5\ud558\ub294 \uae30\ubcf8 \uc704\uc131\uc744 \uac00\uc9c0\uace0\ub9cc \uacc4\uc0b0\ud560 \uacbd\uc6b0, 2 : DGPS\ub97c \uc774\uc6a9\ud558\uc5ec \ubcf4\uc815\ud558\uc5ec \uacc4\uc0b0\ud560 \uacbd\uc6b0)\r\n       - '04':  \uacc4\uc0b0\uc5d0 \uc0ac\uc6a9\ud55c \uc704\uc131\uc744 \uac1c\uc218\r\n       - '5.4': horizontal dilution of Precision\r\n       - '50.1M' : \ud574\uc218\uba74 \uae30\uc900 \uace0\ub3c4\r\n       - '20.6M' : WGS-84\uc5d0\uc11c \uc815\ud574\ub193\uc740 \ud0c0\uc6d0\uccb4\ub85c\uc11c \ubaa8\ub378\ub9c1\ud55c \uc9c0\uad6c\uc640 \uad6c\uccb4\ub85c\uc11c \ubaa8\ub378\ub9c1\ub41c \uc9c0\uad6c\uc758 \uace0\ub3c4\ucc28\uc774\r\n       - '0.0'\uacfc '0000' : DGPS \uc0ac\uc6a9\uc2dc \ub9c8\uc9c0\ub9c9\uc73c\ub85c update\ud55c \uc2dc\uac04\uacfc DGPS \uae30\uc9c0\uad6d\uc758 ID\r\n       - '48': Check Sum\r\n<\/pre>\n<p>   2) $GPRMC: Recommended minimum specific GPS\/Transit data\uc758 \uc57d\uc5b4\ub85c \ucd5c\uc18c\ud55c\uc758 \ub370\uc774\ud130\uac00 \ub4e4\uc5b4\uc624\uac8c \ub418\ub294\ub370 \ub0a0\uc790\uac00 \ub4e4\uc5b4\uc624\ubbc0\ub85c<br \/>\n      \uc8fc\ub85c \ub0a0\uc9dc\ub97c \uad6c\ud558\uae30 \uc704\ud574 \uc0ac\uc6a9\ub41c\ub2e4.<\/p>\n<pre>\r\n   EX) $GPRMC,114455.532,A,3735.0079,N,12701.6446,E,0.000000,121.61,110706,,*0A\r\n       - 114455.532: \uc2dc\uac04\r\n       - A : GPS \uc2e0\ud638\uc758 \uc2e0\ub8b0\uc131[A: \uc2e0\ub8b0, V : \ubbf8\uc2e0\ub8b0]\r\n       - 3735.0079: \uc704\ub3c4\r\n       - N : \ubd81\uc704\r\n       - 12701.6446 : \uacbd\ub3c4\r\n       - E : \ub3d9\uacbd\r\n       - '0.000000' : Speed over ground\ub85c\uc11c knots \ub2e8\uc704\uc758 \uc18d\ub3c4- air speed\uc758 \uc57d\uc790\uc774\ub2e4. km\/h\ub85c \ubcc0\ud658\uc2dc \ub300\ub7b5 1.8\uc744 \uacf1\ud55c\ub2e4.\r\n       - '121.61': \ubc29\ud5a5 \r\n       - '110706' : \ub0a0\uc9dc\r\n       - ' ' : Magnetic Variation\ub098\uce68\ubc18\r\n       - '*0A': \uccb4\ud06c\uc12c\r\n<\/pre>\n<p>   3) $GPGSV: GPS satellites in view\uc758 \uc57d\uc5b4\ub85c \ud604\uc7ac GPS Module\uc774 \uc218\uc2e0\ud560 \uc218 \uc788\ub294 \ubaa8\ub4e0 \uc704\uc131\uc758 \uc815\ubcf4\ub97c \ucd9c\ub825\ud55c\ub2e4.<br \/>\n   4) $GPGSA: GPS DOP and active satellites<\/p>\n<p>3. \ud30c\uc774\uc36c\uc744 \uc774\uc6a9\ud55c NMEA \ud30c\uc2f1<\/p>\n<p>1) $GPRMC\uc758 \ud30c\uc2f1<br \/>\n &#8211; GPMRC\uc758 \uacbd\uc6b0 \ucd5c\uc18c\ud55c\uc758 \uc815\ubcf4\uac00 \ubaa8\ub450 \ub4e4\uc5b4\uc624\uc9c0\ub9cc, \uadf8\uc911\uc5d0 \uc81c\uc77c \uc911\uc694\ud55c\uac83\uc740 \ub0a0\uc9dc\uac00 \ub4e4\uc5b4\uc628\ub2e4\ub294 \uac83\uc774\ub2e4.  \uadf8\ub9ac\uace0<br \/>\n   \ub0a0\uc9dc\ub294 UTC\uc2dc\uac04\uc774\ubbc0\ub85c \ubc18\ub4dc\uc2dc Locale\uc2dc\uac04\uc73c\ub85c \ubcc0\ud658\ud574\uc11c \uc0ac\uc6a9\ud574\uc57c \ud55c\ub2e4.<br \/>\n &#8211; \uc18d\ub3c4\uc758 \uacbd\uc6b0 \ub2e8\uc704\ub294 Knots\uc774\ubbc0\ub85c Km\/h\ub85c \ud658\uc0b0\ud558\ub824\uba74 \ubc18\ub4dc\uc2dc * 1.852\uc744 \ud574\uc57c \ud55c\ub2e4.<br \/>\n &#8211; \ub2e4\uc74c\uc740 GPRMC\ub97c \ud30c\uc2f1\ud55c \ud30c\uc774\uc36c \uc18c\uc2a4 \uc608\uc81c\uc774\ub2e4.<\/p>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"\" name=\"mshighlighter\" >\r\nif strData.startswith('$GPRMC'):\r\n\ttry:\r\n\t\tarrFields = strData[:strData.index('*')].strip().split(',')\r\n\r\n\t\tself.mStrSentenceType = 'RMC'\r\n\t\tstrUtcTime = arrFields[1]\r\n\r\n\t\t# \ud488\uc9c8 : A(\uc791\ub3d9), V(\uc5d0\ub7ec)\r\n\t\tself.mStrGpsStatus = arrFields[2]\r\n\r\n\t\tself.mFltLat = float(self.dmToSd(arrFields[3]) * (1 if arrFields[4] == 'N' else -1))\r\n\t\tself.mFltLon = float(self.dmToSd(arrFields[5]) * (1 if arrFields[6] == 'E' else -1))\r\n\r\n\t\t# \uc18d\ub3c4 ( \ub2e8\uc704\ub294 Knots, Km\/h \ud560\ub824\uba74 * 1.852)\r\n\t\tstrSpeedKnots = arrFields[7]\r\n\t\tif strSpeedKnots :\r\n\t\t\tself.mFltSpeed = float(arrFields[7]) * 1.852\r\n\t\telse :\r\n\t\t\tself.mFltSpeed = 0\r\n\r\n\t\t# \ubc29\ud5a5\r\n\t\tstrDirection = arrFields[8]\r\n\t\tif strDirection :\r\n\t\t\tself.mFltDirection = float(strDirection)\r\n\t\telse :\r\n\t\t\tself.mFltDirection = 0\r\n\r\n\t\t# \ub0a0\uc9dc\r\n\t\tstrDate = arrFields[9]\r\n\t\tif strDate:\r\n\t\t\tintDay          = int(strDate[0:2])\r\n\t\t\tintMonth        = int(strDate[2:4])\r\n\t\t\tintYear         = int(strDate[4:6]) + 2000\r\n\r\n\t\t\tintHour     = int(strUtcTime[0:2])\r\n\t\t\tintMinute   = int(strUtcTime[2:4])\r\n\t\t\tintSecond   = int(strUtcTime[4:6])\r\n\r\n\t\t\tdtGpsDateTime = datetime.datetime(intYear, intMonth, intDay, intHour, intMinute, intSecond)\r\n\t\t\tself.mDtDateTime = DateUtil.utcToLocal(dtGpsDateTime)\r\n\r\n\texcept ValueError:\r\n\t\treturn \tFalse<\/textarea><\/pre>\n<\/div>\n<p>2) $GPGGA\uc758 \ud30c\uc2f1<br \/>\n &#8211; GPGGA\ub294 \uc2dc\uac04, \uacbd\uc704\ub3c4, \uace0\ub3c4\ub4f1\uc758 \ubaa8\ub4e0 \ub370\uc774\ud130\uac00 \ub4e4\uc5b4\uc624\uae30\ub54c\ubb38\uc5d0 \uc8fc\uc758\ub97c \uae30\uc6b8\uc5ec \ud30c\uc2f1\ud560 \ud544\uc694\uac00 \uc788\ub2e4. \\<br \/>\n &#8211; \uc2dc\uac04\uc758 \uacbd\uc6b0, UTC\uc2dc\uac04\uc774\ubbc0\ub85c Locale \uc2dc\uac04\uc73c\ub85c \ubcc0\ud658\ud574\uc11c \uc0ac\uc6a9\ud574\uc57c \ud55c\ub2e4. <\/p>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"\" name=\"mshighlighter\" >\r\nif strData.startswith('$GPGGA'):\r\n\\\tif self.mDtDateTime is None :\r\n\t\treturn False\r\n\ttry:\r\n\t\tarrFields = strData[:strData.index('*')].strip().split(',')\r\n\t\tself.mStrSentenceType = 'GGA'\r\n\r\n\t\t# \uc2dc\uac04 : $GPRMC \uc5d0\uc11c \uad6c\ud55c\uac78\ub85c \uc774\uc6a9\r\n\t\tstrUtcTime = arrFields[1]\r\n\r\n\t\tintYear     = self.mDtDateTime.year\r\n\t\tintMonth    = self.mDtDateTime.month\r\n\t\tintDay      = self.mDtDateTime.day\r\n\t\tintHour     = int(strUtcTime[0:2])\r\n\t\tintMinute   = int(strUtcTime[2:4])\r\n\t\tintSecond   = int(strUtcTime[4:6])\r\n\r\n\t\tdtGpsDateTime = datetime.datetime(intYear, intMonth, intDay, intHour, intMinute, intSecond)\r\n\t\tself.mDtDateTime = DateUtil.utcToLocal(dtGpsDateTime)\r\n\r\n\t\t# \uc704\ub3c4\r\n\t\tself.mFltLat = float(self.dmToSd(arrFields[2]) * (1 if arrFields[3] == 'N' else -1))\r\n\r\n\t\t# \uacbd\ub3c4\r\n\t\tself.mFltLon = float(self.dmToSd(arrFields[4]) * (1 if arrFields[5] == 'E' else -1))\r\n\r\n\t\t# \ud488\uc9c8 (0 : invalid\ud55c \ub370\uc774\ud130, 1 :\tgps\uc704\uc131\uc2e0\ud638\ub9cc\uc73c\ub85c \uacc4\uc0b0, 2 : dgps\ub3c4 \uc0ac\uc6a9\ud558\uc5ec \uacc4\uc0b0)\r\n\t\tself.mIntPositionFix = int(arrFields[6])\r\n\r\n\t\t# \uc704\uc131\r\n\t\tself.mIntSatelliteCount = int(arrFields[7])\r\n\r\n\t\t# \ub178\uc774\uc988\r\n\t\t#self.mFltHdop = float(arrFields[8])\r\n\r\n\t\t# \uace0\ub3c4\r\n\t\tif arrFields[10].upper() == 'M':\r\n\t\t\tself.mFltAltitude = float(arrFields[9])\r\n\r\n\texcept ValueError:\r\n\t\treturn False<\/textarea><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. \ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 \ubc0f \uc124\uc815 1) \ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 &#8211; GPS \uc5f0\ub3d9\uc744 \uc704\ud558\uc5ec NEO-6M \ubaa8\ub4c8\uc744 \uc774\uc6a9\ud558\uc600\ub2e4. &#8211; NEO-6M\uc744 \ub77c\uc988\ubca0\ub9ac\ud30c\uc774\uc5d0 \uc5f0\uacb0\ud558\uae30 \uc704\ud574\uc11c NEO-6M\uc758 \ud540\uc744 \ub2e4\uc74c\uacfc \uac19\uc774 \uaf42\uc73c\uba74 \ub41c\ub2e4. NEO-6M \ub77c\uc988\ubca0\ub9ac\ud30c\uc7743 VCC PIN01(3.3v) RX PIN10(GPIO15) TX PIN08(GPIP14) GND PIN14 2) \ub77c\uc988\ubca0\ub9ac\ud30c\uc774 \uc124\uc815 GPS\ub97c \uc2dc\ub9ac\uc5bc\ub85c \uc5f0\uacb0\ud558\uadc0 \uc704\ud574 \ub2e4\uc74c\uacfc \uac19\uc774 \uc124\uc815\uc744 \uc218\uc815\ud55c\ub2e4. &#8211; cmdline.txt \ud30c\uc77c \uc218\uc815 sudo vi \/boot\/cmdline.txt dwc_otg.lpm_enable=0 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[2,35],"tags":[251,252,250],"class_list":["post-1655","post","type-post","status-publish","format-standard","hentry","category-2","category-iot","tag-gps","tag-nmea","tag-250"],"_links":{"self":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/1655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1655"}],"version-history":[{"count":13,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/1655\/revisions"}],"predecessor-version":[{"id":1676,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/1655\/revisions\/1676"}],"wp:attachment":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1655"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}