Introduction: Dragino LoRa GPS Tracker
We always appreciate your support and advice.
In this project,we'll show how to get GPS data from a remote Arduino via Wireless Lora Protocol and show the track on the GoogleEarth.The construction of this project is similar to my last one:
1) Client Side: Arduino + Lora/GPS Shield (868Mhz).
Client side will get GPS data and keep sending out to the server via Lora wireless. Server side will listen on the Lora wireless frequency, once it get the data from Client side, it will turn on the LED and log the GPS data to a USB flash.
The Dragino Lora/GPS Shield is an expension board for LoRa™/GPS for using with the arduino.This product is intended for those interested in developing LoRa™/GPS solutions.The Lora/GPS Shield is composed of Lora/GPS Shield mother board and Lora BEE.
In the Lora part,the Lora/GPS Shield is based on the SX1276/SX1278 transceiver.The transceiver of the Lora/GPS Shield feature the LoRa™ long range modem that provides ultra-long range spread spectrum communication and high interference immunity whilst minimising current consumption. LoRa™ also provides significant advantages in both blocking and selectivity over conventional modulation techniques, solving the traditional design compromise between range,interference immunity and energy consumption.
In th GPS part,the add on L80 GPS (base on MTK MT3339) is designed for applications that require location or timing info. It connected to the arduino via serial port .
If you want to get more info about the Lora/GPS shield, please click this link:http://wiki.dragino.com/index.php?title=Lora/GPS_Shield
Step 2: Introduction of Lora BEE
The Dragino Lora BEE is a Lora moudule allows the user to send data and provides ultra-long range spread spectrum communication and high interference immunity whilst minimising current consumption.
The Lora BEE is based on the SX1276/SX1278 transceiver.The Lora BEE targets professional wireless sensor network applications such as irrigation systems, smart metering, smart cities, smartphone detection,building automation, and so on.
Step 3: Construction
Step 4: Hardware Preparations:
The project requries below hardwares:
- Arduino board x 2 (We use an UNO board and a MEGA 2560 here)
- Dragino Lora/GPS Shield x 1 (We use 868MHZ here)
- Dragino Lora Shield x 1 (We use 868MHZ here)
- Yun Shield v1.1.6 x 1
- USB flash x 1
- TTL to USB adapter x 1
- 868MHZ antenna x 2
- Ethernet cable x 1
- USB cable x 2
- LED x 1
- 12V Batteries x 2
- Some jump wires
Note: About the Yun Shiled,we must use the Yun Shield v1.1.6/Yun Shield v2.4 or higher version.
Step 5: Other Preparations:
In addition, we have to make the following preparations：
As you can see from the "server sketch" at the next steps,we store the GPS data in the file "/data/datalog.csv" of the USB flash,so we need to create a directory named “data” in the USB flash root.
Step 6: Connections
Connect the client and the server as above pictures.
In the sketch we use the hardware serial to communicate with the GPS and use the software serial(RX /D3,TX/D4) to debug via Arduino serial monitor.So,we connect the client to computer by TTL to USB adapter,the wiring is:
TTL to USB adapter --------------- Arduino UNO
RX ----------------- D4
TX ------------------ D3
GND ------------------ GND
On the Lora/GPS Shield,put the RXD/TXD jumpers on the status as the 3rd picture.(Connect GPS to the hardware serial)
You can get the Lora/GPS Shield hardware resource from:here.
- The LED is on the D4 (Server).
- Put the antenna on the boards.
- Check the wiring carefully.
Step 7: Upload Sketch
Power them by 12v batteries,and connect them to the computer via USB cable or Ethernet cable.
At this step,make sure you have put the "SoftwareSerial.h" and "RadioHead.h" into your IDE libraries folder.
We use UNO+Lora/GPS Shiled as the client here.The GPS was connected to the hardware serial，in order to upload the sketch successfully，we need to press the "RST" button to reset the GPS to release occupation of arduino hardware serial until upload done. Open the IDE(Version 1.6.8 here),choose the correct board and correct port for you arduino,copy the client sketch to IDE,upload it to the board.
Upload the server sketch to the arduino board.
About how to use the Dragino YUN to upload the sketch,click:http://wiki.dragino.com/index.php?title=Yun_Shield
About the "RST" button
The GPS module can be restarted by driving the RESET to a low level voltage for a certain time and then
releasing it. Press the "RST" button will reset the digital part of the GPS receiver.
If you connect the GPS to the arduino by hardware serial,you need to press the "RST" button to release occupation of arduino hardware serial until the upload is complete.
Step 8: Test
We take an outdoor test today.At the beginning of this test,make sure the 3D_FIX(The blue LED) is flashing on the Lora/GPS Shield,it means the GPS get fixed.
As shown in the code: Lora send data after the GPS get fixed.Theoretically, it requires that GPS module has to track at least three satellites for positioning.
Step 9: Running Result
When the GPS get no fixed,the running result of the clients is as the first picture.(We get the running result from the client via software serial here.)
After the GPS module fixed,if the server an client are in the transmission range,you can see the LED flashing on D4 on server,and you can also get the running result as the 2nd picture(Client) and the 3rd picture(Server).
Then you can find a "datalog.csv" file in the data folder of the USB flash,open the csv file and you will see the longitude and latitude data collected by GPS receiver.(4th picture)
You can also edit the code to get more data from the GPS.
Step 10: Data Processing
We need to convert the csv file into kml file ,so we can import the datalog to the GoogleEarth.We use the "KMLCSV Converter" here,complete the following operation:
- Open the KMLCSV Converter,click File->Configration
- Click 'File Management- Browser' to choose the folder for storing datalog.csv
- As the 3rd picture,choose the "datalog.csv" and click the "Create File " button to create a kml file in the same folder.("datalog.kml")
Then you can find "datalog.kml" file in the folder where stores the "datalog.csv".(Picture 4)
Step 11: Import Map
Open "the datalog.kml" by the GoogleEarth,we get above pictures.We can see the GPS track there.
Step 12: Conclusion and Notices
In this project,we get the GPS track successfully.You can get more GPS data that you need from the Lora/GPS Shield,you can also build you own sensor transceiver by the board.It's a good idea if you want to use the Lora/GPS Shield in your LoRaWan construction.
Make sure what serial you want to use,hardware serial or software serial?
Make sure the serial you use in Sketch reflect the exactly connection, we are using two serial here and easy to get confuse between them.
You have to be aware that Radio link quality and performances are highly dependent of environment. Better performances can be reached with:
- Outdoor environment.
- No obstacles.
- No high level radio interferer in the ISM 868MHz band.
- At least 1 meter above the ground.
Radio performances are degraded with:
- Obstacles: buildings, trees...
- Inner buildings environments.
- High ISM 868MHz band usage by other technologies.
Radio communication are usually killed with bad topographic conditions. It is usually not possible to communicate through a hill, even very small.
Step 13: Reference
- More info about Lora/GPS Shield :http://wiki.dragino.com/index.php?title=Lora/GPS_Shield
- More info about Dragino Yun Shield :http://wiki.dragino.com/index.php?title=Yun_Shield
- You can buy them from:http://www.dragino.com/buy.html
- Lora GPS Tracker sketch: https://github.com/dragino/Lora/tree/master/Lora%...
- Hardware resource of Lora/GPS Shield:https://github.com/dragino/Lora/tree/master/Lora%20GPS%20Shield
- Radiohead library:http://www.airspayce.com/mikem/arduino/RadioHead/
- Software Serial library:https://www.arduino.cc/en/Reference/SoftwareSerial
- KMLCSV Converter:http://kmlcsv-converter.software.informer.com/
- If you want to get more info about this poject,please contact email@example.com or firstname.lastname@example.org.
We have a be nice policy.
Please be positive and constructive.