{"id":2324,"date":"2018-05-25T21:26:31","date_gmt":"2018-05-25T21:26:31","guid":{"rendered":"http:\/\/www.daveakerman.com\/?p=2324"},"modified":"2018-05-30T15:56:50","modified_gmt":"2018-05-30T15:56:50","slug":"pi-zero-gps-gsm-tracker-and-habitat-gateway","status":"publish","type":"post","link":"https:\/\/www.daveakerman.com\/?p=2324","title":{"rendered":"Pi Zero GPS\/GSM Tracker and Habitat Gateway"},"content":{"rendered":"<p>GSM-based trackers are quite rightly frowned upon for HAB tracking, mainly because they only work at low altitudes (within range of a mobile phone tower, which aim the signal generally downwards).\u00a0 So they don&#8217;t provide tracking throughout a flight, which is a problem as then you don&#8217;t know where the payload is until it lands.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-2326\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/tk102.jpg\" alt=\"\" width=\"512\" height=\"512\" srcset=\"https:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/tk102.jpg 512w, https:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/tk102-150x150.jpg 150w, https:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/tk102-300x300.jpg 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/p>\n<p>If you&#8217;re lucky.<\/p>\n<p>There are 2 problems here &#8211; one is that GSM coverage isn&#8217;t 100%, and the other is that the popular GSM trackers don&#8217;t seem to like high altitudes.\u00a0 I don&#8217;t know if they get confused, or they don&#8217;t like the cold, but I&#8217;ve tried these things several times and only had one work once.<\/p>\n<p>A GSM\/GPS tracker that actually works would be useful though, as a backup to a main tracker.\u00a0 Having had little success with commercial offerings, I thought I&#8217;d make one.\u00a0 I found a model that uses the SIM868 GSM\/GPS module, plus supporting electronics on a Pi Zero HAT.\u00a0 So that plus a Pi Zero and suitable power supply would make a fairly small backup tracker, and maybe even one that works.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-2327\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/SIM868.jpg\" alt=\"\" width=\"750\" height=\"564\" srcset=\"https:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/SIM868.jpg 750w, https:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/SIM868-300x226.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>The device supports GSM (calls, texts) and GPRS (2G, i.e. slow data).\u00a0 It also has a GPS receiver.\u00a0 It seemed attractive to use GPRS to provide internet access (via PPP), but that would lock out the single serial port thus making GPS unavailable.\u00a0 So I decided to just send SMS from the device instead, using a script that gets the GPS position, then builds and sends an SMS containing that position.\u00a0 I wrote this in Python using the PyGSM library, which makes things very easy (generally no need to mess around with AT commands).\u00a0 PyGSM doesn&#8217;t know about the SIM868 GPS functions however, but it was simple to add those.\u00a0 So my test script requests and parses the GPS position, then formulates a text message and ends it to my mobile phone:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-2328\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/DeDx9CKX4AEKu5b-1024x683.jpg\" alt=\"\" width=\"640\" height=\"427\" srcset=\"https:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/DeDx9CKX4AEKu5b-1024x683.jpg 1024w, https:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/DeDx9CKX4AEKu5b-300x200.jpg 300w, https:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/DeDx9CKX4AEKu5b-768x512.jpg 768w, https:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/DeDx9CKX4AEKu5b.jpg 2048w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>It would also be useful to have the balloon position automatically uploaded to the live map, so I decided to have the device send a second SMS but this time to a gateway based at home.\u00a0 This gateway is another Pi with a USB 3G modem attached.\u00a0 I used the same library, but a different script to poll for new messages, determine whether an incoming message is of the correct format, and if so build a UKHAS telemetry sentence, finally uploading it to habhub for the live map:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-2329\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/DeEIw54W0AEajJz.jpg\" alt=\"\" width=\"772\" height=\"421\" srcset=\"https:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/DeEIw54W0AEajJz.jpg 772w, https:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/DeEIw54W0AEajJz-300x164.jpg 300w, https:\/\/www.daveakerman.com\/wp-content\/uploads\/2018\/05\/DeEIw54W0AEajJz-768x419.jpg 768w\" sizes=\"(max-width: 772px) 100vw, 772px\" \/><\/p>\n<p>UPDATE: Software now uploaded to github:\u00a0<a href=\"https:\/\/github.com\/daveake\/GSMTracker\">https:\/\/github.com\/daveake\/GSMTracker<\/a><\/p>\n<p>Note: Not tested in flight yet so I don&#8217;t know if the software and\/or hardware chosen will work or not, so user beware!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GSM-based trackers are quite rightly frowned upon for HAB tracking, mainly because they only work at low altitudes (within range of a mobile phone tower, which aim the signal generally downwards).\u00a0 So they don&#8217;t provide tracking throughout a flight, which is a problem as then you don&#8217;t know where the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts\/2324"}],"collection":[{"href":"https:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2324"}],"version-history":[{"count":5,"href":"https:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts\/2324\/revisions"}],"predecessor-version":[{"id":2333,"href":"https:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts\/2324\/revisions\/2333"}],"wp:attachment":[{"href":"https:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}