{"id":1982,"date":"2016-06-30T17:57:55","date_gmt":"2016-06-30T17:57:55","guid":{"rendered":"http:\/\/www.daveakerman.com\/?p=1982"},"modified":"2016-06-30T17:57:55","modified_gmt":"2016-06-30T17:57:55","slug":"lora-pc-gateway","status":"publish","type":"post","link":"http:\/\/www.daveakerman.com\/?p=1982","title":{"rendered":"LoRa PC Gateway"},"content":{"rendered":"<p>I generally use the Raspberry Pi to receive LoRa transmissions from balloons, and to upload the packets to the HabHub servers. \u00a0However it sometimes might be more convenient to use a PC or Mac, or a phone or tablet, for internet connectivity, in which case we need some way of interfacing a LoRa module to\u00a0those devices.<\/p>\n<h2>Hardware<\/h2>\n<p>Here I have used an Arduino Mini Pro, connected to the LoRa module via SPI and 2 I\/O pins, and using <a href=\"https:\/\/github.com\/daveake\/LoRaArduinoSerial\">software<\/a> derived from my\u00a0<a href=\"http:\/\/www.daveakerman.com\/?p=1682\">Handheld LoRa Receiver<\/a>\u00a0to allow control of the module via the Arduino&#8217;s serial interface. \u00a0I&#8217;ve built 2 such devices, the first of which connects to a PC via USB, using a Prolific PL2303 USB-serial adapter:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-1983\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/IMG_2811-1024x768.jpg\" alt=\"IMG_2811\" width=\"640\" height=\"480\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/IMG_2811-1024x768.jpg 1024w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/IMG_2811-300x225.jpg 300w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/IMG_2811-768x576.jpg 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-1984\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/IMG_2809-1024x768.jpg\" alt=\"IMG_2809\" width=\"640\" height=\"480\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/IMG_2809-1024x768.jpg 1024w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/IMG_2809-300x225.jpg 300w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/IMG_2809-768x576.jpg 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>The second device uses the same firmware, but connects to the PC (or Mac, tablet, phone) via bluetooth using a HC-06 bluetooth serial adapter. \u00a0Power comes from a small LiPo, using a USB charging module.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-1985\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/P1110723-1024x768.jpg\" alt=\"P1110723\" width=\"640\" height=\"480\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/P1110723-1024x768.jpg 1024w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/P1110723-300x225.jpg 300w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/P1110723-768x576.jpg 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/> <img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-1986\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/IMG_2813-1024x768.jpg\" alt=\"IMG_2813\" width=\"640\" height=\"480\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/IMG_2813-1024x768.jpg 1024w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/IMG_2813-300x225.jpg 300w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/IMG_2813-768x576.jpg 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<h2>Firmware<\/h2>\n<p>The <a href=\"https:\/\/github.com\/daveake\/LoRaArduinoSerial\">firmware<\/a>\u00a0handles incoming packets directly, copying them to memory before sending to the host PC or mobile device. \u00a0It also sends various status values &#8211; current RSSI every second, and packet RSSI, SNR and frequency error before each packet. \u00a0It accepts simple commands to set the LoRa frequency, bandwidth, spreading factor, error coding, packet header type and low data-rate optimisation.<\/p>\n<h2>Software<\/h2>\n<p>Currently I&#8217;ve produced <a href=\"https:\/\/github.com\/daveake\/LoRaSerialGateway\">Windows software<\/a> that communicates with either device using a virtual serial port (USB or Bluetooth), and expect to make that cross-platform soon (OSX, Android, iOS). \u00a0This program allows the LoRa parameters (frequency, bandwidth, spreading factor etc.) to be set, displays incoming telemetry packets, and optionally uploads those packets to Habitat (so the balloon position is displayed on the live map). \u00a0SSDV isn&#8217;t supported yet.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1987\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/WindowsGateway.jpg\" alt=\"WindowsGateway\" width=\"615\" height=\"644\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/WindowsGateway.jpg 615w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2016\/06\/WindowsGateway-286x300.jpg 286w\" sizes=\"(max-width: 615px) 100vw, 615px\" \/><\/p>\n<h2>Build<\/h2>\n<p>To make your own device, you will need:<\/p>\n<ul>\n<li>Arduino Mini Pro<\/li>\n<li>Programmer for above<\/li>\n<li>LoRa Module (RFM96 for 868MHz or RFM98 for 434MHz)<\/li>\n<li>Wire and solder<\/li>\n<li>SMA Socket<\/li>\n<li>Suitable case<\/li>\n<\/ul>\n<p>Plus for the USB version:<\/p>\n<ul>\n<li>FTDI or Prolific USB-serial adapter<\/li>\n<\/ul>\n<p>or, for the Bluetooth version:<\/p>\n<ul>\n<li>HC-06 Bluetooth interface<\/li>\n<li>LiPo battery<\/li>\n<li>USB LiPo Charger<\/li>\n<li>On\/Off Switch<\/li>\n<\/ul>\n<p>Connections from the Arduino to LoRa are described in the <a href=\"https:\/\/github.com\/daveake\/LoRaArduinoSerial\">firmware<\/a>. \u00a0Remember to connect GND on Arduino to GND on LoRa, and Vcc on Arduino to 3.3V on LoRa.<\/p>\n<p>For the serial version, first check if your USB adapter supplies 5V or 3,3V or both; for 5V you need to connect the 5V line to the Arduino &#8220;Raw&#8221; supply input; for 3.3V connect to the Vcc pin instead. \u00a0Also, connect 0V\/GND from USB adapter to the Arduino GND pin. \u00a0The USB Tx connects to Arduino Rx, and USB Rx to Arduino Tx.<\/p>\n<p>For the Bluetooth version, the LiPo connects to the Arduino Raw pin via a switch. \u00a0The Bluetooth device then takes power from the Arduino 3.3V line. \u00a0Rx\/Tx pins connect as above. \u00a0All GNDs connect together of course, and to the battery -ve wire. \u00a0The LiPi charger connects to the battery directly.<\/p>\n<p>Download the\u00a0<a href=\"https:\/\/github.com\/daveake\/LoRaArduinoSerial\">firmware<\/a>\u00a0and program the Arduino with it.<\/p>\n<p>To the USB version to a PC, just plug it in and hope that Windows installs the driver OK; if not then download and install the driver appropriate to your device. \u00a0Check in Device Manager to see which\u00a0serial port number it has installed.<\/p>\n<p>For the Bluetooth version, connect and install a USB Bluetooth adapter if one is not already installed. \u00a0Power on your LoRa\/Bluetooth receiver and then search for the bluetooth device in Windows. \u00a0You should see &#8220;HC-06&#8221; show up. \u00a0If you are asked for a PIN number it is 1234. \u00a0Check in Device Manager to see which\u00a0serial port number it has installed; if it doesn&#8217;t show then be prepared to wait &#8211; for some reason it can take several minutes.<\/p>\n<p>If you are using my <a href=\"https:\/\/github.com\/daveake\/LoRaSerialGateway\">Windows software<\/a>, download that to a new folder and just run the .exe file. \u00a0Choose the serial port that was installed earlier, and within a couple of seconds you should see the &#8220;Current RSSI&#8221; value start to update. \u00a0Choose your LoRa settings and click the &#8220;Set&#8221; button. \u00a0Once you&#8217;ve done that, you should start seeing packets arrive (assuming you have a tracker running using those LoRa settings, of course).<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I generally use the Raspberry Pi to receive LoRa transmissions from balloons, and to upload the packets to the HabHub servers. \u00a0However it sometimes might be more convenient to use a PC or Mac, or a phone or tablet, for internet connectivity, in which case we need some way of [&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\/1982"}],"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=1982"}],"version-history":[{"count":1,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1982\/revisions"}],"predecessor-version":[{"id":1988,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1982\/revisions\/1988"}],"wp:attachment":[{"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1982"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}