background image

 

 

www.dragino.com

 

LG01-N/OLG01-N Gateway User Manual

 

   

34 / 61 

5.

 

Example 2: Manually send / receive LoRa packets 

There are two ways to use the LoRa Radio of Gateway: a) Through pkt_fwd process , b) Use the 

Radio separately.   

5.1

 

User LoRa Radio via pkt_fwd 

5.1.1

 

Use pkt_fwd to receive 

When user chooses the MQTT/TCP-IP/Customized mode, the lg01_pkt_fwd will auto start. It will 

listen the LoRa Radio Channel base on the setting in the web setting. 

 

If the LoRa end node send data in the match format, the pkt_fwd will store the data for further 

use, the logic of this receive part please see 

Customized_Script

. 

 

5.1.2

 

Use pkt_fwd to transmit 

(This is a new feature since 2019-Jan-30) 

The pkt_fwd also open a thread to listen to local files under directory 

/var/iot/push/

. Once there 

is a file in this directory, the thread will check if it is an outgoing file and send out the LoRa 

message if format match. Below is the file example (json format):   

 
{"txpk":{"imme":false,"tmst":861608339,"freq":925.1,"rfch":0,"powe":20,"modu":"L
ORA","datr":"SF7BW500","codr":"4/5","ipol":true,"size":22,"ncrc":true,"data":"YEklB
CaqCgADQAIAcQM6AP8B9TYzUA=="}} 
 

Explain: 

Name |    Type    | Function 
:----:|:------:|-------------------------------------------------------------- 
  imme | bool      | Send packet immediately (will ignore tmst & time) 
  tmst | number | Send packet on a certain timestamp value (will ignore time) 
  tmms | number | Send packet at a certain GPS time (GPS synchronization required) 
  freq | number | TX central frequency in MHz (unsigned float, Hz precision) 
  rfch | number | Concentrator "RF chain" used for TX (unsigned integer) 
  powe | number | TX output power in dBm (unsigned integer, dBm precision) 
  modu | string | Modulation identifier "LORA" or "FSK" 
  datr | string | LoRa datarate identifier (eg. SF12BW500) 

Summary of Contents for LG01N

Page 1: ...ild v5 1 1547896817 20190119 1921 2019 Jan 19 1 2 Add Downlink support and example firmware ver LG02_LG08 build v5 1 1548820215 20190130 1151 Correct typo for the UNO code of example for lg02_single_rx_tx 2019 Jan 30 1 2 1 Add OLG01 connector photo Add how to control LEDs Modify MQTT instruction 2019 Jun 19 1 2 2 Add photo for OLG01 4G installation 2019 Nov 1 1 2 3 Change the HTTP Port and SSH por...

Page 2: ...n 4G modem for internet access 17 3 5 Check Internet connection 19 4 Example 1 Configure as a LoRaWAN gateway Limited LoRaWAN mode 20 4 1 Create a gateway in TTN Server 20 4 2 Configure LG01N Gateway 22 4 2 1 Configure to connect to LoRaWAN server 22 4 2 2 Configure LG01 s Radio frequency 23 4 3 Create LoRa End Node 24 4 3 1 About Limited support for LoRaWAN 24 4 3 2 Preparation 25 4 3 3 Test with...

Page 3: ...d Transfer files 49 11 3 File System 49 11 4 Package maintain system 51 12 Upgrade Linux Firmware 52 12 1 Upgrade via Web UI 52 12 2 Upgrade via Linux console 52 13 FAQ 53 13 1 Why there is 433 868 915 version LoRa part 53 13 2 What is the frequency range of LG01N LoRa part 53 13 3 What does Limited support on LoRaWAN 53 13 4 Can I develop my own LoRa protocol and other software for LG01N 54 13 5 ...

Page 4: ...e Shooting 57 14 1 I get kernel error when install new package how to fix 57 14 2 How to recover the LG01N if firmware crash 58 14 3 I configured LG01N for WiFi access and lost its IP What to do now 59 15 Order Info 60 16 Packing Info 60 17 Support 60 18 Reference 61 ...

Page 5: ...ces provide flexible methods for users to connect their sensor networks to Internet LG01N OLG01N can support the LoRaWAN protocol in single frequency and customized LoRa transition protocol LG01N can be used to provide a low cost IoT wireless solution to support 50 100 sensor nodes Except limited LoRaWAN mode LG01N can support multiply working mode such as MQTT mode TCP IP Client mode to fit diffe...

Page 6: ... tx power mcs7 15 11db mcs0 17db 11b tx power 18db 11g 54M tx power 12db 11g 6M tx power 18db Wifi Sensitivity 11g 54M 71dbm 11n 20M 67dbm LoRa Spec Frequency Range Band 1 HF 862 1020 Mhz Band 2 LF 410 528 Mhz 168 dB maximum link budget 20 dBm 100 mW constant RF output vs 14 dBm high efficiency PA Programmable bit rate up to 300 kbps High sensitivity down to 148 dBm Bullet proof front end IIP3 12 ...

Page 7: ...gine up to 256 bytes with CRC Built in temperature sensor and low battery indicator Cellular 4G LTE optional Quectel EC25 LTE module Micro SIM Slot Internal 4G Antenna External 4G Sticker Antenna Up to 150Mbps downlink and 50Mbps uplink data rates Worldwide LTE UMTS HSPA and GSM GPRS EDGE coverage MIMO technology meets demands for data rate and link reliability in modem wireless communication syst...

Page 8: ...ing Built in web server Managed by Web GUI SSH via LAN or WiFi Internet connection via LAN WiFi 3G or 4G Failsafe design provides robustly system 1 x SX1276 SX1278 LoRa modules Full duplex LoRa transceiver Two receive channels and one transmit channel Limited support in LoRaWAN Support Private LoRa protocol Support upto 100 nodes LoRa band available at 433 868 915 920 Mhz Max range in LoRa 5 10 km...

Page 9: ...www dragino com LG01 N OLG01 N Gateway User Manual 9 61 1 5 Applications ...

Page 10: ... in the software side In this document we will use LG01N as the model number to explain the feature Model Photo Description LG01N Indoor version for single channel LoRa Gateway OLG01N Outdoor version for dual channel LoRa Gateway 1 7 Interfaces OLG01N Version Interface LoRa ANT In new version this antenna was built in device PWR WAN LAN POE toggle ...

Page 11: ... Manual 11 61 1 8 Install SIM card in 4G module LG01N OLG01N has optional built in 4G module version For the 4G version devices will be shipped with screws un assembly please open the box and use below direction to install the SIM card Micro SIM ...

Page 12: ...ill auto generate an unsecure WiFi network call dragino xxxxxx User can use the laptop to connect to this WiFi network The laptop will get an IP address 10 130 1 xxx and the LG01 has the default IP 10 130 1 1 Open a browser in the laptop and type http 10 130 1 1 cgi bin luci admin User will see the login interface of LG01N The account for Web Login is User Name root Password dragino Note the LG01 ...

Page 13: ...www dragino com LG01 N OLG01 N Gateway User Manual 13 61 Notice In case the WiFi network is disabled user can connect the PC to LG01N s LAN port the PC will get DHCP from LG01N and be able to access it ...

Page 14: ...s the typical network topology can be set in LG01N The typical network set up includes WAN Port Internet Mode WiFi Client Mode WiFi AP Mode USB Dial Up Mode 3 2 Use WAN port to access Internet By default the LG01N set to use WAN port as network connection When connect LG01N s WAN port to router LG01N will get IP from router and have internet access The network status is as below ...

Page 15: ...i client and gets IP from uplink router via WiFi The step to set is as below Step1 In network Wireless select Radio0 interface and scan Step2 Select the wireless AP and join Step3 In network wireless page disable WiFi AP network Notice After doing that you will lose connection if your computer connects to the LG01N via LG01N s wifi network ...

Page 16: ...www dragino com LG01 N OLG01 N Gateway User Manual 16 61 Note make sure click the Save Apply after configure After successful associate the WiFi network interface can be seen in the same page ...

Page 17: ...gino com LG01 N OLG01 N Gateway User Manual 17 61 3 4 Use built in 4G modem for internet access For the LG01N with built in 4G version user can configure the modem for internet access Step 1 Add New Interface ...

Page 18: ...com LG01 N OLG01 N Gateway User Manual 18 61 Step 2 Configure cellular interface Step 3 Check Result Note In case you don t know if your device has 4G modem you can run lsusb command in SSH access to check as below ...

Page 19: ...www dragino com LG01 N OLG01 N Gateway User Manual 19 61 3 5 Check Internet connection User can use the diagnostics page to check and analyze Internet connection ...

Page 20: ...RaWAN mode This chapter describes how to use LG01N to work with TTN LoRaWAN Server The method to work with other LoRaWAN Server is similar 4 1 Create a gateway in TTN Server Step 1 Get a Unique gateway ID Every LG01N has a unique gateway id The id can be found at LoRaWAN page The gateway id is a840411b6fc44150 ...

Page 21: ...www dragino com LG01 N OLG01 N Gateway User Manual 21 61 Step 2 Sign up an user account in TTN server Step 3 Create a Gateway in TTN A8 40 41 1b 6f c4 41 50 ...

Page 22: ...n t configure to send update status yet 4 2 Configure LG01N Gateway 4 2 1 Configure to connect to LoRaWAN server We should configure the LG01N now to let it connect to TTN network Make sure your LG01N has Internet Connection first Step1 Configure LG01N to act as raw forwarder mode Step2 Input server info and gateway id Choose the correct the server address and gateway ID ...

Page 23: ... After above settings the LG01N should be able to connect to TTN below is the result seen from TTN 4 2 2 Configure LG01 s Radio frequency Now we should configure LG01N s radio parameter to receive the LoRaWAN packets we configure is to use 868 1Mhz 868100000 Hz as below ...

Page 24: ...etupChannel 3 867100000 DR_RANGE_MAP DR_SF12 DR_SF7 BAND_CENTI g band LMIC_setupChannel 4 867300000 DR_RANGE_MAP DR_SF12 DR_SF7 BAND_CENTI g band LMIC_setupChannel 5 867500000 DR_RANGE_MAP DR_SF12 DR_SF7 BAND_CENTI g band LMIC_setupChannel 6 867700000 DR_RANGE_MAP DR_SF12 DR_SF7 BAND_CENTI g band LMIC_setupChannel 7 867900000 DR_RANGE_MAP DR_SF12 DR_SF7 BAND_CENTI g band LMIC_setupChannel 8 868800...

Page 25: ...y for LoRaWAN End device Install this library https github com dragino arduino lmic to the Arduino Library path Before compiling the End Device software User needs to change the Frequency Band to use with LG02 What user need to change is in the file arduino libraries arduino lmic src lmic config h Changes are as below ...

Page 26: ...www dragino com LG01 N OLG01 N Gateway User Manual 26 61 4 3 3 Test with OTAA LoRa end node LoRa Shield UNO Step 1 Create an OTAA device in TTN server Application page ...

Page 27: ...01 N OLG01 N Gateway User Manual 27 61 Step 2 Input keys into Arduino Sketch The sketch for the LoRa Shield is in Arduino IDE Examples LMIC_Arduino ttn otaa Choose Arduino UNO to upload the sketch to LoRa Shield and UNO ...

Page 28: ...N OLG01 N Gateway User Manual 28 61 Step 3 Check Result for OTAA Note The LG02_DNWFREQ value in Arduno_LMIC src lmic config h should match downlink frequency from TTN TTN shows 868 1 here So LG02_DNWFREQ should be 868100000 ...

Page 29: ... Schedule a Downlink message In TTN Application Device Data Downlink message Send out from TTN after the next uplink message arrive In TTN Gateway Traffic Downlink message arrives gateway In LG01N Service Logread Downlink message arrives LoRa Shield In Arduino IDE Serial Monitor ...

Page 30: ...www dragino com LG01 N OLG01 N Gateway User Manual 30 61 4 3 4 Test with ABP LoRa end node LoRa Shield UNO Step 1 Create an ABP device in TTN server Application page And change it to ABP mode ...

Page 31: ...etch The sketch for the LoRa Shield is in Arduino IDE Examples LMIC_Arduino ttn abp Choose Arduino UNO to upload the sketch to LoRa Shield and UNO Make sure the Network Session Key and App Session Key are in MSB order TTN LoRaWAN End Device page Arduino Sketch ttn abp Input the keys from TTN ...

Page 32: ...nual 32 61 Step 3 Check Result for Uplink Packet Arrive Gateway In page Service logread Packet Arrive TTN In TTN Gateway Traffic Packet Sent From LoRa Shield In Arduino IDE Serial Monitor Packet Arrive TTN Device Page In TTN Application Device Data ...

Page 33: ... Schedule a Downlink message In TTN Application Device Data Downlink message Send out from TTN after the next uplink message arrive In TTN Gateway Traffic Downlink message arrives gateway In LG01N Service Logread Downlink message arrives LoRa Shield In Arduino IDE Serial Monitor ...

Page 34: ...sten to local files under directory var iot push Once there is a file in this directory the thread will check if it is an outgoing file and send out the LoRa message if format match Below is the file example json format txpk imme false tmst 861608339 freq 925 1 rfch 0 powe 20 modu L ORA datr SF7BW500 codr 4 5 ipol true size 22 ncrc true data YEklB CaqCgADQAIAcQM6AP8B9TYzUA Explain Name Type Functi...

Page 35: ...RF packet payload size in bytes unsigned integer data string Base64 encoded RF packet payload padding optional ncrc bool If true disable the CRC of the physical layer optional Not all fields are necessary below is an example 1 First set up a LoRa Shield with this code LoRaReceiver So the LoRa Shield will receive the data at frequency 915 6Mhz SF7BW125 CR 4 5 2 Edit a file any name under var iot pu...

Page 36: ...er than version LG02_LG08 build v5 1 1545908833 20181227 1908 select Disabled in IoT Service page Step 2 Use lg02_single_rx_tx to receive for LG01N the option d is 2 Usage lg02_single_rx_tx d radio_dev select radio 1 or 2 default 1 t set as tx r set as rx f frequence default 868500000 s spreadingFactor default 7 b bandwidth default 125k w syncword default 52 0x34 reserver for lorawan m message mes...

Page 37: ... N OLG01 N Gateway User Manual 37 61 Then set up a LoRa node to send out LoRa packet we use LoRa Shield UNO in this example The library use in Arduino UNO is LoRa Master And the source code is LoRaSender Result screen shot ...

Page 38: ...and root dragino 1b6fb0 lg02_single_rx_tx t d 2 f 915600000 m hello from dragino Set up radio to transmit a message at frequency 9156000000 Set up a LoRa node to send out LoRa packet we use LoRa Shield UNO in this example The library use in Arduino UNO is LoRa Master And the source code is LoRaReceiver ...

Page 39: ...le it has been used in sensors communicating to a broker via satellite link over occasional dial up connections with healthcare providers and in a range of home automation and small device scenarios Most IoT server support MQTT connection for those servers we can use MQTT to connect it to publish data or subscribe to a channel Most IoT server support MQTT connection for those servers we can use MQ...

Page 40: ... Client mode LG01N can accept LoRa packets and send it to the TCP IP server The working topology is as below In this mode The Uplink LoRa packets should use a customized format Step1 Select TCP IP Client mode Step2 Configure the Radio channel with the match radio settings frequency as the LoRa End Node ...

Page 41: ... have configured 2 channels 12345 and 34567 And there is are three LoRa End nodes sending 12345 34567 78 The LG02 will accept the data from 12345 and 34567 it will ignore the data from Node 78 Case 1 Node 12345 send 12345 field1 0 0 field2 1102 0 Node 34567 doesn t send anything The TCP IP server will get 12345 field1 0 0 field2 1102 0 Case 2 Node 12345 send 12345 field1 0 0 field2 1102 0 Node 345...

Page 42: ...1N supports customized script to process LoRa data This chapter describes about the data format from LoRa End node and How to write the script The data flow from LoRa End Node to LG01N is as below Example Store Data in a file Step 1 Choose LoRa customized script mode Step 2 Configure LoRa Frequency ...

Page 43: ...a customized_scripts User can write a new script and put it under this directory for their application The web will auto detect it Step 4 Configure the LoRa End Device to send sensor data Here is an example code for LoRa Shield End Device Code Outputs End node send out packages Gateway receive packet Script find packet Script store data into file ...

Page 44: ...municate to a HTTP server Here shows an example for how to communicate to ThingSpeak server via HTTP protocol 9 1 Test uplink and downlink via Linux command We can see the API requests method in ThingSpeak API keys tab Run curl command to use this API update a channel feed ...

Page 45: ...N OLG01 N Gateway User Manual 45 61 And we will be able to see the update in the feed ThingSpeak has a talkback API which can dispatch command it is under Apps Talkback We can use curl command to get command_string as below ...

Page 46: ...ak sh root dragino 1893c4 chmod x uplink_downlink_ThingSpeak sh root dragino 1893c4 mv uplink_downlink_ThingSpeak sh etc lora customized_scripts Step2 Modify the script for your channels There are three place need to modify 1 Replace the channel with the corresponding channel ID and API KEY if channel 396640 then WRITE_API_KEY P07KVY59P5QEY6M6 fi 2 talkback curl Replace with the actually talk back...

Page 47: ...struction 11 Linux System The LG01N bases on OpenWrt Linux System It is open source and user are free to configure and modify the inside Linux settings 11 1 SSH Access for Linux console User can access to the Linux console via SSH protocol Make sure your PC and the LG01 is in the same network then use a SSH tool such as putty to access it Below are screenshots IP address IP address of LG01N Port 2...

Page 48: ...www dragino com LG01 N OLG01 N Gateway User Manual 48 61 ...

Page 49: ...e can use a FTP alike window to drag drop files to the LG01N or Edit the files directly in the windows Screenshot is as below 11 3 File System The LG01N has a 16MB flash and a 64MB RAM The var and tmp directory are in the RAM contents stored in tmp and var will be erased after reboot the device Other directories are in the flash and will keep after reboot Use cat proc mtd to see all blocks partiti...

Page 50: ...n t include file system art radio data and board ID Use df command to see available flash RAM tmpfs 30096 96 30000 0 tmp RAM reset after reboot dev mtdblock4 8512 368 8144 4 overlay Flash Remain after reboot Reset to factory default mtd erase rootfs_data r Except tmp and var all data will be store in flash tmp and var are store in RAM ...

Page 51: ... maintain system In Linux Console run root dragino 169d30 opkg update to get the latest packages list root dragino 169d30 opkg list shows the available packages root dragino 169d30 opkg install iperf install iperf it will auto install the required packages root dragino 169d30 etc opkg opkg install iperf Installing iperf 2 0 12 1 to root Downloading http downloads openwrt org snapshots packages mip...

Page 52: ...erent methods to upgrade as below 12 1 Upgrade via Web UI Go to the page Web System Back Up and flash firmware Select the image and click Flash Image the image will be uploaded to the device and then click Process Update to upgrade System will auto boot to the new firmware after upgrade 12 2 Upgrade via Linux console SCP the firmware to the system var directory and then run root OpenWrt sbin sysup...

Page 53: ...within above frequency range in the software 13 3 What does Limited support on LoRaWAN The base requirement to fully compatible with LoRaWAN protocol requires the gateway support 8 channels The LG01N only support two channels and can only support limited LoRaWAN protocol Because of this limitation if user wants to use a standard LoRaWAN device with LG01N user has to modify this LoRaWAN node to run...

Page 54: ...nding purpose or add customized application The LG01N source code and compile instruction can be found at https github com dragino openwrt_lede 18 06 13 6 On OTAA mode if I use the other frequency how should I modify in the library In page OTAA We use frequency 904 6Mhz for sending According the LoRaWAN protocol if the device Join the network successfully the server will downlink the reply The dif...

Page 55: ...ory default User can reset the device to factory default in different ways Method 1 Reset via Web UI Click the button in Web UI System Back up Flash firmware Perform Reset Method 2 Reset in Linux console command is below root dragino 1b8288 firstboot This will erase all settings and remove any installed packages Are you sure N y y dev mtdblock4 is mounted as overlay only erasing files root dragino...

Page 56: ...eveloper Control Globe LED ON echo 1 sys class leds dragino2 red wlan brightness OFF echo 0 sys class leds dragino2 red wlan brightness 13 9 Can I upgrade the LG01 P LG01 S to LG01 N If user has LG01 P LG01 S they can upgrade their model to LG01 N by 1 Change the Inside LoRa module to the module used in LG01 N 2 Upgrade the firmware to the LG01 N firmware ...

Page 57: ...o2 si3217x_3 10 49 0 2 1_ar71xx ipk Installing kmod dragino2 si3217x 3 10 49 0 2 1 to root Collected errors satisfy_dependencies_for Cannot satisfy the following dependencies for kmod dragino2 si3217x kernel 3 10 49 1 4917516478a753314254643facdf360a opkg_install_cmd Cannot install package kmod dragino2 si3217x In this case user can use the force depends option to install such package opkg install...

Page 58: ... toggle button and power on the device 4 All LEDs of the device will blink release the toggle button after four blinks 5 All LEDs will then blink very fast once this means device detect a network connection and enter into the web failsafe mode Your PC should be able to ping 192 168 255 1 after device enter this mode 6 Open 192 168 255 1 in web broswer 7 Select a squashfs sysupgrade type firmware a...

Page 59: ... fall back ip to access LG01N no matter what the WiFi IP is The fall back ip is useful for connect and debug the unit Note fallback ip can be disabled in the LAN and DHCP page Steps to connect via fall back IP 1 Connect PC s Ethernet port to LG01 s LAN port 2 Configure PC s Ethernet port has IP 172 31 255 253 and netmask 255 255 255 252 As below photo 3 In PC use 172 31 255 254 to access LG01 via ...

Page 60: ...epends the model ordered Power Adapter EU AU US type power adapter depends on country to be used Packaging with environmental protection paper box Dimension and weight Device Size 12 x 8 5 x 3 cm Device Weight 150g Package Size pcs 21 5 x 10 x 5 cm Weight pcs 360g Carton dimension 45 x 31 x 34 cm 36pcs per carton Weight carton 12 5 kg 17 Support Try to see if your questions already answered in the...

Page 61: ...ateway https github com dragino openwrt_lede 18 06 OpenWrt official Wiki http www openwrt org Download of this manual or Update version http www dragino com downloads index php dir UserManual LG02_OLG02 LMIC library for Arduino LoRaWAN end device use with LG01N https github com dragino arduino lmic ...

Reviews: