Dragino Single Channel LoRa IoT Kit User manual

Type
User manual
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 1 / 50
Single Channel LoRa IoT Kit v2 User Manual
Document Version: 1.0.1
Version
Description
Date
1.0.0
Release
2019-Jan-28
1.0.1
Modify limitation words
2019-May-10
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 2 / 50
Index:
1 Overview ................................................................................................................ 4
1.1 What is Dragino Single Channel LoRa IoT Kit v2? ......................................... 4
1.2 What can you learn from the kit?................................................................. 4
1.3 What parts Dragino LoRa IoT v2 includes? ................................................... 5
2 Preparing ................................................................................................................ 6
2.1 Software for End Node ................................................................................. 6
2.1.1 Install Arduino IDE and CH340 driver................................................. 6
2.1.2 Install LoRa Library for Arduino .......................................................... 7
2.2 Prepare for LG01-N Gateway ........................................................................ 8
2.2.1 Configure LG01-N for internet connection. ....................................... 8
2.2.2 Download putty tool to access LG01-N via SSH ............................... 11
3 Example 1: Test a LoRaWAN network .................................................................. 12
3.1 Typology and Data Flow ............................................................................. 13
3.2 Create a gateway in TTN Server .................................................................. 14
3.3 Configure LG01-N Gateway ........................................................................ 16
3.3.1 Configure to connect to LoRaWAN server ....................................... 16
3.3.2 Configure LG01-N’s LoRa Radio frequency ...................................... 17
3.4 Create LoRa Shield End Node ..................................................................... 18
3.4.1 Hardware Connection ...................................................................... 18
3.4.2 Set up OTAA device in TTN and upload sketch to UNO ................... 18
3.4.3 Configure to connect to Cayenne Application Server ...................... 22
3.4.4 Use downlink message to control relay ........................................... 25
3.4.5 Test with Interrupt ........................................................................... 27
3.5 Create LoRa/GPS Shield End Node ............................................................. 28
3.5.1 Hardware connection ....................................................................... 28
3.5.2 Set up ABP device in TTN and upload software to UNO .................. 28
3.6 Conclusion and limitation ........................................................................... 32
3.6.1 Overview for the example ................................................................ 32
3.6.2 Limitations ........................................................................................ 34
4 Example 2: Test with a MQTT IoT Server ............................................................. 36
4.1 Typology and Data Flow ............................................................................. 36
4.2 Set up sensor channels in ThingSpeak ....................................................... 37
4.3 Simulate MQTT uplink via PCs MQTT tool ................................................. 39
4.4 Try MQTT Publish with LG01-N Linux command ........................................ 40
4.5 Configure LG01-N Gateway ........................................................................ 41
4.5.1 Publish Logic ..................................................................................... 41
4.5.2 Configure LG01-N’s Radio frequency ............................................... 42
4.6 Create LoRa Shield End Node ..................................................................... 43
4.6.1 Hardware Connection ...................................................................... 43
4.6.2 Test with uplink ................................................................................ 44
4.6.3 Test with interrupt by flame detect ................................................. 45
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 3 / 50
4.7 Conclusion and limitation ........................................................................... 46
4.7.1 Overview for the example ................................................................ 46
5 Order Info ............................................................................................................. 47
6 FAQ & Trouble Shooting ....................................................................................... 48
6.1 I can't upload sketch to LoRa Shield in MAC OS, shows "
dev/cu.usbmodem1421 is not available " ........................................................... 48
6.2 My IoT Kit has the model LG01-P instead of LG01-N, Can I still use this
manual. ................................................................................................................ 48
7 Technical Support ................................................................................................. 49
8 Reference ............................................................................................................. 50
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 4 / 50
1 Overview
1.1 What is Dragino Single Channel LoRa IoT Kit v2?
Dragino Single Channel LoRa IoT Kit v2 is designed to facilitate beginners and developers to
quickly learn LoRa and IoT technology. It helps users to turn the idea into a practical application
and make the Internet of Things a reality. It is easy to program, create and connect your things
everywhere. A number of telecom operators are currently rolling out networks, but because LoRa
operates in the open spectrum you can also set up your own network.
The LoRa IoT kit v2 shows how to build a LoRa network, and how to use the network to send data
from a LoRa sensor node to the cloud server. Depends on the actually use environment, the LoRa
gateway will connect your other LoRa nodes up to 500 ~ 5,000 meters.
1.2 What can you learn from the kit?
The goals through this LoRa IoT kit v2:
Understand the structure of an Internet of Things network, and how does an IoT
network works
Learn coding method for Arduino micro controller
Learn some common sensors.
Learn some basic commands for Linux and
Learn about LoRa and how to set up a LoRa network.
Learn different way to connect LoRa network to IoT Server and compare their
advantages / disadvantages.
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 5 / 50
1.3 What parts Dragino LoRa IoT v2 includes?
Single Channel LoRa IoT Kit Packing List.
1 x LG01-N single channel LoRa Gateway
1 x LoRa end node (LoRa Shield + Arduino UNO)
1 x LoRa end node (LoRa/GPS Shield + Arduino UNO)
1 x flame Sensor
1 x relay
1 x photosensitive sensor
1 x buzzer
1 x ultrasonic sensor
1 x DHT11 temperature and humidity sensor
20 x dupont cable (male to male)
20 x dupont cable (female to female)
20 x dupont cable (male to female)
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 6 / 50
2 Preparing
In the kit, there are two LoRa End Node, they are LoRa Shield + UNO and LoRa/GPS Shield +
UNO. Both of them use Arduino UNO as MCU to control the LoRa transceiver.
We need to program the Arduino UNO during our testing to support the required functions
for end nodes. To finish this, we need to install some software and library first.
2.1 Software for End Node
2.1.1 Install Arduino IDE and CH340 driver
First download and install Arduino IDE. This is the tool to program the Arduino UNO.
The Arduino UNO in the kit is clone version and is equipped with CH340 USB to UART chip.
We need to install CH340 driver in the PC to let the Arduino IDE program it via USB. If we
successful install the driver, a com port will show in the system device manager:
After install the driver, start Arduino and we will be able to use the board Arduino UNO and
corresponding COM port to program UNO now.
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 7 / 50
We can enable compilation and upload in Arduino File Preference. This will help us in
debug.
2.1.2 Install LoRa Library for Arduino
In our examples, we will use two different LoRa libraries for End Node to build different type
of LoRa network. They are:
Arduino-LMIC : LoRaWAN library to configure the End node as a standard LoRaWAN end
node.
LoRa-raw: This is a simple library for LoRa transmit & receive, all data transfer without ID
control, encryption. If user wants to develop a LoRa network with private LoRa protocol,
he can modify base on this Library.
We also need to install some libraries to connect to different sensors:
DHTlib: This is the library to use DHT11 temperature & humidity sensor.
TinyGPS: Library for LoRa GPS Shield to get the GPS data.
Download all above libraries and put them in the Arduino Libraries directory
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 8 / 50
2.2 Prepare for LG01-N Gateway
In LoRa IoT Kit v2, we use LG01-N as LoRa Gateway. Unlike LG01-P in v1 kit, the LG01-N has
its own LoRa utility and not need to program it via Arduino. Since we need to connect to
Internet IoT Server, we need to configure the LG01-N to have internet access.
2.2.1 Configure LG01-N for internet connection.
Below steps show how to set up LG01-N to use WiFi for internet access.
Step1:
Connect PC to LG01-Ns LAN port via RJ45 cable and set up PC Ethernet port to DHCP.
PC will then get IP from LG01-N. The ip range is 10.130.1.xx
Use browser to access the LG01-N via IP 10.130.1.1. (Recommend use Chrome here)
Step2:
Open a browser in the laptop and type
http://10.130.1.1/cgi-bin/luci/admin
User will see the login interface of LG01-N.
The account for Web Login is:
User Name: root
Password: dragino
Step3:
In network -> Wireless, select radio0 interface and scan.
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 9 / 50
Step4:
Select the wireless AP and join the wifi network:
Step5:
In network->wireless page, disable WiFi AP network. Notice: After doing that, you will lose
connection if your computer connects to the LG01-N via its WiFi network.
(Note: make sure click the Save & Apply after configure)
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 10 / 50
After successful associate, the WiFi network interface can be seen in the same page and see
LG01-N get the ip from the uplink router.
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 11 / 50
2.2.2 Download putty tool to access LG01-N via SSH
It will be helpful to see the LG01-N inside Linux system to understand the data flow and
debug.
User can access to the Linux console via SSH protocol. Make sure your PC and the LG01-N is in the
same network, then use a SSH tool (such as putty) to access it. Below are screenshots:
IP address: IP address of LG01-N
Port: 22
User Name: root
Password: dragino (default)
After log in, you will be in the Linux console and can input commands here.
So we have prepare what we need and lets go for the examples!
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 12 / 50
3 Example 1: Test a LoRaWAN network
This example describes how to use LG01-N, LoRa Shield & LoRa GPS Shield to set up a LoRaWAN
network and connect it to TTN LoRaWAN Server. It also shows how to use external application
server to monitor / manage the LoRa Nodes.
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 13 / 50
3.1 Typology and Data Flow
The network topology and dataflow for the example is as below:
In next section we will start to configure for this example.
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 14 / 50
3.2 Create a gateway in TTN Server
Step 1: Get a Unique gateway ID.
Every LG01-N has a unique gateway id. The id can be found at LoRaWAN page:
The gateway id is: a840411b6fc44150
Step 2: Sign up a user account in TTN server
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 15 / 50
Step 3: Create a Gateway in TTN
After create the gateway, we can see the gateway info, as below, the Status shows not
connected because the LG01-N doesnt configure to send update status yet.
A8 40 41 1b 6f c4 41 50
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 16 / 50
3.3 Configure LG01-N Gateway
3.3.1 Configure to connect to LoRaWAN server
We should configure the LG01-N now to let it connect to TTN network. Make sure your LG01-N
has Internet Connection first.
Step1: Configure LG01-N to act as LoRaWAN forwarder mode
Step2: Input server info and gateway id
Choose the correct the server address and gateway ID.
Check Result
After above settings, the LG01-N will be able to connect to TTN, as shown in below:
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 17 / 50
3.3.2 Configure LG01-Ns LoRa Radio frequency
Now we should configure LG01-Ns radio parameter to receive the LoRaWAN packets. We are
using 868.1Mhz and other parameters as below:
This parameters set is for uplink (receive data for LoRa End Node).According to LoRaWAN spec,
the downlink radio parameters frequency is defined by network server (TTN). LG01-N will adjust
downlink parameters according to info from TTN.
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 18 / 50
3.4 Create LoRa Shield End Node
3.4.1 Hardware Connection
There are three sensors connect to the LoRa Shield + UNO. These sensors are flame sensors,
DHT11 (Temperature & Humidity sensor) and Relay. Please use the connection as we show in the
photo.
Note: There is a trick in above connection, the relay connects to VIN. In this case, The UNO can only be power via
USB port. If user need to power via DC power adapter, please use another 5v pin to power the relay.
3.4.2 Set up OTAA device in TTN and upload sketch to UNO
Here we set up the LoRa Shield + UNO as an OTAA device in TTN. We will tell the difference of
OTAA and ABP mode later.
Step 1: Create an OTAA device in TTN server -- > Application page.
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 19 / 50
For this device, set up to use Cayenne payload, so TTN can parse the sensor data properly.
Step 2: Modify the LMIC library
To use LoRaWAN with LG01-N, we need to modify the LMIC library to support single channel
mode.
Find the Arduino LMIC install path in Arduino library. Before compiling the code, user needs to
change the Frequency Band to use with LG01-N. The change is in the file
arduino\libraries\arduino-lmic \src\lmic\config.h. Changes are as below:
www.dragino.com
Dragino Single Channel LoRa IoT Kit v2 User Manual ---2019-Jan-28 20 / 50
Step 3: Input keys in Arduino Sketch and upload to device.
The sketch for this example is lora_shield_cayenne_and_ttn-otaaClient.ino. Download and open
it, we need to modify the keys to match the keys in TTN. Get Device EUI/Application EUI & APP
Key from TTN and put them in the sketch, make sure the Device EUI and Application Key are lsb
and the APP key is msb.
Upload the code to UNO:
  • Page 1 1
  • Page 2 2
  • Page 3 3
  • Page 4 4
  • Page 5 5
  • Page 6 6
  • Page 7 7
  • Page 8 8
  • Page 9 9
  • Page 10 10
  • Page 11 11
  • Page 12 12
  • Page 13 13
  • Page 14 14
  • Page 15 15
  • Page 16 16
  • Page 17 17
  • Page 18 18
  • Page 19 19
  • Page 20 20
  • Page 21 21
  • Page 22 22
  • Page 23 23
  • Page 24 24
  • Page 25 25
  • Page 26 26
  • Page 27 27
  • Page 28 28
  • Page 29 29
  • Page 30 30
  • Page 31 31
  • Page 32 32
  • Page 33 33
  • Page 34 34
  • Page 35 35
  • Page 36 36
  • Page 37 37
  • Page 38 38
  • Page 39 39
  • Page 40 40
  • Page 41 41
  • Page 42 42
  • Page 43 43
  • Page 44 44
  • Page 45 45
  • Page 46 46
  • Page 47 47
  • Page 48 48
  • Page 49 49
  • Page 50 50

Dragino Single Channel LoRa IoT Kit User manual

Type
User manual

Ask a question and I''ll find the answer in the document

Finding information in a document is now easier with AI