<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>lorawan &#8211; Squix &#8211; TechBlog</title>
	<atom:link href="https://blog.squix.org/tag/lorawan/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.squix.org</link>
	<description></description>
	<lastBuildDate>Sun, 11 Jul 2021 10:32:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.8</generator>
<site xmlns="com-wordpress:feed-additions:1">121913304</site>	<item>
		<title>TTGO-LoRa32 V1.0 with TTN V3 and OTAA</title>
		<link>https://blog.squix.org/2021/07/ttgo-lora32-v1-0-with-ttn-v3-and-otaa.html</link>
					<comments>https://blog.squix.org/2021/07/ttgo-lora32-v1-0-with-ttn-v3-and-otaa.html#comments</comments>
		
		<dc:creator><![CDATA[Daniel Eichhorn]]></dc:creator>
		<pubDate>Sun, 11 Jul 2021 10:20:49 +0000</pubDate>
				<category><![CDATA[Common]]></category>
		<category><![CDATA[ESP32]]></category>
		<category><![CDATA[LoRaWAN]]></category>
		<category><![CDATA[lorawan]]></category>
		<category><![CDATA[ttgo-lora32]]></category>
		<category><![CDATA[ttn]]></category>
		<guid isPermaLink="false">https://blog.squix.org/?p=6820</guid>

					<description><![CDATA[If you are lacking good documentation it can be very hard to get started with a new device. I just couldn&#8217;t find a comprehensive example project for how to connect TTGO-LoRA32 V1.0 with the V3 version of the Things Network. So I hope this post ... <p><a class="read-more btn btn-secondary" href="https://blog.squix.org/2021/07/ttgo-lora32-v1-0-with-ttn-v3-and-otaa.html">Read More</a></p>]]></description>
										<content:encoded><![CDATA[
<p>If you are lacking good documentation it can be very hard to get started with a new device. I just couldn&#8217;t find a comprehensive example project for how to connect <a href="https://www.banggood.com/custlink/vmDdBjpESq" target="_blank" rel="noreferrer noopener">TTGO-LoRA32 V1.0</a> with the V3 version of the Things Network. So I hope this post and the related github project will save you some time to achieve the same.</p>



<span id="more-6820"></span>



<p>I have connected devices to TheThingsNetwork before but with this device I had several challenges: no useful example project, TTN just switched to the new V3 version and bad documentation about the hardware. After the first failure I assumed that the TTGO-LoRa32 was to weak to send data to the next gateway. Since my own TTN indoor gateway was still registered for V2 I started to migrate it first. That was another bad experience. The gateway did not connect to TTN V3 and I reclaimed it several times without success. Only after waiting one night it finally worked and I had a gateway connected to TTN v3.</p>



<p>So now that I knew that I had a gateway close enough to receive the TTGO-LoRa32&#8242; data package I could concentrate on fixing the code. </p>



<h2 class="wp-block-heading">Prepare the Code</h2>



<p>In this project, I&#8217;m using platformio in Visual Studio Code for editing and uploading the firmware. As a first step get the code from my github repository <a href="https://github.com/squix78/TTGO-LoRa32-V1.0-TTN-OTAA" target="_blank" rel="noreferrer noopener">https://github.com/squix78/TTGO-LoRa32-V1.0-TTN-OTAA</a> either by cloning it with git or by downloading the code as zip file and extracting it.</p>



<p>This project should work as it is except for a few changes we have to do in the code. The most obscure change is buried deep in the library folder in a file called lmic_project_config.h. The full path to the file is <br>.pio/libdeps/ttgo-lora32-v1/MCCI LoRaWAN LMIC library/project_config/lmic_project_config.h <br>If you can&#8217;t find this file you probably have to compile the project first, since only then all the dependencies will be downloaded. <strong>Please note</strong>: at the moment the compilation will fail, since we didn&#8217;t set the credentials in the code yet. This is expected and normal.</p>



<p>Once you find that file make sure that the correct region settings are there. For Europe 868MHz band it should like this:</p>



<pre class="wp-block-code"><code>// project-specific definitions
#define CFG_eu868 1
//#define CFG_us915 1
//#define CFG_au915 1
//#define CFG_as923 1
// #define LMIC_COUNTRY_CODE LMIC_COUNTRY_CODE_JP	/* for as923-JP */
//#define CFG_kr920 1
//#define CFG_in866 1
#define CFG_sx1276_radio 1
//#define LMIC_USE_INTERRUPTS</code></pre>



<p>By default the code uses CFG_us915. If you are living in another region it is very important you do that change!</p>



<h2 class="wp-block-heading">Getting the app and device credentials</h2>



<p>This was the first device I set up for TTN V3 and there are a couple of traps I want to point out to you. A quick explanation for the TTN novice: Your device needs three credentials to connect to TTN: AppEUI, DevEUI and AppKey. In TTNs V2 interface you could either provide the DevEUI or it would create them for you. In TTN V3 this auto EUI generation is currently missing. For many devices the vendor will provide these identifiers and you just have to enter them in the TTN console. But with devices such as the TTGO-LoRa32 you don&#8217;t get it. I show you here how to create it by yourself. This is not ideal but works&#8230; Just don&#8217;t blame me in case of problems&#8230;</p>



<ol><li>Head over to <a href="https://console.cloud.thethings.network/">https://console.cloud.thethings.network/</a> and pick your V3 region. Don&#8217;t use the V2!</li><li>Create an account if you don&#8217;t have one yet.</li><li>Go to applications and create a new application. As application id you can pick anything as long as<ol><li>it doesn&#8217;t exist yet</li><li>only contains letters, dashes and numbers</li></ol></li><li>On the next screen click on &#8220;Add end device&#8221; (see image below)</li></ol>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" fetchpriority="high" decoding="async" width="730" height="365" data-attachment-id="6822" data-permalink="https://blog.squix.org/2021/07/ttgo-lora32-v1-0-with-ttn-v3-and-otaa.html/image-1-5" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-1.png?fit=2304%2C1152&amp;ssl=1" data-orig-size="2304,1152" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-1" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-1.png?fit=300%2C150&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-1.png?fit=730%2C365&amp;ssl=1" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-1.png?resize=730%2C365&#038;ssl=1" alt="" class="wp-image-6822" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-1.png?resize=1024%2C512&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-1.png?resize=300%2C150&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-1.png?resize=768%2C384&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-1.png?resize=1536%2C768&amp;ssl=1 1536w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-1.png?resize=2048%2C1024&amp;ssl=1 2048w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-1.png?resize=800%2C400&amp;ssl=1 800w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-1.png?w=1460&amp;ssl=1 1460w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-1.png?w=2190&amp;ssl=1 2190w" sizes="(max-width: 730px) 100vw, 730px" /></figure>



<ol start="5"><li>Now go the &#8220;Manually&#8221; tab and choose &#8220;Over the air activation (OTAA)&#8221; and MAC V1.0.2</li><li>On the next screen choose a name for your device consisting only of letters, numbers and dashes. To fill in the JoinEUI and DevEUI you can use this generator: <a href="https://descartes.co.uk/CreateEUIKey.html">https://descartes.co.uk/CreateEUIKey.html</a></li><li>On the next screen choose your region and the following settings:</li></ol>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" decoding="async" width="730" height="331" data-attachment-id="6827" data-permalink="https://blog.squix.org/2021/07/ttgo-lora32-v1-0-with-ttn-v3-and-otaa.html/image-6-4" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-6.png?fit=1028%2C466&amp;ssl=1" data-orig-size="1028,466" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-6" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-6.png?fit=300%2C136&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-6.png?fit=730%2C331&amp;ssl=1" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-6.png?resize=730%2C331&#038;ssl=1" alt="" class="wp-image-6827" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-6.png?resize=1024%2C464&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-6.png?resize=300%2C136&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-6.png?resize=768%2C348&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-6.png?w=1028&amp;ssl=1 1028w" sizes="(max-width: 730px) 100vw, 730px" /></figure>



<ol start="8"><li>On the Join settings screen you can click on the &#8220;recycle&#8221; symbol to generate an AppKey for you.</li><li>Now we have to copy the credentials over to our code. We have to provide JoinEUI and DevEUI in <em>least significat byte order</em> or short LSB. The TTN console helps you with that. First click on the &#8220;&lt;>&#8221; icon and then on the arrows beside &#8220;msb&#8221;. To put the data into the clipboard use the most right icon. BTW: The name of JoinEUI is  AppEUI in the code. Please add the AppKey msb order, no need to invert the order there.</li></ol>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" decoding="async" width="730" height="93" data-attachment-id="6825" data-permalink="https://blog.squix.org/2021/07/ttgo-lora32-v1-0-with-ttn-v3-and-otaa.html/image-4-4" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-4.png?fit=756%2C96&amp;ssl=1" data-orig-size="756,96" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-4" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-4.png?fit=300%2C38&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-4.png?fit=730%2C93&amp;ssl=1" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-4.png?resize=730%2C93&#038;ssl=1" alt="" class="wp-image-6825" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-4.png?w=756&amp;ssl=1 756w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-4.png?resize=300%2C38&amp;ssl=1 300w" sizes="(max-width: 730px) 100vw, 730px" /></figure>



<ol start="10"><li> After copying JoinEUI (AppEUI), DevEUI and AppKey to the main.cpp file in the code you got from github you can compile and upload the firmware to the TTGO-LoRa32</li><li>Now check if it worked by looking at the device live data on the TTN console:</li></ol>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="730" height="200" data-attachment-id="6826" data-permalink="https://blog.squix.org/2021/07/ttgo-lora32-v1-0-with-ttn-v3-and-otaa.html/image-5-4" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-5.png?fit=1086%2C298&amp;ssl=1" data-orig-size="1086,298" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-5" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-5.png?fit=300%2C82&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-5.png?fit=730%2C200&amp;ssl=1" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-5.png?resize=730%2C200&#038;ssl=1" alt="" class="wp-image-6826" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-5.png?resize=1024%2C281&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-5.png?resize=300%2C82&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-5.png?resize=768%2C211&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2021/07/image-5.png?w=1086&amp;ssl=1 1086w" sizes="(max-width: 730px) 100vw, 730px" /></figure>



<h2 class="wp-block-heading">Summary &amp; Outlook</h2>



<p>This is it! If everything worked you your TTGO-LoRa32 is now sending messages to TTN V3, joining it with dynamic session keys! If I find the time I&#8217;d like to analyze the power consumption of the device for sending a message as well as in the sleep phase.</p>



<p>My code is not using the OLED display. There is a repository provided by LillyGo that shows you how to do that: <a href="https://github.com/LilyGO/TTGO-LORA32/tree/LilyGO-868-V1.0">https://github.com/LilyGO/TTGO-LORA32/tree/LilyGO-868-V1.0</a></p>



<p>If you like to support my blog please consider buying the device by using this affiliate link: <a href="https://www.banggood.com/custlink/vmDdBjpESq">https://www.banggood.com/custlink/vmDdBjpESq</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.squix.org/2021/07/ttgo-lora32-v1-0-with-ttn-v3-and-otaa.html/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">6820</post-id>	</item>
		<item>
		<title>Using Seeeduino LoRaWAN with GPS and Loriot.io</title>
		<link>https://blog.squix.org/2017/11/using-seeeduino-lorawan-with-gps-and-loriot-io.html</link>
					<comments>https://blog.squix.org/2017/11/using-seeeduino-lorawan-with-gps-and-loriot-io.html#comments</comments>
		
		<dc:creator><![CDATA[Daniel Eichhorn]]></dc:creator>
		<pubDate>Wed, 22 Nov 2017 15:46:16 +0000</pubDate>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[LoRaWAN]]></category>
		<category><![CDATA[lorawan]]></category>
		<category><![CDATA[loriot]]></category>
		<category><![CDATA[seeedstudio]]></category>
		<category><![CDATA[seeeduino]]></category>
		<guid isPermaLink="false">https://blog.squix.org/?p=3784</guid>

					<description><![CDATA[In the first blog post blog post in this series I showed you how can configure the Seeeduino LoRaWAN module to connect it to TheThingsNetwork (TTN). The second post showed you how the LoRaWAN message can be sent to a Google Spreadsheet. Now this post goes one ... <p><a class="read-more btn btn-secondary" href="https://blog.squix.org/2017/11/using-seeeduino-lorawan-with-gps-and-loriot-io.html">Read More</a></p>]]></description>
										<content:encoded><![CDATA[<p>In the <a href="https://blog.squix.org/2017/07/seeeduino-lora-gps-getting-started-with-lorawan-and-ttn.html" target="_blank" rel="noopener">first blog post blog</a> post in this series I showed you how can configure the <a href="https://blog.squix.org/go/seeedstudio-lorawan-gps" target="_blank" rel="noopener">Seeeduino LoRaWAN module</a> to connect it to TheThingsNetwork (TTN). The <a href="https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html" target="_blank" rel="noopener">second post</a> showed you how the LoRaWAN message can be sent to a Google Spreadsheet. Now this post goes one step further and uses the GPS module in the Seeeduino to post the coordinates together with humidity and temperature to a Google Spreadsheet. We then visualize the coordinates on Google Maps. To make it even more interesting decided to replace the TTN backend with the backend of a Swiss startup called Loriot.io. They offer a free service where you have to connect one LoRaWAN gateway in order to participate.</p>
<p><span id="more-3784"></span></p>
<h2>Setting up a Loriot.io Account</h2>
<p>Loriot.io is a cool Swiss startup located close to Zurich and they are proving the infrastructure for LoRaWAN applications. Beside their commercial offerings they also have a service which doesn&#8217;t cost you anything. But in return you have to contribute to the network by connecting your own LoRaWAN gateway. I&#8217;m not going into detail here how to do that but here is some additional information: I configured my existing TTN gatway with a Raspberry Pi Zero W and a IMST IC880A concentrator to forward packages also to the Loriot network. In order to do that I just had to alter the local_conf.json file: Loriot uses a slightly different gateway ID (with FFFF in the middle, the default with TTN is FFFE). I also had to add the Loriot servers to the same configuration file:</p>
<pre>{
        "gateway_conf": {
                "gateway_ID": "XXXXXXFFFFXXXXXX",
                "servers": [
                  {
                        "server_address": "router.eu.thethings.network",
                        "serv_port_up": 1700,
                        "serv_port_down": 1700,
                        "serv_enabled": true
                },
                {
                        "server_address": "eu1.loriot.io",
                        "serv_port_up": 1780,
                        "serv_port_down": 1780,
                        "serv_enabled": true,
                        "keepalive_interval": 10,
                        "stat_interval": 30,
                        "push_timeout_ms": 100,

                        "forward_crc_valid": true,
                        "forward_crc_error": false,
                        "forward_crc_disabled": false
                }],
                "ref_latitude": 0,
                "ref_longitude": 0,
                "ref_altitude": 0,
                "contact_email": "",
                "description": "ttn-ic880a"
        }
}
</pre>
<p>After that you can create a free account on the <a href="https://loriot.io/" target="_blank" rel="noopener">Loriot.io page</a>. Now setup the gateway and place the created ID in the local_conf.json file, assuming that you are using a similar setup like mine (I&#8217;m using a semtek packet forwarder). Now you can switch to the &#8220;Application&#8221; menu and select the &#8220;Sample Application&#8221;. Now click on &#8220;Enroll device&#8221;:</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.22.55.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="3786" data-permalink="https://blog.squix.org/2017/11/using-seeeduino-lorawan-with-gps-and-loriot-io.html/screen-shot-2017-11-22-at-16-22-55" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.22.55.png?fit=3330%2C1030&amp;ssl=1" data-orig-size="3330,1030" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Loriot Device enrolment" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.22.55.png?fit=300%2C93&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.22.55.png?fit=730%2C226&amp;ssl=1" class="alignnone wp-image-3786 size-large" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.22.55.png?resize=730%2C226&#038;ssl=1" alt="" width="730" height="226" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.22.55.png?resize=1024%2C317&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.22.55.png?resize=300%2C93&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.22.55.png?resize=768%2C238&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.22.55.png?w=1460&amp;ssl=1 1460w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.22.55.png?w=2190&amp;ssl=1 2190w" sizes="(max-width: 730px) 100vw, 730px" /></a></p>
<p>Enter your device ID in the form field and click &#8220;Enroll OTAA / ABP device&#8221;. In the first post I showed you how to figure out the device ID. Now navigate to &#8220;Devices&#8221; and click on the newly created device. Here you can find the DevEUI, AppEUI and AppKey which you&#8217;ll have to use in the next paragraph.</p>
<p>&nbsp;</p>
<h2>Setting up the Seeeduino Code</h2>
<p>In order to have the Seeeduino read out the GPS coordinates and the temperature and humidity we have to install two libraries. Download the TinyGpsPlus library from <a href="http://arduiniana.org/libraries/tinygpsplus/">http://arduiniana.org/libraries/tinygpsplus/</a> Then install also the DHT library from Adafruit from the library manager under Sketch &gt; Include Library &gt; Library Manager&#8230; Menu. Copy the code you previously generated in the Loriot.io interface when adding a new device.</p>
<pre>//Download http://arduiniana.org/libraries/tinygpsplus/
#include &lt;TinyGPS++.h&gt;
#include &lt;LoRaWan.h&gt;
#include "DHT.h"


TinyGPSPlus gps;
#define DHTPIN A0 // what pin we're connected to

#define DHTTYPE DHT11 // DHT 11
 
DHT dht(DHTPIN, DHTTYPE);
char buffer[256];


void setup(void)
{
    SerialUSB.begin(115200);
    Serial.begin(9600);
    
    lora.init();
    
    memset(buffer, 0, 256);
    lora.getVersion(buffer, 256, 1);
    SerialUSB.print(buffer); 
    
    memset(buffer, 0, 256);
    lora.getId(buffer, 256, 1);
    SerialUSB.print(buffer);
    SerialUSB.println("That was the id");
    // void setId(char *DevAddr, char *DevEUI, char *AppEUI);
    lora.setId(NULL, "XXX", "XXX");
    // setKey(char *NwkSKey, char *AppSKey, char *AppKey);
    lora.setKey(NULL, NULL, "XXX");
    
    lora.setDeciveMode(LWOTAA);
    lora.setDataRate(DR0, EU868);
    
    lora.setChannel(0, 868.1);
    lora.setChannel(1, 868.3);
    lora.setChannel(2, 868.5);
    lora.setChannel(3, 867.1);
    lora.setChannel(4, 867.3);
    lora.setChannel(5, 867.5);
    lora.setChannel(6, 867.7);
    
    lora.setReceiceWindowFirst(0);
    lora.setReceiceWindowSecond(869.5, DR3);
    lora.setAdaptiveDataRate(false);
    
    lora.setPower(20);
    
    while(!lora.setOTAAJoin(JOIN, 20000));
    SerialUSB.println("After OTAA join");

    // Start DHT sensor
    dht.begin();
}

void loop(void)
{   
    while (Serial.available() &gt; 0) {
      gps.encode(Serial.read());
    }
    if (gps.altitude.isUpdated()) {
      SerialUSB.println(gps.altitude.meters());
      SerialUSB.print("LAT=");  SerialUSB.println(gps.location.lat(), 6);
      SerialUSB.print("LONG="); SerialUSB.println(gps.location.lng(), 6);
      SerialUSB.print("ALT=");  SerialUSB.println(gps.altitude.meters());
      long latEncoded = (gps.location.lat() * 8388606) / 90;
      long lonEncoded = (gps.location.lng() * 8388606) / 180;
      SerialUSB.print("Lat encoded: "); 
      SerialUSB.println(latEncoded);
      SerialUSB.print("Lon encoded: "); 
      SerialUSB.println(lonEncoded);
      float h = dht.readHumidity();
      float t = dht.readTemperature();
      SerialUSB.print("Humidity is: ");
      SerialUSB.print(h);
      SerialUSB.print(", Temperature: ");
      SerialUSB.print(t);
      bool result = false;
      byte data[10] = {0};
      data[0] = h;
      data[1] = t + 100;
      data[2] = (byte) (latEncoded &gt;&gt; 16);
      data[3] = (byte) (latEncoded &gt;&gt; 8);
      data[4] = (byte) latEncoded;
      
      data[5] = (byte) (lonEncoded &gt;&gt; 16);
      data[6] = (byte) (lonEncoded &gt;&gt; 8);
      data[7] = (byte) lonEncoded;

      result = lora.transferPacket(data, 10);
      //result = lora.transferPacket(data, 10, 10);
      
      if(result)
      {
          short length;
          short rssi;
          
          memset(buffer, 0, 256);
          length = lora.receivePacket(buffer, 256, &amp;rssi);
          
          if(length)
          {
              SerialUSB.print("Length is: ");
              SerialUSB.println(length);
              SerialUSB.print("RSSI is: ");
              SerialUSB.println(rssi);
              SerialUSB.print("Data is: ");
              for(unsigned char i = 0; i &lt; length; i ++)
              {
                  SerialUSB.print("0x");
                  SerialUSB.print(buffer[i], HEX);
                  SerialUSB.print(" ");
              }
              SerialUSB.println();
          }
          delay(1000 * 60 * 5);
      }
    }
    
}


</pre>
<h2>Setting Up the Spreadsheet</h2>
<p>Log into your Google Docs account and create an new Spreadsheet</p>
<p>Give the Spreadsheet a meaningful name, e.g. LoriotLogger</p>
<p>You might also want to add the column headers:</p>
<table dir="ltr" border="1" cellspacing="0" cellpadding="0">
<colgroup>
<col width="100" />
<col width="100" />
<col width="171" />
<col width="235" />
<col width="100" />
<col width="100" />
<col width="100" />
<col width="100" />
<col width="100" />
<col width="100" />
<col width="100" />
<col width="100" />
<col width="100" />
<col width="100" />
<col width="100" />
<col width="100" />
<col width="100" /></colgroup>
<tbody>
<tr>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;rssi&quot;}">rssi</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;seqno&quot;}">seqno</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;data&quot;}">data</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;humidity&quot;}">humidity</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;temp&quot;}">temp</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;lat&quot;}">lat</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;lon&quot;}">lon</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;freq&quot;}">freq</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;ack&quot;}">ack</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;fcnt&quot;}">fcnt</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;dr&quot;}">dr</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;bat&quot;}">bat</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;port&quot;}">port</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;snr&quot;}">snr</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;EUI&quot;}">EUI</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;cmc&quot;}">cmc</td>
<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;ts&quot;}">ts</td>
</tr>
</tbody>
</table>
<p>Copy/paste them from here and insert them before all other rows.</p>
<p>Then go to Tools &gt; Script Editor&#8230;</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2738" data-permalink="https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html/toolsscripteditor" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?fit=1120%2C602&amp;ssl=1" data-orig-size="1120,602" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ToolsScriptEditor" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?fit=300%2C161&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?fit=730%2C392&amp;ssl=1" class="size-medium wp-image-2738 alignnone" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?resize=300%2C161&#038;ssl=1" alt="" width="300" height="161" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?resize=300%2C161&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?resize=768%2C413&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?resize=1024%2C550&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?w=1120&amp;ssl=1 1120w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Replace the few lines of code with the code below:</p>
<pre>// 2017 by Daniel Eichhorn, https://blog.squix.org
// Inspired by https://gist.github.com/bmcbride/7069aebd643944c9ee8b
// Create or open an existing Sheet and click Tools &gt; Script editor and enter the code below
// 1. Enter sheet name where data is to be written below
var SHEET_NAME = "Sheet1";
// 2. Publish &gt; Deploy as web app
//    - enter Project Version name and click 'Save New Version'
//    - set security level and enable service (most likely execute as 'me' and access 'anyone, even anonymously)
// 3. Copy the 'Current web app URL' and post this in your form/script action

