LoRaWAN Tutorial| GPS Tracker With Dragino Gateway

0 50423 Medium

Hey, what's up, Guys! Akarsh here from CETech.

A couple of projects back we had a look at the LoRaWAN Gateway from Dragino. We connected different nodes to the Gateway and transmitted data from the nodes to the Gateway using TheThingsNetwork as the server. We went through the whole configuration process of the Gateway. In this project, We are going to take that game one step further by connecting a GPS tracker to the Gateway. In fact, we will connect two GPS trackers to the Gateway one by one.

First, we will connect an Arduino based GPS node to the Gateway after programming that in order to share GPS data, and after that we will connect a readymade GPS tracker node LGT92 from Dragino and collect GPS data from that as well.

Wait, Have I told you about the new Gateway from Dragino that we are going to use today. Yes, today we have a new gateway from dragino with us the 8 channel LPS8 gateway that we will use.

It's gonna be fun. So let's get started.

​Buy the LPS8 in India: https://www.enthutech.in/shop/product/lps8-lorawan-multi-channel-indoor-gateway-413?search=lps8

Buy the LGT92 in India: https://www.enthutech.in/shop/product/lgt92-lorawan-gps-tracker-406

projectImage

Get PCBs for Your Projects Manufactured

projectImage

​PCBGOGO, established in 2015, offers turnkey PCB assembly services, including ​PCB manufacturing, PCB assembly, components sourcing, functional testing, and IC programming.

Its manufacturing bases are equipped with the most advanced production equipment. Though it’s only five years old, their factories have experience in the PCB industry for over 10 years in Chinese markets. It is a leading specialist in surface-mount, thru-hole, and mixed technology PCB assembly and electronic manufacturing services as well as ​turnkey PCB assembly.

​PCBGOGO provides the order service from prototype to mass production, join them now in celebrating Christmas and New Year in style! They are offering big coupon discounts along with surprise gifts with your orders and many more giveaways are being held!!!!

About LPS8 Dragino Gateway

projectImage

The LPS8 is an open-source Indoor LoRaWAN Gateway. Unlike the LG01-P single channel gateway. The LPS8 is an 8 channel gateway which means that we can connect more nodes to it and can easily handle comparatively larger LoRa traffic. The LPS8 Gateway is powered by one SX1308 LoRa concentrator and two 1257 LoRa Transceivers. It has a USB host port and a USB type C power input. Apart from that it also has an ethernet port which can be used for connection purposes. But we are not going to use that today as we are going to connect it using Wi-Fi. On the front part of the Gateway, we have 4 status LEDs for Power supply, Wifi Access Point, Ethernet port, and Internet connectivity.

projectImage

This Gateway lets us bridge LoRa wireless network to an IP network via Wi-Fi or Ethernet. The LPS8 uses a Semtech Packet forwarder and is fully compatible with the LoRaWAN protocol. The LoRa concentrator in this Gateway provides 10 programmable parallel demodulation paths. It comes with pre-configured standard LoRaWAN frequency bands to be used in different countries. Some features of the LPS8 LoRaWAN Gateway are:

It is an Open Source OpenWrt system.

Emulates 49x LoRa demodulators.

Has 10 programmable parallel demodulation paths.

To get a detailed read about the LPS8 gateway. You can refer to its datasheet from ​here and user manual from ​here.

About LGT92 LoRaWAN GPS Tracker

projectImage

The Dragino LoRaWAN GPS Tracker LGT-92 is an open-source GPS tracker based on Ultra Low Power STM32L072 MCU and SX1276/1278 LoRa Module.

LGT-92 includes a low power GPS module L76-L and a 9-axis accelerometer for motion and altitude detection. The power for both the GPS module and accelerometer can be controlled by MCU to achieve the best energy profile for different applications. The LoRa wireless technology used in LGT-92 allows the user to send data and reach extremely long ranges at low data-rates. It provides ultra-long range spread spectrum communication and high interference immunity whilst minimizing current consumption. It targets professional tracking services. It also has an emergency SOS button on it which when pressed sends a message for which it is configured. It is a small lightweight node that comes in two variants which are:

LGT-92-Li: It is powered by a 1000mA rechargeable Li-ion battery and charge circuit which is used for real-time tracking with a short tracking uplink.LGT-92-AA: Disable the charge circuit to get the lowest power consumption and power directly by AA batteries. This is designed for asset tracking where only need to uplink a few times every day.
projectImage

Here we are going to use the LGT-92-Li variant.​ Some features of this GPS Tracker are as mentioned below:

LoRaWAN 1.0.3 compliant

Regular/ Real-time GPS tracking

Built-in 9 axis accelerometer

Motion sensing capability

Power Monitoring

Charging clip with USB port (for LGT-92-LI)

1000mA Li-ion Battery power (for LGT-92-LI)

Tri-color LED

Alarm button

Bands: CN470/EU433/KR920/US915/EU868/AS923/AU915

AT Commands to change parameters

For more details of the LGT92 you can refer to the Datasheet of this product from ​here and the user manual of the product from ​here.

Setting up the Node: Arduino based GPS tracker node

projectImage

