user manual for telethings lora - ebiz.ba
TRANSCRIPT
User Manual for Telethings LoRa
Node
Lejlekuša bb
75320 Gračanica, Bosna i Hercegovina
Tel: +387 35 700 209
Fax: +387 35 700 201
Mail: [email protected]
Web: www.telethings.com
1/33
CONTENT
Content .................................................................................................................... 1
Introduction .............................................................................................................. 2
Acronyms .............................................................................................................. 3
Safe operation ....................................................................................................... 4
Environmental protection ........................................................................................ 4
Product overview....................................................................................................... 5
Technical features and Specification ........................................................................... 6
Telethings Lora Node pin structure ............................................................................. 7
Telethings Lora Node as AT Slave device ................................................................... 9
Instalation Hardware and Software ......................................................................... 9
Introduction ....................................................................................................... 9
Hardwer preparation ........................................................................................... 9
Software preparation ........................................................................................ 12
Telethings Lora Node as programmable device with daughter board ........................... 14
Instalation Hardware and Software ....................................................................... 14
Introduction ..................................................................................................... 14
Hardware preparation ....................................................................................... 14
Software preparation ........................................................................................ 15
Creating Aplication for Node on TTN site................................................................... 24
Examples ................................................................................................................ 33
Reference ............................................................................................................... 33
2/33
INTRODUCTION
This manual has been created in order to introduce the user with the Telethings LoRa module, i.e. its technical specifications and how to use it. Special attention will be given to the module as an AT Slave device, which is a programmable module installed on the Daughter board. Also, a chapter will be devoted on creating and using the application on the IoT page.
3/33
ACRONYMS
ABP - Activaiton by personalization
ADC - Analog Digital conversion
AT - Attention
DR - Data Rate
GPIO - General-purpose input/output
Init - Initialization
I2C - Inter-Integrated Circuit
Lib - Library
LoRa™ - Long Range modulation technique
MAC - Medium Access Control
MIC - Message Integrity Code
MCU - Microcontroller unit
ND - Non define
OTAA - Over the air activation
PHY - Physical layer
Rx - Receiver
RSSI - Received Signal Strength Indicator
SNR - Signal Noise Ratio
SPI - Serial Peripheral Interface
TLN - Telethings LoRa Node
Tx - Transmitter
UART - Universal Asynchronous Receiver/Transmitter
4/33
SAFE OPERATION
To ensure that the Telethings LoRa Node device is reliable, the following conditions must be
met:
- Do not install the device close to running water, do not wash it with water and other
liquids!
- Do not install the device on unstable and vibrating surfaces, in order to prevent the
unit from falling down!
- Do not install the device on metal surfaces in order to prevent the device from being
struck!
- Protect the device from impacts, strong shaking and mechanical damage!
- Do not manipulate with metal objects and utensils inside device while the device is
plugged into power in order to avoid electric shock!
- Place of installation should not be exposed directly to the source of heat / cold and
strong light!
- Turn on the adapter of the device to the 110-240 V and 50 / 60Hz frequency electrical
outlet. Prior to switching the adapter on or off, it is necessary to switch off the main
switch.
- The manufacturer will not be responsible for the correct and safe operation of the
device if another network adapter is used.
- Clean the device when disconnected, do not use chemical aggressive agents!
- The appliance must only be opened and repaired by a qualified service engineer,
authorized by the manufacturer!
- Disconnect the device from the network and send it to an authorized service facility
in case of a leak with a liquid, damage or incorrect operation!
- Operation with the device can only be resumed after the malfunction has been
removed!
Do not install the device at a temperature below -20 ° C and higher than + 50 ° C, as correct
operation is not guaranteed.
ENVIRONMENTAL PROTECTION
The symbol on the back of the case, crossed garbage bin, means that this product cannot be disposed with household waste. To protect the environment and human health please separate this product from other waste and recycle it. For further information, contact your local government or product supplier. It is forbidden to dispose old devices with mixed waste.
5/33
PRODUCT OVERVIEW
Telethings Lora node Beta 1.0 is a device based on a low power STM32L071 microcontroller, and a sx1272 module. It has small dimensions and can respond to users' demands with very low power consumption (the consumption of a device when working in sleep mode is below 10 uA). The main function of the device is sending / receiving data using the LoRa wireless network. In rural areas, the module realizes communication with the gateway at distances up to 15 kilometers, while this range is up to 2 kilometers in urban areas.
If it is a module that works as an AT Slave device, it should be noted that the device as such already has firmware ready for operation, and it is necessary to achieve communication with the module using UART. A master device is needed in this case, which will use the nodes as a supplement with the main goal of sending some information to the server.
If it is a programmable module embedded in a daughter board, it should be noted that the user himself determines the functionality of the device. For communication with sensors or other devices, you can count on communication based on I2C, UART, ADC, and GPIO pins.
Figure 1. Telethings LoRa Node Beta 1.0
6/33
TECHNICAL FEATURES AND SPECIFICATION
Model Name Telethings LoRa Node Description LoRa Wireless Communication Module Hardware Semtech SX1272 - Low Power Long
Range Transceiver STM32L071KBU6 - Ultra-low-power ARM Cortex-M0+ MCU with 128-Kbytes Flash, 32 MHz CPU
Host Interface LPUART Power supply 3,3 V / 2 A DC (External) Dimensions 20 x 28 x 2,5mm Weight 20 gr Temperatures Storage temperature -40 - +65
Operating temperature -35 - +60
Frequency EU868 (863-870 MHz) Band Width 125/250/500 kHz Sensitivity Down to -137 dB Payload Up to 256 byte with Cyclic Redundency
Check (CRC) Range 15 km rural environment
<2 km urban environment Application Gas monitoring
Parking spot finder Smart house sensors Watermeter ...
7/33
TELETHINGS LORA NODE PIN STRUCTURE
Figure 2. Telethings LoRa Node pins structure
TLN PINx PINx describe note
GND Ground
RESET SX Reset pin for sx1272 module
NSS SX SPI Chip select
MOSI SX SPI MOSI
MISO SX SPI MISO
DIO0 SX LoRa®/Sigfox™module debug pin
DIO1 SX LoRa®/Sigfox™module debug pin
DIO2 SX LoRa®/Sigfox™module debug pin
GND
GND
GND
GND
GND
DIO1_SX RESET_SX DIO0_SX PB1 SWDIO SWCLK VDD_RFS
TLN_PB4
TLN_PB5
TLN_PB6 TLN_PB7 RESET VDD_MCU
NSS_SX
MOSI_SX MISO_SX SCK_SX DIO3_SX DIO2_SX TLN_PA3 TLN_PA2
ANTENNA
TLN_PA1 TLN_PA0
8/33
DIO3 SX LoRa®/Sigfox™module debug pin
VDD MCU Power supply pin for MCU
RESET Reset pin for MCU
SWDIO Pin for FW or TLN PORTA/TLN PIN13
SWCLK Pin for FW or TLN PORTA/TLN PIN14
TLN PA0 TLN PORTA/TLN PIN0
TLN PA1 TLN PORTA/TLN PIN1
TLN PA2 TLN PORTA/TLN PIN2
TLN PA3 TLN PORTA/TLN PIN3
TLN PB4 TLN PORTB/TLN PIN4
TLN PB5 TLN PORTB/TLN PIN5
TLN PB6 TLN PORTB/TLN PIN6
TLN PB7 TLN PORTB/TLN PIN7
Table 1. Table of Telethings LoRa Node pin describes
TLN PORTx/TLN PINx ADC UART I2C GPIO
TLN PA0 IN0 UART 4 TX - +
TLN PA1 IN1 UART4 RX - +
TLN PA2 IN2 UART 2 TX - +
TLN PA3 IN3 UART 2 RX - +
TLN PA13 - - - +
TLN PA14 - - - +
TLN PB4 - - - +
TLN PB5 - - - +
TLN PB6 - UART 1 TX I2C1 SCL +
TLN PB7 - UART 1 RX I2C1 SDA +
MISO SX Pins being used for SPI communication. SPI could be used for other driver (sensor), but one should be
careful, because the same SPI is being used for SX1272 communication.
MOSI SX
Table 2. Telethings LoRa Node extend programabile pin options
9/33
TELETHINGS LORA NODE AS AT SLAVE DEVICE
INSTALATION HARDWARE AND SOFTWARE
INTRODUCTION
Telethings LoRa Node in the function of the AT Slave device implies a module with already added firmware in order to perform the mentioned functionality. It is necessary to have some kind of master device, which should be connected to the module, in order for the module itself to perform its functionality. The master device connects to the module using UART connection, and communicates with the module using AT commands. A list of AT commands, with description of each of them, as well as how to use them, is in the document “LoRaNodeATCommands.pdf”. For the purpose of this document, and an easier way of clarifying how the node works, the master device will be simulated using TTL (UART Debugger) that will be directly transferred to the computer. The Termite v3.1 application will be used as a console application and it will show communication with the module.
HARDWER PREPARATION
In order for the device to function properly, it is necessary to do some hardware
changes before connecting the device to the power supply. Firstly, antenna should be connected to the device, i.e. the coaxial cable must be soldered on the module. (Figure 3.)
Then, TLN UART RX and TLN UART TX pins should be connected with wires (Figure 5.), which will be connected to the TTL later on. After that, one wire should be wired to GND. The following and the last step is to solve the power supply or to solder the wires on the VDD MCU and VDD SX pins, through which a 3.3 V power will be supplied from the TTL. (Figure 4.)
Telethings LoRa Node actually uses LPUART, so pins TLN UART RX and TLN UART TX
are actually TLN LP UART RX and TLN LP UART TX.
If all of the above mentioned changes have been made, the device is ready for use.
10/33
Figure 3. Solder the coaxial cable for antenna
Figure 4. Solder wires on GND pin i VDD pins
1 VDD
2 GND
11/33
Figure 5. Solder wires on UART RX pin and UART TX pin
Attention should also be paid to these changes if the Node is embedded on another
master device. Assuming that all the changes have been made, the connection of the module with TTL
(Figure 5) will follow, and it will represent the connection of the module to the computer.
1 VDD
2 GND
3 UART RX
4 UART TX
12/33
Figure 6. Wire connection between TTL and Telethings LoRa Node
SOFTWARE PREPARATION
The following step is installation of an application through which commands will be sent to the node and monitor the responses to the commands, or their actions. There are several applications that can serve for these purposes, but we opted for Termite v3.1. Given that this application is selected only for the purpose of testing nodes, i.e. to show how nodes communicate over UART, installation of the aforementioned will not be explained, but special attention will be payed to its settings.
After installation of console application such as Termite, connect the node and TTL as shown on the Figure 5., and insert the TTL into the USB port of your computer.
To check which COM port is connected to TTL, Device Manager should be opened. (Figure 6.)
13/33
Figure 7. Device Manager - Checking COM port of UART Debugger
Open Termite v3.1 and check Termite settings.
Figure 8. Termite settings
Now hardware and software are prepared for action.
14/33
TELETHINGS LORA NODE AS PROGRAMMABLE DEVICE WITH DAUGHTER BOARD
INSTALATION HARDWARE AND SOFTWARE
INTRODUCTION
The Telethings LoRa Node in the function of the programmable device implies a module that is factory-loaded on the development board, i.e. the so-called daughter board. As the name itself says, the module as such is subject to programming of the functionality as desired by the client. This package also includes a library for programming the aforementioned. The shape of the development board is adapted for connecting the sensors, for which the connectors are provided. There are 8 pins left for programming their functionality. UART, I2C, ADC, GPIO are interfaces at which the user can count.
HARDWARE PREPARATION
For programming the device, STM microcontroller programming tool is needed, and the example of this tool is ST Link V2.
Figure 9. ST Link V2
Pins for programming the device have been designed on the development board as shown in the illustration.
15/33
Figure 10. Pins for programing device
But the first thing to do when it comes to hardware preparation of the device is to assemble the antenna on the device.
SOFTWARE PREPARATION
The main reference in this chapter will be to create and adjust a test project that uses the library and a few basic files that accompany the library. The project will not have any particular functionality, the basis is to prepare the project until the first successful building.
It will be assumed that the user is familiar with embedded programming, and knows how to work with sensors and use Atollic TrueSTUDIO as a development environment for programming.
First, a test project will be created by clicking on File/New/C Project. Instruction must be followed on Figures.
GND
SW CLK
SW DIO
3,3V
16/33
Figure 11. Creating test project in Atollic Studio
Figure 12. Step 1. Setting project name and location for saving project
17/33
Figure 13. Step 2. Selecting STM32L071KB for hardware settings
18/33
Figure 14. Step 3. Selecting software settings
Figure15. Step 4. Selecting hardware debug settings
19/33
Figure 16. Created project files
Folders 'Drivers' and 'src' must be deleted, and then new folders 'LORA', 'MAIN' and
'OTHER' must be created, and then paste files into it as on Figure 17.. This folders and files
organization is for test project, and folders can be named optional, and also organizing folders
and files is optional.
Figure 17. New folders and file organization
Figure 18. Add library file into project
20/33
Figure 19. Add include path n every new added folder
Figure 20. Confirm adding include path for folder
21/33
Figure 21. Selecting properties of project
Figure 22. Folder paths which now don't exist must be deleted, the same thing applies for
'Language-S,s,asm'
22/33
Figure 23. Updated status with including path for folders
Figure 24. In tab 'Symbols' new simbol 'NO_MAC_PRINTF' must be added
23/33
Figure 25. In tab 'Libraries', 'Telethings.Lora.Node.Library' must be added
Figure 26. In tab 'Library Paths' path for library file must be added
Now test application is ready for building.
24/33
CREATING APLICATION FOR NODE ON TTN SITE
Firstly, user should follow link: https://www.thethingsnetwork.org/ and create
account. Assuming user already got LoRa Gateway and account on TTN site, and is logged in,
from now this document will be focused for LoRa Node Application.
Figure 27. Main screen of ttn site
Selecting 'Console' option by clicking on user's account name.
25/33
Figure 28. Empty application interface on ttn site
First screen, after clicking 'Console' option, should look like this on Figure 28., and
then 'add application' should be selected. A form will open like on Figure 29.
Figure 29. Form for creating Application for node
26/33
Figure 30. Filled with random data form for creating Application for node
Figure 31. Exmaple of wrong input for Application ID
1
2
3
27/33
Form with data ('Application ID' and 'Description') must be filled and clicked on
button 'Add application'
Figure 32. Application ID already exist error try input another Application ID
Figure 33. Application form for node
Now, Application for Node is created and Application EUI is now available.
3
1
2
28/33
Figure 34.
For registration of Node device on this site, 'register device' option should be clicked
on screen.
Figure 35. Application form for register node
29/33
Device EUI number must be entered. Device EUI can be aquired by calling AT
command for device eui (AT+DEUI=?) (Figure 37.), or LoRa Node call function from
library ' void lib_tln_lora_dev_eui(uint8_t * dev_eui);'.
Figure 36. Application form for register node filled by test data
Data 'Device ID' and 'Device EUI' must be filled in application form.
Figure 37. Collecting 'Device EUI' using AT Command, example with different
Telethings LoRa Node, so key is also different.
3
2
1
30/33
Figure 38. Finally Application form for the node
Now ABP join mode should be selected, and that can be done when user clicks
on tab 'Settings'
Figure 39. Option Setting
31/33
Selecting ABP mode instead OTAA.
Figure 40. Selecting ABP activation mode instead OTAA mode
Now in user's Node application, 'Network Session Key' and 'App Session key' will be
available.
Figure 41. Application form
1
2
32/33
Figure 42. Updated data on Application form
Clicking on '<>' user can change key format, and can copy key by clicking on copy icon.
Now the application is prepared and there are available keys which are needed for Node.
After Application for Node is prepared, user should set keys to Node using library
functions or using AT Commands, and program node functionality.
Button for changing key format Button for coppy key
33/33
EXAMPLES
For finding code examples look at documentation:
- „LoRaNodeATCommands.pdf“
- „LoRaNodeLibraryFunctions.pdf“
REFERENCE
1) https://www.thethingsnetwork.org/
2) „LoRaNodeLibraryFunctions.pdf“, Documentation for Telethings LoRa Node library
3) „LoRaNodeATCommands.pdf“, Documentation for Telethings LoRa Node AT
Commands
4) „AN4967 Application note Examples of AT commands on I-CUBE-LRWAN“,
Docummentation about AT commands