{"id":1816,"date":"2015-06-10T15:08:25","date_gmt":"2015-06-10T15:08:25","guid":{"rendered":"http:\/\/www.daveakerman.com\/?p=1816"},"modified":"2020-01-31T14:38:07","modified_gmt":"2020-01-31T14:38:07","slug":"lora-calling-channel-and-auto-tune","status":"publish","type":"post","link":"http:\/\/www.daveakerman.com\/?p=1816","title":{"rendered":"LoRa Calling Channel and Auto-Tune"},"content":{"rendered":"<p>When used for tracking high altitude balloons,\u00a0LoRa has the potential for a receiver to be set up unattended on a permanent basis, but only if it can automatically set itself to the correct frequency, bandwidth and other settings for each flight. \u00a0Originally I intended these settings to be taken from a central database, but a rather neater solution was suggested yesterday on the\u00a0<a href=\"#highaltitude IRC channel\">#highaltitude IRC channel<\/a>. \u00a0During a discussion of how to solve this problem, Philip Heron of\u00a0<a href=\"https:\/\/github.com\/fsphil\/ssdv\">SSDV<\/a>\u00a0fame suggested that each balloon announce its own parameters on a standard calling channel:<\/p>\n<pre>[15:45] &lt;fsphil&gt; I'd like a channel for announcements \n[15:45] &lt;fsphil&gt; \"I'm on xxx MHz with these parameters\"<\/pre>\n<p>Neat idea.<\/p>\n<p>Fast-forward 24 hours to now, and I&#8217;ve coded this up in the LoRa section of my Pi In The Sky tracker software and also my LoRa gateway. \u00a0It wasn&#8217;t difficult and took about 3 hours altogether.<\/p>\n<p>The tracker is configured with 2 settings:<\/p>\n<pre>LORA_Calling_Frequency_0=433.650\nLORA_Calling_Count_0=5<\/pre>\n<p>The first setting\u00a0specifies a calling frequency on which the tracker will periodically transmit a message telling listeners the frequency and parameters of its normal transmissions. \u00a0The second setting\u00a0specifies how often this special message is sent (e.g. after every 5 normal messages). \u00a0The other parameters of this special message (bandwidth, spreading factor etc.) are fixed at present (probably a good idea for a calling channel!):<\/p>\n<pre>EXPLICIT_MODE\nERROR_CODING_4_8\nBANDWIDTH_41K7\nSPREADING_11;<\/pre>\n<p>The message itself is very simple, e.g.:<\/p>\n<pre>^^PI_SKY_TEST,434.400,0,8,48,176,8*B30C<\/pre>\n<p>and contains\u00a0the payload ID, frequency in MHz, implicit\/explicit mode, error coding, bandwidth, spreading factor and low-data-rate optimisation.<\/p>\n<p>Here&#8217;s a sample packet seen on an Airspy SDR. \u00a0The calling packet is the one on the right (at 434.475MHz), followed by the start of a normal packet (on 434.400MHz):<\/p>\n<p><a href=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1820\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d1.png\" alt=\"d1\" width=\"584\" height=\"441\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d1.png 584w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d1-300x227.png 300w\" sizes=\"(max-width: 584px) 100vw, 584px\" \/><\/a><\/p>\n<p>The gateway has of course to be set to the calling frequency (434.475MHz in this case) and the correct set bandwidth etc. which are combined to together into a new &#8220;mode&#8221; of 5. \u00a0I have also enabled AFC (Automatic Frequency Control) using code written by David Brooke (thanks David!) &#8211; you can see his version of my LoRa gateway\u00a0<a href=\"https:\/\/github.com\/dbrooke\/lora-gateway\">here<\/a>.<\/p>\n<pre>frequency_1=434.475\nmode_1=5\nAFC_1=Y<\/pre>\n<p>The gateway shows the following screen when started:<\/p>\n<p><a href=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1821\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d2.png\" alt=\"d2\" width=\"675\" height=\"431\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d2.png 675w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d2-300x192.png 300w\" sizes=\"(max-width: 675px) 100vw, 675px\" \/><\/a>Note that it says &#8220;Calling mode&#8221; at the top, next to the calling channel frequency.<\/p>\n<p>Now let&#8217;s see what happens when it receives a calling packet:<\/p>\n<p><a href=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d3.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1822\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d3.png\" alt=\"d3\" width=\"681\" height=\"429\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d3.png 681w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d3-300x189.png 300w\" sizes=\"(max-width: 681px) 100vw, 681px\" \/><\/a><\/p>\n<p>The final message in the log at the bottom states that the new frequency is 434.405MHz; why not 434.400MHz as requested by the tracker? \u00a0The reason is that the receiver detected a frequency error of 4.6kHz (see the frequency error shown near the bottom of the blue section on the right). \u00a0As we have AFC enabled, the software automatically applied this error when it switched to the balloon tracker&#8217;s main frequency. \u00a0It&#8217;s better to do it now rather than later, especially if (as in this case) the balloon&#8217;s main transmission is using a narrower bandwidth where a large frequency error might prevent any packets being received.<\/p>\n<p>So, now the gateway has tuned in to the balloon&#8217;s main frequency, and set the various LoRa parameters correctly, it should start receiving regular packets:<\/p>\n<p><a href=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d4.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1823\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d4.png\" alt=\"d4\" width=\"673\" height=\"424\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d4.png 673w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2015\/06\/d4-300x189.png 300w\" sizes=\"(max-width: 673px) 100vw, 673px\" \/><\/a>In this screenshot, it has received 13 such packets so far. \u00a0You may also notice that it has fine-tuned itself to the balloon main frequency, and now has a zero frequency error.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When used for tracking high altitude balloons,\u00a0LoRa has the potential for a receiver to be set up unattended on a permanent basis, but only if it can automatically set itself to the correct frequency, bandwidth and other settings for each flight. \u00a0Originally I intended these settings to be taken from [&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":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1816"}],"collection":[{"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1816"}],"version-history":[{"count":4,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1816\/revisions"}],"predecessor-version":[{"id":2657,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1816\/revisions\/2657"}],"wp:attachment":[{"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1816"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}