In this step, we are going to set up the first type of GPS tracker node that we are going to connect to our Dragino Gateway i.e. The Arduino-based GPS node that we got with the Dragino Kit. This node has an onboard GPS Chip. Though we can also connect an additional GPS antenna to this I would still use the onboard one. The GPS Tracker node is basically a GPS shield connected to the Arduino. The LoRa module connected to it is in a Zigbee kind of format and is an SX1276 LoRa module. Before connecting it to the Dragino Gateway, we need to set up and configure the Gateway with TheThingsNetwork. The process for that is similar to the one we used to configure the LG01-P Gateway. You can check this video for the configuration process from ​here and can also refer to the Instructables for that project from ​here. After doing the Gateway setup. Now we need to do the connections for the Node to function. As the GPS part is connected as a shield there is no need for any wires and all. We just need to connect two jumper cables which are the GPS-Rx and GPS-Tx pins that need to be connected to digital pins 3 and 4 respectively. When the node is bought, it has yellow-colored jumpers on the pins that we need to connect. Remove those jumpers first then you can do the connections. After doing these simple connections now it's time to upload the code into this node which we will be doing in the next step

You can get a detailed description of the GPS Shield from ​here.

Programming the Arduino based GPS Node

projectImage

In this step, we are going to upload the program in our Arduino based node. For that, you need to refer to the GitHub repository for this project from ​here and follow the steps given below:

1. Head over to the Github repository. There you will see a file named "​Arduino LoRaWAN GPS Tracker.ino". Open that file. It is the code that needs to be uploaded to the Arduino so copy that code and paste that into the Arduino IDE.

projectImage

2. Head over to TheThingsNetwork Console. There you need to create an Application give it any random Application ID, Some description if you want and after that click the "Add Application" button. Once the Application gets added, head over to the devices tab.

3. There you need to register one device. Give a unique device ID to the device. Generate a random Device EUI and App EUI and hit the register button.

projectImage

4. Once this is done, you need to head over to settings and switch the activation method from OTAA to ABP and after that click the save button.

projectImage

5. From the Device overview page copy the device address and paste that into the code posted in Arduino IDE at its respective place. After that copy the Network Session Key and the App Session Key in the coded format and paste them into the code as well.

6. Once that is done, connect the Arduino to your PC. Select the correct COM Port and hit the upload button. Once the code gets uploaded. Open the Serial Monitor at a baud rate of 9600 and you will see some data on the serial monitor it symbolizes that the transmission of data is going on.

projectImage

7. After that go back to TheThingsNetwork console and open the application that we created. There click on the Payload Formats button. Get back to the Github repository there you will see a file named "​Arduino GPS Tracker Payload". Open that file and copy the small code written there and paste that under the payload formats. After that save the payload functions. This payload function is used to decode the data sent by the GPS node.

projectImage

In this, we are done with the Programming part for the node as well. If you head over to the Data tab you will see some random data there before the payload function was applied. But as soon as the payload function is applied. Then you will see some meaningful data such as the Latitude, Longitude, and a message saying TTN Payload function. This shows that the node is successfully connected and the data transmission is also going on. As this node is not latched with the GPS satellites that's why it takes time in data transmission but it does also if we keep it under the open sky and add an additional antenna then we can significantly enhance the performance of this.

Setting up the LGT-92 GPS Tracker node

projectImage

​Till now, we have done the setup and configuration of the Arduino GPS node and sent data through it to the gateway as well. But as you can see that the Arduino Node is a bit bulky and not very much presentable. But not to worry as we have the LGT-92 GPS Tracker node from Dragino. It is a lightweight beautiful looking GPS tracker node which has a structure similar to that of the Arduino node on the inside but on the outside, it has a panel that has a big red SOS button which sends emergency data to the gateway when pressed and from the gateway, we can read that. It has a multicolor LED as well which lights up to symbolize different things. There is power ON/OFF button on the right side. It comes with some accessories such as a strap to tie it somewhere and also a USB cable which can be used to connect it to a USB to Serial converter and from there you can connect that to your PC. In our case, we do not need to do any coding as the LGT-92 comes preconfigured. The box that it comes in has some data such as the Device EUI and other things so we need to keep the box safely with us.

Now coming to the configuration part. We need to create an application as we did in the case of the Arduino GPS node. But need to do some changes that are as given below:

1. When we enter the EUI tab under the settings we see that there is a default EUI already. We need to remove that EUI and enter the App EUI present on the box of the LGT-92.

projectImage

2. Now we need to create a device and inside the device settings, we need to enter the Device EUI and the App Key which we will get on the box. As these two are entered, our device gets registered and is ready to use.

In this way, the configuration is done and our device is ready to be used as a node.

Testing the Working of LGT-92

projectImage

Till the previous step, we were done with the setting up, configuration part, and device registration of our LGT-92 GPS Tracker node. Now when we turn ON the LGT-92 we will see a green light while it turns ON. As the device will turn ON, the light will go OFF and will blink after a particular amount of time. The blinking light will be of blue color which shows that the data is sent at that time. Now when we go under the Data tab we will see that there is some random data. So we need to change the Payload Format as we did for the Arduino node.

projectImage

Head over to the Github repository where you will see a file named "​LGT-92 GPS Tracker Payload". Open the file and copy the code written there. Now go back to TheThingsNetwork Console, there you need to go to the Payload Format tab and paste the code there. Save the changes and you are done. Now when you go back to the Data tab you will see that now the data is in some understandable format. There you will see data such as the Battery Voltage, Latitude, Longitude, etc also you will see some data saying Alarm_status: False which shows that the SOS button is not pressed.

projectImage

In this way, we got a look into the LPS-8 Dragino Gateway and LGT-92 GPS Tracker node and configured them to send and receive location data. These devices can be very helpful in making LoRa based projects. I will try making some projects with them in the future as well. Hope you liked this tutorial. Looking forward to seeing you next time.

License
All Rights
Reserved
licensBg
0