<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.bunnfamily.nz/index.php?action=history&amp;feed=atom&amp;title=Lora_Gateway_and_Nodes</id>
	<title>Lora Gateway and Nodes - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.bunnfamily.nz/index.php?action=history&amp;feed=atom&amp;title=Lora_Gateway_and_Nodes"/>
	<link rel="alternate" type="text/html" href="https://wiki.bunnfamily.nz/index.php?title=Lora_Gateway_and_Nodes&amp;action=history"/>
	<updated>2026-04-12T03:18:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://wiki.bunnfamily.nz/index.php?title=Lora_Gateway_and_Nodes&amp;diff=51&amp;oldid=prev</id>
		<title>Simon: Created page with &quot;==Lora Gateway== &#039;&#039;&#039;Setup of the MicroTik wAP LR9&#039;&#039;&#039; Access the Things Network Portal on https://au1.cloud.thethings.network/console/  ([https://au1.cloud.thethings.network/console/ (link)]  Add a gateway, but you must use the Gateway EUI which comes from WinBox  File:MikroTik1.png  Then add this Gateway EUI to the Gateways setting in TTN Portal&lt;br&gt; Also add the gateway Server Address to the au1.cloud.thethings.network  File:MikroTik3.png   File:MikroTik2.png...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.bunnfamily.nz/index.php?title=Lora_Gateway_and_Nodes&amp;diff=51&amp;oldid=prev"/>
		<updated>2023-08-27T22:45:25Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Lora Gateway== &amp;#039;&amp;#039;&amp;#039;Setup of the MicroTik wAP LR9&amp;#039;&amp;#039;&amp;#039; Access the Things Network Portal on https://au1.cloud.thethings.network/console/  ([https://au1.cloud.thethings.network/console/ (link)]  Add a gateway, but you must use the Gateway EUI which comes from WinBox  &lt;a href=&quot;/index.php?title=File:MikroTik1.png&quot; title=&quot;File:MikroTik1.png&quot;&gt;File:MikroTik1.png&lt;/a&gt;  Then add this Gateway EUI to the Gateways setting in TTN Portal&amp;lt;br&amp;gt; Also add the gateway Server Address to the au1.cloud.thethings.network  &lt;a href=&quot;/index.php?title=File:MikroTik3.png&quot; title=&quot;File:MikroTik3.png&quot;&gt;File:MikroTik3.png&lt;/a&gt;   &lt;a href=&quot;/index.php?title=File:MikroTik2.png&quot; title=&quot;File:MikroTik2.png&quot;&gt;File:MikroTik2.png&lt;/a&gt;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Lora Gateway==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Setup of the MicroTik wAP LR9&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Access the Things Network Portal on https://au1.cloud.thethings.network/console/  ([https://au1.cloud.thethings.network/console/ (link)]&lt;br /&gt;
