{"id":14724,"date":"2016-05-20T09:48:05","date_gmt":"2016-05-20T07:48:05","guid":{"rendered":"https:\/\/blog.trifork.com\/?p=14724"},"modified":"2016-05-20T09:48:05","modified_gmt":"2016-05-20T07:48:05","slug":"collecting-data-from-a-private-lorawan-sensor-network-into-elastic","status":"publish","type":"post","link":"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/","title":{"rendered":"Collecting data from a private LoRaWAN sensor network into Elastic"},"content":{"rendered":"<h2>Introduction to LoRaWAN and ELK<\/h2>\n<h3>Why LoRaWAN, and what makes it different from other types of low power consumption, high range wireless protocols like ZigBee, Z-Wave, etc \u2026 ?<\/h3>\n<p>LoRa is a wireless modulation for long-range, low-power, low-data-rate applications developed by Semtech. The main features of this technology are the big amount of devices that can connect to one network and the relatively big range that can be covered with one LoRa router. One gateway can coordinate around 20&#8217;000 nodes in a range of 10\u201330km. It&#8217;s a very flexible protocol and allows the developers build various types of network architectures according to the demand of the client. The general description of the LoRaWAN protocol together with a small tutorial are available in my <a href=\"https:\/\/blog.trifork.com\/2016\/03\/04\/from-the-trenches-lora-lorawan-with-the-lorabee\/\" target=\"_blank\" rel=\"noopener\">previous post<\/a>.<\/p>\n<h3>What is the ELK stack, and why use it with LoRaWAN?<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14790 size-medium\" src=\"https:\/\/trifork.com\/wp-content\/uploads\/2016\/07\/LoRaWAN-1-300x201.png\" width=\"300\" height=\"201\" \/><\/p>\n<p>In the figure above, you can see a simplified model of what a typical LoRaWAN network looks like.<br \/>\nAs you can see, the data from the LoRa endpoints, has to go through several devices before it reaches the back-end application. Nowadays there are a lot of tools that would allow us to gather and manipulate the data. A very good solution is the ELK stack which consists of Elasticsearch, Logstash and Kibana; these three tools allow to gather, store and analyze big amounts of data. More information and details can be found on the official website: <a href=\"https:\/\/www.elastic.co\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.elastic.co\/<\/a>.<\/p>\n<p><!--more--><\/p>\n<h2>The network architecture<\/h2>\n<p>Mainly, in this post I will describe how to set up a private\u00a0LoRa network, and will provide details about each module between the sensor data acquisition and the data analysis in Kibana. I will describe two possible architectures: one which uses a free public cloud server, and another one which involves a private\u00a0server or PC.<\/p>\n<p>The hardware that I am using:<\/p>\n<ul>\n<li>2x Sodaq Mbili data acquisition boards<\/li>\n<li>2x RN2483 LoRabee modules<\/li>\n<li>ic880a-spi LoRa\u00a0gateway<\/li>\n<li>Raspberry Pi 2<\/li>\n<li>PC with Ubuntu<\/li>\n<li>different types of analog sensors<\/li>\n<\/ul>\n<p>Below you can see a full model of the network architecture using the public cloud server of The Things Network:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-14729 size-large\" src=\"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2016\/05\/LoRa_TTN_network_architecture-1024x670.png\" alt=\"LoRa_TTN_network_architecture\" width=\"1024\" height=\"670\" srcset=\"https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/LoRa_TTN_network_architecture-1024x670.png 1024w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/LoRa_TTN_network_architecture-300x196.png 300w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/LoRa_TTN_network_architecture-768x503.png 768w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/LoRa_TTN_network_architecture-1536x1005.png 1536w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/LoRa_TTN_network_architecture.png 1681w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<h2>Setting up the nodes<\/h2>\n<p>The Sodaq Mbili with the RN2483 are the LoRa end devices, which can read sensor data and send it to the gateway. A tutorial on how to set them up is available in my previous post (link in the introduction) or on the official support page: <a href=\"http:\/\/support.sodaq.com\/mbili\/\" target=\"_blank\" rel=\"noopener\">http:\/\/support.sodaq.com\/mbili\/<\/a>.<\/p>\n<p>For this tutorial I created a demo project which reads data from an analog sensor connected to the A0 port of the Sodaq and sends the data to the RN2483 LoRaBee. The program can be uploaded using the Arduino IDE; before doing that it&#8217;s important to change the constant called devAddr[4] to your own node addresses. In order to reserve addresses for the TTN cloud, you should register your name at: <a href=\"http:\/\/thethingsnetwork.org\/wiki\/AddressSpace\" target=\"_blank\" rel=\"noopener\">http:\/\/thethingsnetwork.org\/wiki\/AddressSpace<\/a>. Trifork Eindhoven has reserved the address range 02:D1:DC:XX . In this example I am using node address <code>02D1DC09<\/code><\/p>\n<h2>Setting up the gateway<\/h2>\n<p>In this example I am using the ic880a-spi LoRa gateway\u00a0from IMST GmbH, which is one of the cheapest and practical solutions for setting up a private\u00a0gateway. The documentation can be found at: <a href=\"http:\/\/www.wireless-solutions.de\/products\/long-range-radio\/ic880a\" target=\"_blank\" rel=\"noopener\">http:\/\/www.wireless-solutions.de\/products\/long-range-radio\/ic880a<\/a>.<\/p>\n<p>The first thing is to connect the Raspberry Pi to the gateway\u00a0and to the power supply. In the table below you can see the pin connection:<\/p>\n<table>\n<tbody>\n<tr>\n<th>ic880a pin<\/th>\n<th>Rpi pin<\/th>\n<th>Description<\/th>\n<th rowspan=\"8\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-14730\" src=\"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2016\/05\/ic880a_gateway_wiring_raspberry_pi.png\" alt=\"ic880a_gateway_wiring_raspberry_pi\" width=\"500\" height=\"334\" srcset=\"https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/ic880a_gateway_wiring_raspberry_pi.png 854w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/ic880a_gateway_wiring_raspberry_pi-300x200.png 300w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/ic880a_gateway_wiring_raspberry_pi-768x513.png 768w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/ic880a_gateway_wiring_raspberry_pi-600x400.png 600w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/th>\n<\/tr>\n<tr>\n<td>21<\/td>\n<td>2<\/td>\n<td>5V<\/td>\n<\/tr>\n<tr>\n<td>22<\/td>\n<td>6<\/td>\n<td>Ground<\/td>\n<\/tr>\n<tr>\n<td>13<\/td>\n<td>22<\/td>\n<td>Reset<\/td>\n<\/tr>\n<tr>\n<td>14<\/td>\n<td>23<\/td>\n<td>SPI clk<\/td>\n<\/tr>\n<tr>\n<td>15<\/td>\n<td>21<\/td>\n<td>MISO<\/td>\n<\/tr>\n<tr>\n<td>16<\/td>\n<td>19<\/td>\n<td>MOSI<\/td>\n<\/tr>\n<tr>\n<td>17<\/td>\n<td>24<\/td>\n<td>NSS<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>It is recommended to use Raspbian Jessie Lite with no desktop graphical interface. The SPI interface has to be enabled; this can be done in the \u201craspi-config\u201d under the \u201cAdvanced\u201d sub menu.<br \/>\nThe next step is to check if the connection was done correctly; Some testing scripts can be found on git at: <a href=\"https:\/\/github.com\/LoRa-net\/LoRa_gateway\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/LoRa-net\/LoRa_gateway<\/a>. Download the files on the Raspberry Pi and open the folder <code>util_tx_test<\/code>. This script will check if the Raspberry Pi can connect to the gateway\u00a0and will send test RF data packets. Run the following command in the Rpi terminal:<\/p>\n<p><code>sudo .\/util_tx_test \u2013 r 1257 -f 866.5<\/code><\/p>\n<p>If the pins were connected properly, you should get the following response:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-14732 size-large\" src=\"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2016\/05\/lora_gateway_util_tx_test_succesful-1024x407.png\" alt=\"lora_gateway_util_tx_test_succesful\" width=\"1024\" height=\"407\" srcset=\"https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lora_gateway_util_tx_test_succesful-1024x407.png 1024w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lora_gateway_util_tx_test_succesful-300x119.png 300w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lora_gateway_util_tx_test_succesful-768x305.png 768w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lora_gateway_util_tx_test_succesful-1536x610.png 1536w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lora_gateway_util_tx_test_succesful.png 1681w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<h2>Connecting the LoRa\u00a0gateway\u00a0to the TTN network<\/h2>\n<p>The gateway\u00a0can either store the data locally, send it to a private\u00a0server, or send it to The Things Network (TTN)\u00a0public network. First I will show how to connect to the free TTN service.<br \/>\nThere are two ways, you can either download the basic packet forwarder and install it on the rpi: <a href=\"https:\/\/github.com\/LoRa-net\/packet_forwarder\/tree\/master\/basic_pkt_fwd\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/LoRa-net\/packet_forwarder\/tree\/master\/basic_pkt_fwd<\/a> and configure it manually, or you can simply download the installer provided by TTN at: <a href=\"https:\/\/github.com\/ttn-zh\/ic880a-gateway\/tree\/spi\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/ttn-zh\/ic880a-gateway\/tree\/spi<\/a>. Simply run the <code>.\/install.sh api<\/code> and then follow the instructions on the terminal. Make sure that the Rpi is connected to the internet before running the installation.<\/p>\n<p>After the installation the Rpi will reboot, and the gateway service will always run in the background. At this point we created a public LoRaWAN gateway, that can be used by any node in the range; later in this post will explain how to make the network private and secure.<br \/>\nIn order to check if the gateway is online, connect the Sodaq Mbili to power and let it send data to the network. Go to http:\/\/thethingsnetwork.org\/api\/v0\/nodes\/&lt;NODE devaddr&gt;\/?format=json where devaddr is the address that you chose when setting up the node. Here you should find the messages sent by your node, as in the example below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-14733 size-large\" src=\"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2016\/05\/the_thing_network_output-1024x467.png\" alt=\"the_thing_network_output\" width=\"1024\" height=\"467\" srcset=\"https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/the_thing_network_output-1024x467.png 1024w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/the_thing_network_output-300x137.png 300w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/the_thing_network_output-768x350.png 768w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/the_thing_network_output-1536x701.png 1536w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/the_thing_network_output.png 1679w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>If there is no data on the URL, you can try running the packet_forwarder script manually.<br \/>\nYou can find the script under <code>\/opt\/ttn-gateway\/bin<\/code>. Simply run <code>.\/start.sh<\/code><\/p>\n<h2>Getting the data into elasticsearch<\/h2>\n<p>The next step it to get the JSON data from the URL and save it on a personal server or computer. First, install elasticsearch. An installation guide can be found at: <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/_installation.html\">https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/_installation.html<\/a><br \/>\nand kibana: <a href=\"https:\/\/www.elastic.co\/guide\/en\/kibana\/current\/setup.html\">https:\/\/www.elastic.co\/guide\/en\/kibana\/current\/setup.html<\/a><\/p>\n<p>Create a new index in elasticsearch for storing the data from the nodes:<\/p>\n<p><code>curl -XPUT 'http:\/\/localhst:9200\/LoRa_messages\/'<\/code><\/p>\n<p>and check if the index was created successfully with<\/p>\n<p><code>curl 'localhost:9200\/_cat\/indices?v'<\/code><\/p>\n<p>There are a lot of ways in which the JSON file can be imported from that URL and put into elasticsearch. For example, you can make a script like this one:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport urllib, json\nimport elasticsearch\nimport time&lt;\/code&gt;\n\n#data = json.loads(response.read())\n\nf = open(&quot;ttnsample.json&quot;,&quot;r&quot;)\n#data = f.read()\n\nes = elasticsearch.Elasticsearch()\n\ndef lemain():\n\nwhile True:\nurl = &quot;http:\/\/thethingsnetwork.org\/api\/v0\/nodes\/02D1DC09\/&quot;\nresponse = urllib.urlopen(url)\njsonobject = json.loads(response.read())\nfor x in range (0,50):\nes.index(index = 'lora_messages', doc_type='node_message',body = jsonobject&#x5B;x])\ntime.sleep(15)\n\nif __name__ == &quot;__main__&quot;:\nlemain();\n<\/pre>\n<p>As in the previous steps, make sure to use your own devaddr in the url.<\/p>\n<h2>Visualising the data in Kibana<\/h2>\n<p>The last step is to make the data readable and easy to understand. Make sure both Kibana and elasticsearch are running. Open the browser and go to <code>127.0.0.1:5601<\/code>. Add the new index <code>LoRa_message*<\/code>. Kibana should auto detect the time filed. Below you can see how should the node data look like:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-14734 size-large\" src=\"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2016\/05\/kibana_lora_sensor_data-1024x667.png\" alt=\"kibana_lora_sensor_data\" width=\"1024\" height=\"667\" srcset=\"https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/kibana_lora_sensor_data-1024x667.png 1024w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/kibana_lora_sensor_data-300x195.png 300w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/kibana_lora_sensor_data-768x500.png 768w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/kibana_lora_sensor_data-1536x1000.png 1536w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/kibana_lora_sensor_data.png 1679w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>Each message contains the following fields :<\/p>\n<ul>\n<li>\u201cnode_eui\u201d &#8211; the node&#8217;s devaddr<\/li>\n<li>\u201cdatarate\u201d<\/li>\n<li>\u201cdata_plain\u201d &#8211; the data sent from the node<\/li>\n<li>\u201cgateway_eui\u201d &#8211; the unique mac address of the gateway<\/li>\n<li>\u201cdata_raw\u201d &#8211; data before decryption<\/li>\n<li>\u201csnr\u201d &#8211; Signal to noise ratio (it indicates the quality of the signal)<\/li>\n<li>\u201ctime\u201d &#8211; the time at which the packet was received<\/li>\n<li>\u201crssi\u201d &#8211; Received signal strength indication<\/li>\n<li>\u201cdata_json\u201d &#8211; the same data, but in a number format.<\/li>\n<li>\u201cdata\u201d &#8211; data in chars<\/li>\n<li>\u201cfrequency\u201d<\/li>\n<\/ul>\n<p>Kibana allows to read this data in various ways. For this example I created three simple line charts that would show the sensor data, the signal to noise ration and RSSI over time.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-14735 size-large\" src=\"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2016\/05\/kibana_lora_sensor_data_2-1024x551.png\" alt=\"kibana_lora_sensor_data_2\" width=\"1024\" height=\"551\" srcset=\"https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/kibana_lora_sensor_data_2-1024x551.png 1024w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/kibana_lora_sensor_data_2-300x161.png 300w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/kibana_lora_sensor_data_2-768x413.png 768w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/kibana_lora_sensor_data_2-1536x826.png 1536w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/kibana_lora_sensor_data_2.png 1681w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>In here you can see the data from a sound sensor in the Trifork office in Eindhoven over an hour, together with the signal to noise ratio and RSSI. The dashboard can be customized in any way possible, and multiple nodes can be added.<\/p>\n<h2>Setting up a personal LoRaWAN network without the open TTN cloud<\/h2>\n<p>The main benefit of using the free TTN cloud server is that you don&#8217;t need a personal server with static IP address that has to run 24\/7. On the other hand, by using their server, the data becomes public, and can be accessed by anyone. In addition, anyone can use the same devaddr for the nodes and fill your buffer with unnecessary data.<br \/>\nIn order to redirect your data from the gateway to a personal server you can use Logstash, which can parse and filter the messages.\u00a0The network architecture in this case would look like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-14736\" src=\"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2016\/05\/lorawan_private_gateway-1024x670.png\" alt=\"lorawan_private_gateway\" width=\"1024\" height=\"670\" srcset=\"https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lorawan_private_gateway-1024x670.png 1024w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lorawan_private_gateway-300x196.png 300w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lorawan_private_gateway-768x503.png 768w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lorawan_private_gateway-1536x1005.png 1536w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lorawan_private_gateway.png 1681w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<h3>Setting up the\u00a0gateway<\/h3>\n<p>In order to configure the gateway, you have to access the <code>local_conf.json<\/code> file which can be fond in the <code>\/opt\/ttn-gateway\/bin<\/code> folder. You have to change the parameters under the index \u201cserver\u201d to the IP address of your server&#8217;s address and the UTP ports used for sending the data to\/from the gateway, as in the example below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-14737\" src=\"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2016\/05\/lora_gateway_configuration-1024x181.png\" alt=\"lora_gateway_configuration\" width=\"1024\" height=\"181\" srcset=\"https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lora_gateway_configuration-1024x181.png 1024w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lora_gateway_configuration-300x53.png 300w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lora_gateway_configuration-768x136.png 768w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lora_gateway_configuration-1536x272.png 1536w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/lora_gateway_configuration.png 1677w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>And the run the <code>.\/start.sh<\/code> from the same folder. Now the gateway\u00a0is sending JSON\u00a0packages to your server.<\/p>\n<h3>Setting up Logstash<\/h3>\n<p>The next step is to capture the data from the UDP port and add it to Elasticsearch. In the <code>logstash-x.x.x<\/code> folder, create a config file, <code>lora.conf<\/code> for example. In this file you have to specify where does the data come from, how should it be filtered, and where it should be sent to.\u00a0The following example is the minimal setup for simply redirecting all the data from the UDP port to elasticsearch:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-14738 size-medium\" src=\"https:\/\/trifork.nl\/articles\/wp-content\/uploads\/sites\/3\/2016\/05\/logstash_lora_configuration-300x167.png\" alt=\"logstash_lora_configuration\" width=\"300\" height=\"167\" srcset=\"https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/logstash_lora_configuration-300x167.png 300w, https:\/\/trifork.nl\/blog\/wp-content\/uploads\/sites\/3\/2016\/05\/logstash_lora_configuration.png 675w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>As you can see there is no filter applied, which means that\u00a0all the information will be redirected. The gateway sends json packages about the gateway&#8217;s\u00a0status, periodical acknowledgements and the data received from the nodes.\u00a0More information can be found in the PROTOCOL.TXT file which can be found in the Rpi&#8217;s folder <code>\/opt\/ttn_gateway\/packet_forwarder<\/code>.<\/p>\n<p>In order to get only the node&#8217;s data, you need to apply a filter in logstash, or choose a specific search index in Kibana. In order to visualize the data in kibana, simply choose <code>logstash*<\/code> as the search index.<\/p>\n<p>The last step is to decode the node data. In the previous setup, the data was decoded by TTN framework, but in this case you have to decode it using a base64 decoder. The encryption keys can be set up in the Arduino code by changing the variables <code>netwskey<\/code> and <code>appskey<\/code>. The decryption can be done with logstash using the cipher plugin.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction to LoRaWAN and ELK Why LoRaWAN, and what makes it different from other types of low power consumption, high range wireless protocols like ZigBee, Z-Wave, etc \u2026 ? LoRa is a wireless modulation for long-range, low-power, low-data-rate applications developed by Semtech. The main features of this technology are the big amount of devices that [&hellip;]<\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"categories":[15,337,111,65],"tags":[61,421,92,93,422],"class_list":["post-14724","post","type-post","status-publish","format-standard","hentry","category-enterprise-search","category-from-the-trenches","category-internet-of-things","category-big_data_search","tag-elasticsearch","tag-elk","tag-kibana","tag-logstash","tag-lorawan"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Collecting data from a private LoRaWAN sensor network into Elastic - Trifork Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Collecting data from a private LoRaWAN sensor network into Elastic - Trifork Blog\" \/>\n<meta property=\"og:description\" content=\"Introduction to LoRaWAN and ELK Why LoRaWAN, and what makes it different from other types of low power consumption, high range wireless protocols like ZigBee, Z-Wave, etc \u2026 ? LoRa is a wireless modulation for long-range, low-power, low-data-rate applications developed by Semtech. The main features of this technology are the big amount of devices that [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/\" \/>\n<meta property=\"og:site_name\" content=\"Trifork Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-05-20T07:48:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/trifork.com\/wp-content\/uploads\/2016\/07\/LoRaWAN-1-300x201.png\" \/>\n<meta name=\"author\" content=\"Ion Iuncu\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ion Iuncu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/\",\"url\":\"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/\",\"name\":\"Collecting data from a private LoRaWAN sensor network into Elastic - Trifork Blog\",\"isPartOf\":{\"@id\":\"https:\/\/trifork.nl\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/trifork.com\/wp-content\/uploads\/2016\/07\/LoRaWAN-1-300x201.png\",\"datePublished\":\"2016-05-20T07:48:05+00:00\",\"author\":{\"@id\":\"https:\/\/trifork.nl\/blog\/#\/schema\/person\/ef71e30c92c8ecb6e8eb14049ea69f95\"},\"breadcrumb\":{\"@id\":\"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/#primaryimage\",\"url\":\"https:\/\/trifork.com\/wp-content\/uploads\/2016\/07\/LoRaWAN-1-300x201.png\",\"contentUrl\":\"https:\/\/trifork.com\/wp-content\/uploads\/2016\/07\/LoRaWAN-1-300x201.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/trifork.nl\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Collecting data from a private LoRaWAN sensor network into Elastic\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/trifork.nl\/blog\/#website\",\"url\":\"https:\/\/trifork.nl\/blog\/\",\"name\":\"Trifork Blog\",\"description\":\"Keep updated on the technical solutions Trifork is working on!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/trifork.nl\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/trifork.nl\/blog\/#\/schema\/person\/ef71e30c92c8ecb6e8eb14049ea69f95\",\"name\":\"Ion Iuncu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/trifork.nl\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c92fb406f9e4f40b4fc90c835590bd7b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c92fb406f9e4f40b4fc90c835590bd7b?s=96&d=mm&r=g\",\"caption\":\"Ion Iuncu\"},\"sameAs\":[\"http:\/\/www.trifork.com\"],\"url\":\"https:\/\/trifork.nl\/blog\/author\/ion-iuncutrifork-nl\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Collecting data from a private LoRaWAN sensor network into Elastic - Trifork Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/","og_locale":"en_US","og_type":"article","og_title":"Collecting data from a private LoRaWAN sensor network into Elastic - Trifork Blog","og_description":"Introduction to LoRaWAN and ELK Why LoRaWAN, and what makes it different from other types of low power consumption, high range wireless protocols like ZigBee, Z-Wave, etc \u2026 ? LoRa is a wireless modulation for long-range, low-power, low-data-rate applications developed by Semtech. The main features of this technology are the big amount of devices that [&hellip;]","og_url":"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/","og_site_name":"Trifork Blog","article_published_time":"2016-05-20T07:48:05+00:00","og_image":[{"url":"https:\/\/trifork.com\/wp-content\/uploads\/2016\/07\/LoRaWAN-1-300x201.png","type":"","width":"","height":""}],"author":"Ion Iuncu","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Ion Iuncu","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/","url":"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/","name":"Collecting data from a private LoRaWAN sensor network into Elastic - Trifork Blog","isPartOf":{"@id":"https:\/\/trifork.nl\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/#primaryimage"},"image":{"@id":"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/#primaryimage"},"thumbnailUrl":"https:\/\/trifork.com\/wp-content\/uploads\/2016\/07\/LoRaWAN-1-300x201.png","datePublished":"2016-05-20T07:48:05+00:00","author":{"@id":"https:\/\/trifork.nl\/blog\/#\/schema\/person\/ef71e30c92c8ecb6e8eb14049ea69f95"},"breadcrumb":{"@id":"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/#primaryimage","url":"https:\/\/trifork.com\/wp-content\/uploads\/2016\/07\/LoRaWAN-1-300x201.png","contentUrl":"https:\/\/trifork.com\/wp-content\/uploads\/2016\/07\/LoRaWAN-1-300x201.png"},{"@type":"BreadcrumbList","@id":"https:\/\/trifork.nl\/blog\/collecting-data-from-a-private-lorawan-sensor-network-into-elastic\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/trifork.nl\/blog\/"},{"@type":"ListItem","position":2,"name":"Collecting data from a private LoRaWAN sensor network into Elastic"}]},{"@type":"WebSite","@id":"https:\/\/trifork.nl\/blog\/#website","url":"https:\/\/trifork.nl\/blog\/","name":"Trifork Blog","description":"Keep updated on the technical solutions Trifork is working on!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/trifork.nl\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/trifork.nl\/blog\/#\/schema\/person\/ef71e30c92c8ecb6e8eb14049ea69f95","name":"Ion Iuncu","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/trifork.nl\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c92fb406f9e4f40b4fc90c835590bd7b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c92fb406f9e4f40b4fc90c835590bd7b?s=96&d=mm&r=g","caption":"Ion Iuncu"},"sameAs":["http:\/\/www.trifork.com"],"url":"https:\/\/trifork.nl\/blog\/author\/ion-iuncutrifork-nl\/"}]}},"_links":{"self":[{"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/posts\/14724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/comments?post=14724"}],"version-history":[{"count":0,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/posts\/14724\/revisions"}],"wp:attachment":[{"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/media?parent=14724"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/categories?post=14724"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/tags?post=14724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}