var SCRIPT_PROP = PropertiesService.getScriptProperties(); // new property service

// If you don't want to expose either GET or POST methods you can comment out the appropriate function
function doGet(e){
  return handleResponse(e);
}

function doPost(e){
  return handleResponse(e);
}

function handleResponse(e) {
  Logger.log("arrived in handleResponse");
  var jsonData = JSON.parse(e.postData.contents);
  
  try {
    // next set where we write the data - you could write to multiple/alternate destinations
    var doc = SpreadsheetApp.openById(SCRIPT_PROP.getProperty("key"));
    var sheet = doc.getSheetByName(SHEET_NAME); 

    var nextRow = sheet.getLastRow()+1; // get next row
    var row = [];
    var headerRow = [];

    row.push(jsonData.rssi);
    row.push(jsonData.seqno);
    row.push(jsonData.data);
    var humidityHex = jsonData.data.substring(0, 2);
    row.push(parseInt(humidityHex, 16));
    var tempHex = jsonData.data.substring(2, 4);
    row.push(parseInt(tempHex, 16) - 100);
    var latHex = jsonData.data.substring(4, 10);
    var lonHex = jsonData.data.substring(10, 16);
    var latEncoded = parseInt(latHex, 16);
    var lonEncoded = parseInt(lonHex, 16);
    row.push((latEncoded / 8388606) * 90);
    row.push((lonEncoded / 8388606) * 180);

    row.push(jsonData.freq);
    row.push(jsonData.ack);
    row.push(jsonData.fcnt);
    row.push(jsonData.dr);
    row.push(jsonData.bat);
    row.push(jsonData.port);
    row.push(jsonData.snr);
    row.push(jsonData.EUI);
    row.push(jsonData.cmd);
    row.push(jsonData.ts);

    // more efficient to set values as [][] array than individually
    sheet.getRange(nextRow, 1, 1, row.length).setValues([row]);
    // return json success results
    return ContentService
          .createTextOutput(JSON.stringify({"result":"success", "row": nextRow}))
          .setMimeType(ContentService.MimeType.JSON);
  } catch(e) {
    // if error return this
    return ContentService
          .createTextOutput(JSON.stringify({"result":"error", "error": e}))
          .setMimeType(ContentService.MimeType.JSON);
  } 
}