&lt;br /&gt;
Add a gateway, but you must use the Gateway EUI which comes from WinBox&lt;br /&gt;
&lt;br /&gt;
[[File:MikroTik1.png]]&lt;br /&gt;
&lt;br /&gt;
Then add this Gateway EUI to the Gateways setting in TTN Portal&amp;lt;br&amp;gt;&lt;br /&gt;
Also add the gateway Server Address to the au1.cloud.thethings.network&lt;br /&gt;
&lt;br /&gt;
[[File:MikroTik3.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:MikroTik2.png]]&lt;br /&gt;
&lt;br /&gt;
==Nodes==&lt;br /&gt;
&lt;br /&gt;
===Heltec===&lt;br /&gt;
&lt;br /&gt;
[https://github.com/lnlp/LMIC-node Link to LMIC setup for Heltec]&lt;br /&gt;
&lt;br /&gt;
[https://heltec-automation-docs.readthedocs.io/en/latest/general/sub_band_usage.html Heltec data page on frequencies]&lt;br /&gt;
&lt;br /&gt;
[https://docs.platformio.org/en/latest/what-is-platformio.html Use platformio to upload and monitor Heltecs]&lt;br /&gt;
&lt;br /&gt;
On the TTN Console add new devices under the &amp;quot;applications&amp;quot; portal.  Register a new device manually.  Select &amp;quot;S&amp;#039;&amp;#039;how advanced activation...&amp;#039;&amp;#039;.&amp;quot; to expose the ABP setiings&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Heltec1.png|first page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then generate a new DevEUI (not used) plus Device Address, AppSKey and NwkSKey which are used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Heltec2.png|scroll down]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Set the Network server address and application server address to my Australian portal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Heltec3.png|after scrolling some more]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and save changes.&lt;br /&gt;
&lt;br /&gt;
Once edited and added, then re-open the device under &amp;#039;applications portal&amp;#039;.  Scroll down and expand &amp;#039;&amp;#039;&amp;#039;&amp;#039;Network layer&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Heltec4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
keep scrolling until you can expand the &amp;quot;Advanced MAC settings and select &amp;quot;Resets frame counter&amp;quot; to enabled&lt;br /&gt;
&lt;br /&gt;
[[File:Heltec5.png]]&lt;br /&gt;
&lt;br /&gt;
Add a payload formatter specific to this device&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:heltec7.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Decoder(bytes, port) {&lt;br /&gt;
// Decode an uplink message from a buffer&lt;br /&gt;
// (array) of bytes to an object of fields.&lt;br /&gt;
var decoded = {};&lt;br /&gt;
// temperature&lt;br /&gt;
rawTemp = bytes[0] + bytes[1] * 256;&lt;br /&gt;
decoded.degreesC = sflt162f(rawTemp) * 100;&lt;br /&gt;
// humidity &lt;br /&gt;
rawHumid = bytes[2] + bytes[3] * 256;&lt;br /&gt;
decoded.humidity = sflt162f(rawHumid) * 100;&lt;br /&gt;
return decoded;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
function sflt162f(rawSflt16)&lt;br /&gt;
{&lt;br /&gt;
// rawSflt16 is the 2-byte number decoded from wherever;&lt;br /&gt;
// it&amp;#039;s in range 0..0xFFFF&lt;br /&gt;
// bit 15 is the sign bit&lt;br /&gt;
// bits 14..11 are the exponent&lt;br /&gt;
// bits 10..0 are the the mantissa. Unlike IEEE format, &lt;br /&gt;
// the msb is transmitted; this means that numbers&lt;br /&gt;
// might not be normalized, but makes coding for&lt;br /&gt;
// underflow easier.&lt;br /&gt;
// As with IEEE format, negative zero is possible, so&lt;br /&gt;
// we special-case that in hopes that JavaScript will&lt;br /&gt;
// also cooperate.&lt;br /&gt;
//&lt;br /&gt;
// The result is a number in the open interval (-1.0, 1.0);&lt;br /&gt;
//&lt;br /&gt;
// throw away high bits for repeatability.&lt;br /&gt;
rawSflt16 &amp;amp;= 0xFFFF;&lt;br /&gt;
 &lt;br /&gt;
// special case minus zero:&lt;br /&gt;
if (rawSflt16 == 0x8000)&lt;br /&gt;
    return -0.0;&lt;br /&gt;
 &lt;br /&gt;
// extract the sign.&lt;br /&gt;
var sSign = ((rawSflt16 &amp;amp; 0x8000) != 0) ? -1 : 1;&lt;br /&gt;
 &lt;br /&gt;
// extract the exponent&lt;br /&gt;
var exp1 = (rawSflt16 &amp;gt;&amp;gt; 11) &amp;amp; 0xF;&lt;br /&gt;
 &lt;br /&gt;
// extract the &amp;quot;mantissa&amp;quot; (the fractional part)&lt;br /&gt;
var mant1 = (rawSflt16 &amp;amp; 0x7FF) / 2048.0;&lt;br /&gt;
 &lt;br /&gt;
// convert back to a floating point number. We hope &lt;br /&gt;
// that Math.pow(2, k) is handled efficiently by&lt;br /&gt;
// the JS interpreter! If this is time critical code,&lt;br /&gt;
// you can replace by a suitable shift and divide.&lt;br /&gt;
var f_unscaled = sSign * mant1 * Math.pow(2, exp1 - 15);&lt;br /&gt;
 &lt;br /&gt;
return f_unscaled;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then in Visual Studio Code, open the platformio.ini file and enter the device address, NWKSKEY and APPSKEY as per the values created in the portal above&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Heltec6.png]]&lt;/div&gt;</summary>
		<author><name>Simon</name></author>
	</entry>
</feed>