Add GPS Support in LG308N / LPS8v2
Table of Contents:
- 1. Introduction
- 2. Use Cellular Module GPS feature for LoRaWAN Timing.
- 3. Use Cellular Module GPS feature for System Timing.
1. Introduction
It is possible to GPS supports in LG308N-EC25 version and LPS8v2-EC25 version so device will add location info to uplink packet to LoRaWAN server.
2. Use Cellular Module GPS feature for LoRaWAN Timing.
2.1 Configure on LG308N / LPS8N
Below are the steps:
1. Open the box and connect GPS antenna to GNSS port of EC25
Connect GPS antenna
2. modify the two files:
/etc/chatscripts/3g.chat
ABORT BUSY
ABORT 'NO CARRIER'
ABORT ERROR
REPORT CONNECT
TIMEOUT 10
"" "AT&F"
OK "ATE1"
OK "AT+QGPS=1" --> Add this line, so EC25 module GPS will be enable when dial up
OK 'AT+CGDCONT=1,"IP","$USE_APN"'
SAY "Calling UMTS/GPRS"
TIMEOUT 30
OK "ATD$DIALNUMBER"
CONNECT ' '
Note: After above settings, the GPS will be enable when dial up, if user doesn't use Cellular for Internet access, above script won't execute, in this case, user can run "echo AT+QGPS=1 > /dev/ttyUSB2" to enable GPS /usr/bin/generate-config.sh, after configure this, in the web page, select any frequency band and save to make this take affect.
gen_gw_cfg() {
json_init
json_add_object gateway_conf
json_add_string "gateway_ID" "$gwid"
json_add_string "server_address" "$server"
json_add_int "serv_port_up" "$upp"
json_add_int "serv_port_down" "$dpp"
json_add_int "stat_interval" "$stat"
json_add_boolean "forward_crc_valid" 1
json_add_boolean "forward_crc_error" 0
json_add_string "gps_tty_path" "/dev/ttyUSB1" -----> Add this line so lora program knows to get the gps info from EC25
json_close_object
json_dump > /etc/lora/local_conf.json
}
3. Reboot the device and run logread -f to verify if GPS already works.
Fri Mar 6 04:08:59 2020 daemon.info lora_pkt_fwd[3016]: INFO~ GPS serial port path is configured to "/dev/ttyUSB1"
Fri Mar 6 04:08:59 2020 daemon.info lora_pkt_fwd[3016]: INFO~ [main] TTY port /dev/ttyUSB1 open for GPS synchronization
Fri Mar 6 04:09:00 2020 cron.err crond[1689]: time disparity of 4301528 minutes detected
Fri Mar 6 04:09:00 2020 daemon.info lora_pkt_fwd[3016]: INFO~ sockfd=4
Fri Mar 6 04:09:00 2020 daemon.info lora_pkt_fwd[3016]: INFO~ sockfd=5
Fri Mar 6 04:09:00 2020 daemon.info lora_pkt_fwd[3016]: INFO~ FPort Filter: 0
Fri Mar 6 04:09:00 2020 daemon.info lora_pkt_fwd[3016]: INFO~ DevAddrMask: 0x0
Fri Mar 6 04:09:34 2020 daemon.info lora_pkt_fwd[3016]: INFO: [jit] queue is empty
Fri Mar 6 04:09:34 2020 daemon.info lora_pkt_fwd[3016]: STAT~ {"stat":{"time":"2020-03-06 04:09:34 UTC","lati":22.70627,"long":114.24277,"alti":58,
"rxnb":0,"rxok":0,"rxfw":0,"ackr":0.0,"dwnb":0,"txnb":0}}
Fri Mar 6 04:09:35 2020 daemon.info lora_pkt_fwd[3016]: INFO~ [up] PUSH_ACK received in 293 ms
Fri Mar 6 04:09:35 2020 daemon.info lora_pkt_fwd[3016]: INFO~ [down] PULL_ACK received in 596 ms
2.2. Configure on LPS8v2
Below are the steps:
1. Open the box and connect GPS antenna to GNSS port of EC25
Connect GPS antenna
2. modify the two files:
/etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
echo 0 > /sys/class/leds/dragino\:blue\:opt/brightness
echo 0 > /sys/class/leds/dragino\:green\:stat/brightness
echo 0 > /sys/class/leds/dragino\:red\:sys/brightness
echo AT+QGPS=1 > /dev/ttyUSB2
exit 0
Note: After above settings, LPS8v2 will enable GPS automatically on boot.
The user can run "echo AT+QGPS=1 > /dev/ttyUSB2" to manually enable GPS.
/usr/local/dragino/generate-config.sh, after configuring this, on the web page, select any frequency band and save to make this take effect.
gen_gw_cfg() {
json_init
json_add_object gateway_conf
json_add_string "platform" "SX1$chip"
json_add_string "description" "Dragino LoRaWAN Gateway"
json_add_string "gateway_ID" "$gwid"
json_add_boolean "radiostream_enable" 1
json_add_string "ghost_host" "localhost"
json_add_string "ghost_port" "1760"
json_add_boolean "manage_enable" 0
json_add_boolean "custom_downlink" 0
json_add_int "stat_interval" "30"
json_add_boolean "wd_enable" 1
json_add_boolean "mac_decode" 0
json_add_boolean "mac2file" 0
json_add_boolean "mac2db" 0
json_add_string "log_mask" "1111"
json_add_string "gps_tty_path" "/dev/ttyUSB1" -----> Add this line so lora program knows to get the gps info from EC25
json_add_double "ref_latitude" "$latitude"
json_add_double "ref_longitude" "$longitude"
json_add_double "ref_altitude" "$altitude"
json_add_int "beacon_period" "0"
json_add_int "beacon_freq_hz" "869525000"
3. Reboot the device and run journalctl -u draginofwd -f to verify if GPS already works.
3. Use Cellular Module GPS feature for System Timing.
3.1 Configure on LPS8v2