Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In real-life applications, it is not very convenient to change the priority by hand and this is why, to automate automatically change the processpriority, we advise using scripts (like those mentioned below)the methods shown below.

note: Starting with the 7.1rc3 firmware release, it is possible to check when is the last time that the device got NMEA data (GPS data). This information can be used for troubleshooting purposes. You can check this parameter in CLI with the command "system gps monitor once". "data-age" parameter is the one that demonstrates when was the last time that the device received an NMEA message.

...

with the command "system gps monitor once". "data-age" parameter is the one that demonstrates when was the last time that the device received an NMEA message.

Automatic switch to GNSS when no outgoing traffic is detected

Automation can be achieved using ppp profile "on-down"script, "idle-timeout" features and PPP interface "dial on demand" setting.

When implemented, BG77 modem will use cellular data when there is internet traffic present (during this time GNSS coordinates are not received), and will automatically enable GPS reception when there is no internet traffic detected.

Idle-timeout parameter specifies the amount of time after which the link will be terminated if there is no activity present. 

On-down script field allows you to configure a script that will be run every time the PPP interface goes down (including after idle-timeout inactivity). The script will set modem's priority to GNSS reception.

Dial-on-demand will make sure that PPP interface tries to establish the connection only when there is outgoing traffic present (additionally, the modem will automatically set WWAN/cellular connection priority). This will make sure that after idle-timeout occurs, the connection is not automatically reestablished unless outgoing packets are detected.

By combining the three features, you can achieve the scenario, where:

  • If you have outgoing traffic, PPP interface is going to be up (because of the "dial on demand") and the priority will be set to the cellular connection. PPP interface's modem initialization AT command (that is configured under PPP interface's modem-init="AT+QGPSCFG="priority",1" setting) for WWAN priority is sent. During this time, GPS coordinates will not be received.
  • If no traffic is detected after "idle-timeout" inactivity window, the PPP interface will go down and, because of the "dial on demand" setting, it will not establish the connection until outgoing packets are detected. This is where "on-down" script is run that switches WWAN priority to GNSS priority.

In order to implement it, simply add a new PPP profile:

Code Block
languageros
/ppp profile add idle-timeout=30s name=BG77 on-down="/interface ppp-client at-chat [find where modem-init=\"AT+QGPSCFG=\\\"priority\\\",1\"] input=\"AT+QGPSCFG=\\\"priority\\\",0\""

The example above, creates a new profile with the name "BG77", sets idle-timeout to 30 seconds, and enables the on-down script that will send GNSS priority AT command.

After that, make sure to apply this newly created profile onto the PPP interface:

Code Block
languageros
/interface ppp-client set profile=BG77 0

And confirm that it was applied (profile=BG77):

Code Block
languageros
/interface ppp-client print
Flags: X - disabled; R - running 
0 R name="ppp-out1" max-mtu=1500 max-mru=1500 mrru=disabled port=modem data-channel=2 info-channel=2 
apn="internet" pin="" user="" password="" profile=BG77 phone="" dial-command="ATDT" 
modem-init="AT+QGPSCFG="priority",1" null-modem=no dial-on-demand=yes add-default-route=yes 
default-route-distance=1 use-peer-dns=yes keepalive-timeout=30 allow=pap,chap,mschap1,mschap2 

Switch to GNSS using scripts and scheduler

The script below should be configured with a scheduler. The scheduler will make sure that the script is initiated each x hours/minutes (whenever you need it).

...

For example, if the MQTT server/broker is AWS, the posted result would look like this:

...

Switch to GNSS when no outgoing traffic is detected using scripts and scheduler

The 1st script is used to check whether there is any traffic and to switch the priority back and forth based on that.

The 2nd script can be used to enable WWAN priority and to publish the GPS coordinates to the server of your choice. You can use any supported protocol, like HTTPS post (fetch) or MQTT to post the coordinates.

1st script

This script below will automatically create a scheduler:

...

Once all 3 conditions are met and the scheduler is ready, reboot the device for the script to take action.

2nd script

The second script is used to collect GPS coordinates and send them further to the server.

...