</pre>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2737" data-permalink="https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html/lorawanloggerscripteditor" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?fit=2396%2C968&amp;ssl=1" data-orig-size="2396,968" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="LoRaWANLoggerScriptEditor" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?fit=300%2C121&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?fit=730%2C295&amp;ssl=1" class="alignnone wp-image-2737 size-large" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?resize=730%2C295&#038;ssl=1" alt="" width="730" height="295" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?resize=1024%2C414&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?resize=300%2C121&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?resize=768%2C310&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?w=1460&amp;ssl=1 1460w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?w=2190&amp;ssl=1 2190w" sizes="(max-width: 730px) 100vw, 730px" /></a></p>
<p>Publish &gt; Deploy as web app</p>
<ul>
<li>enter Project Version name and click &#8216;Save New Version&#8217;</li>
<li>set security level and enable service (most likely execute as &#8216;me&#8217; and access &#8216;anyone, even anonymously)</li>
<li>Copy the &#8216;Current web app URL&#8217; and post this in your form/script action</li>
</ul>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2736" data-permalink="https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html/publishdialog" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?fit=918%2C836&amp;ssl=1" data-orig-size="918,836" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="PublishDialog" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?fit=300%2C273&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?fit=730%2C665&amp;ssl=1" class="size-medium wp-image-2736 alignnone" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?resize=300%2C273&#038;ssl=1" alt="" width="300" height="273" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?resize=300%2C273&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?resize=768%2C699&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?w=918&amp;ssl=1 918w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Give permissions to the script:</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2735" data-permalink="https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html/reviewpermissions" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?fit=1022%2C358&amp;ssl=1" data-orig-size="1022,358" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ReviewPermissions" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?fit=300%2C105&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?fit=730%2C256&amp;ssl=1" class="size-medium wp-image-2735 alignnone" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?resize=300%2C105&#038;ssl=1" alt="" width="300" height="105" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?resize=300%2C105&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?resize=768%2C269&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?w=1022&amp;ssl=1 1022w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Copy the URL:</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2734" data-permalink="https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html/deployaswebappurl" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?fit=910%2C558&amp;ssl=1" data-orig-size="910,558" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="DeployAsWebAppURL" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?fit=300%2C184&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?fit=730%2C448&amp;ssl=1" class="size-medium wp-image-2734 alignnone" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?resize=300%2C184&#038;ssl=1" alt="" width="300" height="184" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?resize=300%2C184&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?resize=768%2C471&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?resize=908%2C558&amp;ssl=1 908w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?w=910&amp;ssl=1 910w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>&nbsp;</p>
<h2>Connecting Loriot with your Google Spreadsheet</h2>
<p>Switch again to the Loriot page in your browser. Navigate to the Sample App &gt; Output page:</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.31.23.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="3787" data-permalink="https://blog.squix.org/2017/11/using-seeeduino-lorawan-with-gps-and-loriot-io.html/screen-shot-2017-11-22-at-16-31-23" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.31.23.png?fit=2050%2C1002&amp;ssl=1" data-orig-size="2050,1002" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2017-11-22 at 16.31.23" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.31.23.png?fit=300%2C147&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.31.23.png?fit=730%2C357&amp;ssl=1" class="alignnone wp-image-3787 size-large" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.31.23.png?resize=730%2C357&#038;ssl=1" alt="" width="730" height="357" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.31.23.png?resize=1024%2C501&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.31.23.png?resize=300%2C147&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.31.23.png?resize=768%2C375&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.31.23.png?w=1460&amp;ssl=1 1460w" sizes="(max-width: 730px) 100vw, 730px" /></a></p>
<p>Click on the &#8220;Change button&#8221; and select HTTP Push. Now enter the address from Google Docs, when you published the app. Done, Loriot should now send the data to Google Docs! <strong>One Note:</strong> I was logged into two google accounts at the same time, so my URL generated had an additional &#8220;/u/1&#8221; and it started with https://script.google.com/macros/u/1/XXX. If your URL looks like this then remove the /u/1/ from the URL.</p>
<p>&nbsp;</p>
<h2>Starting the Seeduino</h2>
<p>Now let&#8217;s see if the data arrives!</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.36.31.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="3788" data-permalink="https://blog.squix.org/2017/11/using-seeeduino-lorawan-with-gps-and-loriot-io.html/screen-shot-2017-11-22-at-16-36-31" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.36.31.png?fit=2144%2C1002&amp;ssl=1" data-orig-size="2144,1002" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2017-11-22 at 16.36.31" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.36.31.png?fit=300%2C140&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.36.31.png?fit=730%2C341&amp;ssl=1" class="alignnone wp-image-3788 size-large" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.36.31.png?resize=730%2C341&#038;ssl=1" alt="" width="730" height="341" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.36.31.png?resize=1024%2C479&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.36.31.png?resize=300%2C140&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.36.31.png?resize=768%2C359&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.36.31.png?w=1460&amp;ssl=1 1460w" sizes="(max-width: 730px) 100vw, 730px" /></a></p>
<p>Hurray!</p>
<p>&nbsp;</p>
<h2>Visualize the data on Google Maps</h2>
<p>Now to the finishing: let&#8217;s put the markers on a map! Google Spreadsheets only have very simple maps so navigate to <a href="https://www.google.com/maps/d/u/0/" target="_blank" rel="noopener">https://www.google.com/maps/d/u/0/</a>.</p>
<p>In the left menu select &#8220;Import&#8221; and select your Spreadsheet from Google drive.</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.40.58.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="3789" data-permalink="https://blog.squix.org/2017/11/using-seeeduino-lorawan-with-gps-and-loriot-io.html/screen-shot-2017-11-22-at-16-40-58" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.40.58.png?fit=626%2C742&amp;ssl=1" data-orig-size="626,742" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2017-11-22 at 16.40.58" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.40.58.png?fit=253%2C300&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.40.58.png?fit=626%2C742&amp;ssl=1" class="alignnone size-medium wp-image-3789" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.40.58.png?resize=253%2C300&#038;ssl=1" alt="" width="253" height="300" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.40.58.png?resize=253%2C300&amp;ssl=1 253w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.40.58.png?w=626&amp;ssl=1 626w" sizes="(max-width: 253px) 100vw, 253px" /></a></p>
<p>Now select the &#8220;lat&#8221; and &#8220;lon&#8221; column as the coordinate columns and the seqno column for the title. Create the map and you get a wonderful representation of your geo fixes, sent over LoRaWan to Loriot.io, from there to a App Script instance, which inserted the data into a spreadsheet, and from there you imported the data into a map! Wow! If you got it to work you really made it!</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.45.16.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="3790" data-permalink="https://blog.squix.org/2017/11/using-seeeduino-lorawan-with-gps-and-loriot-io.html/screen-shot-2017-11-22-at-16-45-16" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.45.16.png?fit=2318%2C1344&amp;ssl=1" data-orig-size="2318,1344" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2017-11-22 at 16.45.16" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.45.16.png?fit=300%2C174&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.45.16.png?fit=730%2C423&amp;ssl=1" class="alignnone wp-image-3790 size-large" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.45.16.png?resize=730%2C423&#038;ssl=1" alt="" width="730" height="423" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.45.16.png?resize=1024%2C594&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.45.16.png?resize=300%2C174&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.45.16.png?resize=768%2C445&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.45.16.png?w=1460&amp;ssl=1 1460w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-16.45.16.png?w=2190&amp;ssl=1 2190w" sizes="(max-width: 730px) 100vw, 730px" /></a></p>
<p>Do you have questions about this post? Go over to <a href="https://support.squix.org" target="_blank" rel="noopener">https://support.squix.org</a> and place it there so everyone can profit!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.squix.org/2017/11/using-seeeduino-lorawan-with-gps-and-loriot-io.html/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3784</post-id>	</item>
		<item>
		<title>TheThingsNetwork/ LoRaWAN: How to Use Google Spreadsheet to Log data</title>
		<link>https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html</link>
					<comments>https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html#comments</comments>
		
		<dc:creator><![CDATA[Daniel Eichhorn]]></dc:creator>
		<pubDate>Sat, 29 Jul 2017 12:00:41 +0000</pubDate>
				<category><![CDATA[LoRaWAN]]></category>
		<category><![CDATA[google apps]]></category>
		<category><![CDATA[logger]]></category>
		<category><![CDATA[lorawan]]></category>
		<category><![CDATA[spreadsheet]]></category>
		<category><![CDATA[thethingsnetwork]]></category>
		<category><![CDATA[ttn]]></category>
		<guid isPermaLink="false">https://blog.squix.org/?p=2731</guid>

					<description><![CDATA[In my last post I showed you how to configure the Seeeduino LoRaWAN module to connect to TheThingsNetwork (TTN). But this is only half the rent. You want to do something with the data the node sends, right? This post will show you how you can ... <p><a class="read-more btn btn-secondary" href="https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html">Read More</a></p>]]></description>
										<content:encoded><![CDATA[<p>In <a href="https://blog.squix.org/2017/07/seeeduino-lora-gps-getting-started-with-lorawan-and-ttn.html" target="_blank" rel="noopener">my last post</a> I showed you how to configure the <a href="https://blog.squix.org/go/seeedstudio-lorawan-gps" target="_blank" rel="noopener">Seeeduino LoRaWAN module</a> to connect to TheThingsNetwork (TTN). But this is only half the rent. You want to do something with the data the node sends, right? This post will show you how you can log the messages from the node to a Google Spreadsheet. It is relatively easy to do but not save, since it lacks security features.</p>
<p><span id="more-2731"></span></p>
<p>In the first post of this series we had a look at a very specific LoRaWAN module, the Seeeduino LoRaWAN. We configured the module as well as TheThingsNetwork to allow the module to send data to the network. But TTN is just the network infrastructure. It doesn&#8217;t allow you to do anything with the data the nodes sends you beyond having a quick peek. Now I want to to show you how you can build a simple system which logs the data in a spread sheet. To get started you need:</p>
<ul>
<li>Configured Seeeduino LoRaWAN module (<a href="https://blog.squix.org/2017/07/seeeduino-lora-gps-getting-started-with-lorawan-and-ttn.html">read more</a>)</li>
<li>Configured TheThingsNetwork account (<a href="https://blog.squix.org/2017/07/seeeduino-lora-gps-getting-started-with-lorawan-and-ttn.html">read more</a>)</li>
<li>Google Docs account</li>
</ul>
<p>&nbsp;</p>
<h2>Setting Up the Spreadsheet</h2>
<p>Log into your Google Docs account and create an new Spreadsheet</p>
<p>Give the Spreadsheet a meaningful name, e.g. LoRaLogger</p>
<p>Then go to Tools &gt; Script Editor&#8230;</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2738" data-permalink="https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html/toolsscripteditor" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?fit=1120%2C602&amp;ssl=1" data-orig-size="1120,602" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ToolsScriptEditor" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?fit=300%2C161&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?fit=730%2C392&amp;ssl=1" class="size-medium wp-image-2738 alignnone" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?resize=300%2C161&#038;ssl=1" alt="" width="300" height="161" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?resize=300%2C161&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?resize=768%2C413&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?resize=1024%2C550&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ToolsScriptEditor.png?w=1120&amp;ssl=1 1120w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Replace the few lines of code with the code below:</p>
<pre>// 2017 by Daniel Eichhorn, https://blog.squix.org
// Inspired by https://gist.github.com/bmcbride/7069aebd643944c9ee8b
// Create or open an existing Sheet and click Tools &gt; Script editor and enter the code below
// 1. Enter sheet name where data is to be written below
var SHEET_NAME = "Sheet1";
// 2. Run &gt; setup
// 3. Publish &gt; Deploy as web app
//    - enter Project Version name and click 'Save New Version'
//    - set security level and enable service (most likely execute as 'me' and access 'anyone, even anonymously)
// 4. Copy the 'Current web app URL' and post this in your form/script action

var SCRIPT_PROP = PropertiesService.getScriptProperties(); // new property service

// If you don't want to expose either GET or POST methods you can comment out the appropriate function
function doGet(e){
  return handleResponse(e);
}

function doPost(e){
  return handleResponse(e);
}

function handleResponse(e) {
  var lock = LockService.getPublicLock();
  lock.waitLock(30000); // wait 30 seconds before conceding defeat.
  
  try {
    // next set where we write the data - you could write to multiple/alternate destinations
    var doc = SpreadsheetApp.openById(SCRIPT_PROP.getProperty("key"));
    var sheet = doc.getSheetByName(SHEET_NAME); 
    // we'll assume header is in row 1 but you can override with header_row in GET/POST data

    //var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];

    var nextRow = sheet.getLastRow()+1; // get next row
    var row = [];
    var headerRow = [];
    // loop through the header columns
    var jsonData = JSON.parse(e.postData.contents);
    
    headerRow.push("jsonData.app_id");
    headerRow.push("jsonData.dev_id");
    headerRow.push("jsonData.hardware_serial");
    headerRow.push("jsonData.port");
    headerRow.push("jsonData.counter");
    headerRow.push("jsonData.payload_raw");
    headerRow.push("jsonData.payload_decoded");
    headerRow.push("jsonData.metadata.time");
    headerRow.push("jsonData.metadata.frequency");
    headerRow.push("jsonData.metadata.modulation");
    headerRow.push("jsonData.metadata.data_rate");
    headerRow.push("jsonData.metadata.coding_rate");
    headerRow.push("jsonData.metadata.downlink_url");
    for (var i = 0; i &lt; jsonData.metadata.gateways.length; i++) {
      var gateway = jsonData.metadata.gateways[i];
      headerRow.push("gateway.gtw_id");
      headerRow.push("gateway.timestamp");
      headerRow.push("gateway.channel");
      headerRow.push("gateway.rssi");
      headerRow.push("gateway.snr");
      headerRow.push("gateway.latitude");
      headerRow.push("gateway.longitude");
      headerRow.push("gateway.altitude");
    }
    sheet.getRange(1, 1, 1, headerRow.length).setValues([headerRow]);
    
    row.push(jsonData.app_id);
    row.push(jsonData.dev_id);
    row.push(jsonData.hardware_serial);
    row.push(jsonData.port);
    row.push(jsonData.counter);
    row.push(jsonData.payload_raw);
    var raw = Utilities.base64Decode(jsonData.payload_raw);
    var decoded = Utilities.newBlob(raw).getDataAsString();
    row.push(decoded);
    row.push(jsonData.metadata.time);
    row.push(jsonData.metadata.frequency);
    row.push(jsonData.metadata.modulation);
    row.push(jsonData.metadata.data_rate);
    row.push(jsonData.metadata.coding_rate);
    row.push(jsonData.metadata.downlink_url);
    for (var i = 0; i &lt; jsonData.metadata.gateways.length; i++) {
      var gateway = jsonData.metadata.gateways[i];
      row.push(gateway.gtw_id);
      row.push(gateway.timestamp);
      row.push(gateway.channel);
      row.push(gateway.rssi);
      row.push(gateway.snr);
      row.push(gateway.latitude);
      row.push(gateway.longitude);
      row.push(gateway.altitude);

    }

    // more efficient to set values as [][] array than individually
    sheet.getRange(nextRow, 1, 1, row.length).setValues([row]);
    // return json success results
    return ContentService
          .createTextOutput(JSON.stringify({"result":"success", "row": nextRow}))
          .setMimeType(ContentService.MimeType.JSON);
  } catch(e) {
    // if error return this
    return ContentService
          .createTextOutput(JSON.stringify({"result":"error", "error": e}))
          .setMimeType(ContentService.MimeType.JSON);
  } finally { //release lock
    lock.releaseLock();
  }
}

function setup() {
  var doc = SpreadsheetApp.getActiveSpreadsheet();
  SCRIPT_PROP.setProperty("key", doc.getId());
}

</pre>
<p>&nbsp;</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2737" data-permalink="https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html/lorawanloggerscripteditor" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?fit=2396%2C968&amp;ssl=1" data-orig-size="2396,968" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="LoRaWANLoggerScriptEditor" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?fit=300%2C121&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?fit=730%2C295&amp;ssl=1" class="size-medium wp-image-2737 alignnone" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?resize=300%2C121&#038;ssl=1" alt="" width="300" height="121" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?resize=300%2C121&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?resize=768%2C310&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?resize=1024%2C414&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?w=1460&amp;ssl=1 1460w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANLoggerScriptEditor.png?w=2190&amp;ssl=1 2190w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Goto Run &gt; Setup</p>
<p>Publish &gt; Deploy as web app</p>
<ul>
<li>enter Project Version name and click &#8216;Save New Version&#8217;</li>
<li>set security level and enable service (most likely execute as &#8216;me&#8217; and access &#8216;anyone, even anonymously)</li>
<li>Copy the &#8216;Current web app URL&#8217; and post this in your form/script action</li>
</ul>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2736" data-permalink="https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html/publishdialog" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?fit=918%2C836&amp;ssl=1" data-orig-size="918,836" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="PublishDialog" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?fit=300%2C273&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?fit=730%2C665&amp;ssl=1" class="size-medium wp-image-2736 alignnone" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?resize=300%2C273&#038;ssl=1" alt="" width="300" height="273" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?resize=300%2C273&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?resize=768%2C699&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/PublishDialog.png?w=918&amp;ssl=1 918w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Give permissions to the script:</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2735" data-permalink="https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html/reviewpermissions" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?fit=1022%2C358&amp;ssl=1" data-orig-size="1022,358" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ReviewPermissions" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?fit=300%2C105&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?fit=730%2C256&amp;ssl=1" class="size-medium wp-image-2735 alignnone" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?resize=300%2C105&#038;ssl=1" alt="" width="300" height="105" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?resize=300%2C105&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?resize=768%2C269&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/ReviewPermissions.png?w=1022&amp;ssl=1 1022w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Copy the URL:</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2734" data-permalink="https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html/deployaswebappurl" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?fit=910%2C558&amp;ssl=1" data-orig-size="910,558" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="DeployAsWebAppURL" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?fit=300%2C184&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?fit=730%2C448&amp;ssl=1" class="size-medium wp-image-2734 alignnone" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?resize=300%2C184&#038;ssl=1" alt="" width="300" height="184" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?resize=300%2C184&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?resize=768%2C471&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?resize=908%2C558&amp;ssl=1 908w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/DeployAsWebAppURL.png?w=910&amp;ssl=1 910w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>&nbsp;</p>
<h2>Setting Up TTN</h2>
<p>Now we have to tell TheThingsNetwork where to write the data to. Go to your application in the TTN console and click on the &#8220;Integration&#8221; button. Then select the HTTP Integration:</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNIntegrationOptions.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2739" data-permalink="https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html/ttnintegrationoptions" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNIntegrationOptions.png?fit=2164%2C872&amp;ssl=1" data-orig-size="2164,872" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="TTNIntegrationOptions" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNIntegrationOptions.png?fit=300%2C121&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNIntegrationOptions.png?fit=730%2C294&amp;ssl=1" class="size-medium wp-image-2739 alignnone" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNIntegrationOptions.png?resize=300%2C121&#038;ssl=1" alt="" width="300" height="121" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNIntegrationOptions.png?resize=300%2C121&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNIntegrationOptions.png?resize=768%2C309&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNIntegrationOptions.png?resize=1024%2C413&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNIntegrationOptions.png?w=1460&amp;ssl=1 1460w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Now paste the URL you earlier copied from the Google Spreadsheet to the URL form field and set the other fields like here:</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/IntegrationForm.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2740" data-permalink="https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html/integrationform" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/IntegrationForm.png?fit=2154%2C1410&amp;ssl=1" data-orig-size="2154,1410" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="IntegrationForm" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/IntegrationForm.png?fit=300%2C196&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/IntegrationForm.png?fit=730%2C478&amp;ssl=1" class="size-medium wp-image-2740 alignnone" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/IntegrationForm.png?resize=300%2C196&#038;ssl=1" alt="" width="300" height="196" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/IntegrationForm.png?resize=300%2C196&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/IntegrationForm.png?resize=768%2C503&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/IntegrationForm.png?resize=1024%2C670&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/IntegrationForm.png?w=1460&amp;ssl=1 1460w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Leave the other fields as they are and click on &#8220;Add integration&#8221;. There you go! Now plug in your configured Seeeduino (or any other TTN node) and you&#8217;ll get a new row for each message!</p>
<p>&nbsp;</p>
<h2>Summary</h2>
<p>I hope you found this really easy and it worked for you. We created a simple IoT application which can log (sensor) data and node meta data. If you know how to write app script you can easily extend the code by sending push notifications to your cell phone in special situations. Or you can add a chart to the spread sheet analyzing signal quality, etc.</p>
<p>One word of warning: the current script is not really save, anyone knowing the URL can send data to your spread sheet. We could improve it by adding an authentication header (in the currently) empty TTN form field and check it in our App script code.</p>
<p>Do you have questions about this post? Go over to <a href="https://support.squix.org" target="_blank" rel="noopener">https://support.squix.org</a> and place it there so everyone can profit!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.squix.org/2017/07/thethingsnetwork-how-to-use-google-spreadsheet-to-log-data.html/feed</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2731</post-id>	</item>
		<item>
		<title>Seeeduino LoRa GPS: Getting Started with LoRaWAN (and TTN)</title>
		<link>https://blog.squix.org/2017/07/seeeduino-lora-gps-getting-started-with-lorawan-and-ttn.html</link>
					<comments>https://blog.squix.org/2017/07/seeeduino-lora-gps-getting-started-with-lorawan-and-ttn.html#comments</comments>
		
		<dc:creator><![CDATA[Daniel Eichhorn]]></dc:creator>
		<pubDate>Mon, 24 Jul 2017 19:17:36 +0000</pubDate>
				<category><![CDATA[IoT Products]]></category>
		<category><![CDATA[LoRaWAN]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[lorawan]]></category>
		<category><![CDATA[seeeduino]]></category>
		<category><![CDATA[thethingsnetwork]]></category>
		<category><![CDATA[ttn]]></category>
		<guid isPermaLink="false">https://blog.squix.org/?p=2698</guid>

					<description><![CDATA[In the last couple of months I had the chance to play around with LoRaWAN. In case you have never heard of LoRaWAN, it is THE radio communication protocol for the Internet of Things (IoT). It is long range (thus LoRa) and consumes only little ... <p><a class="read-more btn btn-secondary" href="https://blog.squix.org/2017/07/seeeduino-lora-gps-getting-started-with-lorawan-and-ttn.html">Read More</a></p>]]></description>
										<content:encoded><![CDATA[<p>In the last couple of months I had the chance to play around with LoRaWAN. In case you have never heard of LoRaWAN, it is THE radio communication protocol for the Internet of Things (IoT). It is long range (thus LoRa) and consumes only little energy when transmitting. This guide will help you to get a <a href="https://blog.squix.org/go/seeedstudio-lorawan-gps" target="_blank" rel="noopener">Seeedstudio Seeeduino LoRa GPS</a> to TheThingsNetwork.<span id="more-2698"></span></p>
<p>TheThingsNetwork (TTN) is a community driven communication infrastructure currently using the LoRaWAN protocol. This means that instead of paying fees for your local Telecom provider you can connect your devices for free to the internet. Provided that there is already coverage of TTN in your area. <a href="https://www.thethingsnetwork.org/map" target="_blank" rel="noopener">This map</a> can give you an indication if you already have coverage. Otherwise don&#8217;t worry, for little money you can become a infrastructure provider yourself. You can build a &#8220;real&#8221; multi-channel gateway (something like a WiFi access point) for about 200-300$. And a single channel gateway can be built for as little as USD $15 (watch <a href="https://www.youtube.com/watch?v=ZV_ZY-0Q1lo" target="_blank" rel="noopener">this Video</a> from my fellow countryman Andreas Spiess). But this post is not about the infrastructure, it is about getting one specific LoRa hardware connected and this is more complicated than you think (the first time).</p>
<p>&nbsp;</p>
<h2>Arduino IDE setup</h2>
<p>This chapter is all about getting the programming environment ready for the Seeeduino. Since this might change you probably find most up-to-date information on the Seeeduino Wiki: <a href="http://wiki.seeed.cc/Seeeduino_LoRAWAN/" target="_blank" rel="noopener">http://wiki.seeed.cc/Seeeduino_LoRAWAN/</a>. Here a few quick steps:</p>
<ol>
<li>Download the latest Arduino IDE: <a href="https://www.arduino.cc/en/main/software" target="_blank" rel="noopener">https://www.arduino.cc/en/main/software</a></li>
<li>Go the preferences/settings and under &#8220;Additional Board Manager URLs&#8221; add the following URL: <a href="https://raw.githubusercontent.com/Seeed-Studio/Seeed_Platform/master/package_seeeduino_boards_index.json">https://raw.githubusercontent.com/Seeed-Studio/Seeed_Platform/master/package_seeeduino_boards_index.json</a> If you already have one add the new one separated by a comma</li>
<li>Now head to Tools &gt; Board &gt; Boards Manager and install the Seeeduino SAMD board.</li>
<li>On Windows you&#8217;ll have to install a Serial driver as well. On my Mac this wasn&#8217;t necessary</li>
<li>Now select in Tools &gt; Board the &#8220;Seeeduino LoRaWAN&#8221; board</li>
<li>Under File &gt; Examples &gt; LoRaWAN select the OTAA sample</li>
</ol>
<p>&nbsp;</p>
<h2>TheThingsNetwork setup</h2>
<p>As mentioned earlier TheThingsNetwork is your telecom provider you are going to use in this setup. There might be other providers in your country. In Switzerland we have <a href="http://lpn.swisscom.ch/e/">Swisscom LPN</a>, <a href="https://loriot.io/" target="_blank" rel="noopener">Loriot.io</a> (a cool Swiss startup with world wide infrastructure) and TTN. In this post we&#8217;re going to use TTN since it is free to use and relatively easy to setup.</p>
<p>LoRaWAN devices send with a broadcast, which means all LoRaWAN antennas from all providers are going to pick up your (encrypted) message. Only the provider with which the device is registered will forward the message to your application. The others will discard the message. The following steps show you how to register the Seeeduino with TTN. First create an account, then create an application and then register your device within this application:</p>
<ol>
<li>Go to <a href="https://www.thethingsnetwork.org/" target="_blank" rel="noopener">https://www.thethingsnetwork.org/</a> and register an account</li>
<li>Go to <a href="https://console.thethingsnetwork.org/" target="_blank" rel="noopener">https://console.thethingsnetwork.org/</a> and select &#8220;Application&#8221;</li>
<li>On the next screen click &#8220;+add application&#8221;</li>
<li>In the next screen pick a meaning full name for your application in lowercase letters for Application ID and write something in Description. Under Handler Registration pick your region, for Europe I have picked ttn-handler-eu</li>
<li>On the next screen click &#8220;register device&#8221;</li>
<li>For &#8220;Device ID&#8221; pick a meaningful name in lowercase letters</li>
<li>On the left side of the DevEUI field click on the arrow icons. The icon changes into a pen and this will cause the ID to be generated. This is necessary since the API doesn&#8217;t offer a way to read out the devices MAC address. See image below</li>
<li>In App EUI pick the ID of the application we created earlier</li>
</ol>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNAddApplication.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2709" data-permalink="https://blog.squix.org/2017/07/seeeduino-lora-gps-getting-started-with-lorawan-and-ttn.html/ttnaddapplication" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNAddApplication.png?fit=2152%2C1164&amp;ssl=1" data-orig-size="2152,1164" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="TTNAddApplication" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNAddApplication.png?fit=300%2C162&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNAddApplication.png?fit=730%2C395&amp;ssl=1" class="aligncenter size-medium wp-image-2709" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNAddApplication.png?resize=300%2C162&#038;ssl=1" alt="" width="300" height="162" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNAddApplication.png?resize=300%2C162&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNAddApplication.png?resize=768%2C415&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNAddApplication.png?resize=1024%2C554&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNAddApplication.png?resize=635%2C346&amp;ssl=1 635w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/TTNAddApplication.png?w=1460&amp;ssl=1 1460w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>&nbsp;</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/RegisterSeeeduino.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2713" data-permalink="https://blog.squix.org/2017/07/seeeduino-lora-gps-getting-started-with-lorawan-and-ttn.html/registerseeeduino" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/RegisterSeeeduino.png?fit=1357%2C803&amp;ssl=1" data-orig-size="1357,803" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="RegisterSeeeduino" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/RegisterSeeeduino.png?fit=300%2C178&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/RegisterSeeeduino.png?fit=730%2C432&amp;ssl=1" class="aligncenter size-medium wp-image-2713" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/RegisterSeeeduino.png?resize=300%2C178&#038;ssl=1" alt="" width="300" height="178" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/RegisterSeeeduino.png?resize=300%2C178&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/RegisterSeeeduino.png?resize=768%2C454&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/RegisterSeeeduino.png?resize=1024%2C606&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/RegisterSeeeduino.png?w=1357&amp;ssl=1 1357w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<h2>Adapting &amp; Running the Code</h2>
<p>Now it&#8217;s time to adapt the OTAA code. Replace the line lora.setKey(..) with the values below. I copied here also the signature of the two methods so you know which value you have to put there. setId(NULL, DevEUI, AppEUI) and setKey(NULL, NULL, AppKey):</p>
<pre>    // void setId(char *DevAddr, char *DevEUI, char *AppEUI);
    lora.setId(NULL, "12409E2345695432", "70B3D57EF0006593");
    // setKey(char *NwkSKey, char *AppSKey, char *AppKey);
    lora.setKey(NULL, NULL, "47BDA77B6D7B4DDA7DC182E54295FE4E");
</pre>
<p>Now make sure to select the Seeeduino under Tools &gt; Port and upload the sketch. If you are not owning a LoRaWAN gateway yourself but you think that one should be close then remove obstacles between you and that gateway. LoRaWAN can penetrate walls but how deep into the house the signal is strong enough depends on many factors. Upload the code and open the serial monitor. If everything worked out well your output should look something like this:</p>
<pre>+VER: 2.0.10
+ID: DevAddr, 26:01:3A:44
+ID: DevEui, 12:40:9E:23:45:69:54:32
+ID: AppEui, 70:B3:D5:7E:F0:00:65:93
+ID: DevEui, 12:40:9E:23:45:69:54:32
+ID: AppEui, 70:B3:D5:7E:+KEY: APPKEY 47 BD A7 7B 6D 7B 4D DA 7D C1 82 E5 42 95 FE 4E 
+MODE: LWOTAA
+DR: EU868
+DR: DR0
+DR: EU868 DR0  SF12 BW125K 
+CH: 0,868100000,DR0:DR5
+CH: 1,868300000,DR0:DR5
+CH: 2,868500000,DR0:DR5
+RXWIN1: OFF; 3; 0,868100000; 1,868300000; 2,868500000; 
+RXWIN2: 869500000,DR3
+POWER: 20
+JOIN: Start
+JOIN: NORMAL
+JOIN: Network joined
+JOIN: NetID 000013 DevAddr 26:01:21:52
+JOIN: Done
+MSG: Start
+MSG: TX "Hello World!"
+MSG: Done
</pre>
<p>Now you can also go back to your TTN console (website) and see if the packages have arrived there.</p>
<p><a href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANPackagesReceived.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2707" data-permalink="https://blog.squix.org/2017/07/seeeduino-lora-gps-getting-started-with-lorawan-and-ttn.html/lorawanpackagesreceived" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANPackagesReceived.png?fit=2152%2C764&amp;ssl=1" data-orig-size="2152,764" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="LoRaWANPackagesReceived" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANPackagesReceived.png?fit=300%2C107&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANPackagesReceived.png?fit=730%2C259&amp;ssl=1" class="aligncenter wp-image-2707 size-large" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANPackagesReceived.png?resize=730%2C259&#038;ssl=1" alt="" width="730" height="259" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANPackagesReceived.png?resize=1024%2C364&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANPackagesReceived.png?resize=300%2C107&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANPackagesReceived.png?resize=768%2C273&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/LoRaWANPackagesReceived.png?w=1460&amp;ssl=1 1460w" sizes="(max-width: 730px) 100vw, 730px" /></a></p>
<p>&nbsp;</p>
<h2>Where to buy</h2>
<p>You can buy the Seeeduino LoRaWAN with GPS module from Seeedstudio:<br />
<a href="https://blog.squix.org/go/seeedstudio-lorawan-gps" target="_blank" rel="noopener">Seeedstudio LoRaWAN w/GPS</a></p>
<p>&nbsp;</p>
<h2>Summary</h2>
<p>This post showed you how you can connect the <a href="https://blog.squix.org/go/seeedstudio-lorawan-gps" target="_blank" rel="noopener">Seeeduino LoRaWAN w/GPS</a> to TheThingsNetwork. This is just half the rent. In one of my next posts I want to show you how you can use the GPS module on the device to send the Seeeduino&#8217;s location over LoRaWAN. And finally we also want to receive the data in our own application. So a future post will show you how to do that as well.</p>
<p><a href="No categories https://blog.squix.org/go/seeedstudio-lorawan-gps"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="2699" data-permalink="https://blog.squix.org/2017/07/seeeduino-lora-gps-getting-started-with-lorawan-and-ttn.html/biru-wp-20170724t185204gmt0200-jpg" data-orig-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/BIRU-WP-20170724T185204GMT0200.jpg?fit=1280%2C1280&amp;ssl=1" data-orig-size="1280,1280" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;2.2&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;iPhone 6s&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1500922324&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4.15&quot;,&quot;iso&quot;:&quot;160&quot;,&quot;shutter_speed&quot;:&quot;0.03030303030303&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}" data-image-title="Zürich / Zürich / Switzerland &#8211; 7/24/17" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/BIRU-WP-20170724T185204GMT0200.jpg?fit=300%2C300&amp;ssl=1" data-large-file="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/BIRU-WP-20170724T185204GMT0200.jpg?fit=730%2C730&amp;ssl=1" class="aligncenter size-medium wp-image-2699" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/BIRU-WP-20170724T185204GMT0200.jpg?resize=300%2C300&#038;ssl=1" alt="" width="300" height="300" srcset="https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/BIRU-WP-20170724T185204GMT0200.jpg?resize=300%2C300&amp;ssl=1 300w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/BIRU-WP-20170724T185204GMT0200.jpg?resize=150%2C150&amp;ssl=1 150w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/BIRU-WP-20170724T185204GMT0200.jpg?resize=768%2C768&amp;ssl=1 768w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/BIRU-WP-20170724T185204GMT0200.jpg?resize=1024%2C1024&amp;ssl=1 1024w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/BIRU-WP-20170724T185204GMT0200.jpg?resize=180%2C180&amp;ssl=1 180w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/BIRU-WP-20170724T185204GMT0200.jpg?resize=200%2C200&amp;ssl=1 200w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/BIRU-WP-20170724T185204GMT0200.jpg?resize=450%2C450&amp;ssl=1 450w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/BIRU-WP-20170724T185204GMT0200.jpg?resize=120%2C120&amp;ssl=1 120w, https://i0.wp.com/blog.squix.org/wp-content/uploads/2017/07/BIRU-WP-20170724T185204GMT0200.jpg?w=1280&amp;ssl=1 1280w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.squix.org/2017/07/seeeduino-lora-gps-getting-started-with-lorawan-and-ttn.html/feed</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2698</post-id>	</item>
	</channel>
</rss>
