11315 questions

13487 answers

21158 comments

31578 members

0 votes
3,533 views 5 comments
by
Hello,

Is there opportunity to record GPS coordinates and store them to the USB drive or the memory card?

The GPS server I'm using (my-gps.org) stores the GPS track only a short period and for longer trips I prefer to record the track local at the router.

Thanks in advance

Matthias
by
Hello,

Yes, it is possible to record GPS coordinates and store them to the USB or memory card, however it will require you to write bash script.

Router gets all information about GPS using "gpsctl" commands. To get full information what "gpsctl" capable, in CLI, or ssh session write: gpsctl -h.

1 Answer

0 votes
by

Hello,

No, currently RUT955 does not have a feature which would store GPS data in external storage (USB/uSD card). Such possibility might be added in the future.

Until then, you could use custom script on the router, which would log this data for you.

What kind of data would you like to log in external storage?

  • Raw NMEA data,
  • Any of these values (Latitude, Longitude, fixtime [unix timestamp*1000], datetime [DDMMYYhhmmss], altitude, speed, satellites count, course over ground, fix status, accuracy)
  • or "compressed data", as if router would be sending data to your server, which you would be able to parse latter using routers GPS protocols ( Article here )

How often data should be logged?

by

Hello,

so I think I have to learn somithing about programming custom scripts :-)

Getting to your questions.

I think GPS data recording in the open GPX-format would be good.

For me, following data is interesting:

Latitude, Longitude, datetime, altitude, speed and course over ground

Frequency of logging could be defined by the same parameters like in the GPS Data-service to server configuration.

Thank you in advance.

Matt

by

Hello,

Writing scripts for Teltonika routers is easy. You can learn basic commands/functions in no time.

I have wrote basic script for you. Feel free to edit the script to your needs (e.g. rearrange/change information which should be save, etc). In script information is saved with "tab" spacing in between values, which means, that you can open the output text file with e.g. Notepad++ application and then copy->paste everything to e.g. excel worksheet and have a nice table. Here is the script:

#!/bin/ash
#Specify location path and name of the file and frequency how often data should be written to the file
FILE=/mnt/mmcblk0p1/file.txt
FREQUENCY=5

if [ ! -f $FILE ]; then   # Checks if file exists. If not, creates it
    echo -e 'Latitude \tLongitude \tDatetime \tAltitude \tSpeed \tCourse over ground' > $FILE
fi
while [ 1 ]; do         # Infinite while loop
if [ $(gpsctl -s) -eq 1 ]; then   # Checks for GPS fix
    echo -e $(gpsctl -i) '\t' $(gpsctl -x) '\t' $(gpsctl -e) '\t' $(gpsctl -a) '\t' $(gpsctl -v) '\t' $(gpsctl -c) >> $FILE
fi
sleep $FREQUENCY
done

In the top of the script your have to specify the file path/file name and the frequency in seconds how often data should be collected. To find out what file path to use, connect your external storage (USB or uSD card) and navigate to router's "Services -> USB Tools" menu. In "Mount Point" column you will see path location for your storage:

Once you have specified your storage's file path, file name and desired data collection frequency, connect to router via SSH (e.g. using Putty application):

  • SSH login: root
  • SSH password: <your router's password>

and do the following:

  1. Type "vi /bin/script.sh" (feel free to change the name of the script)
  2. Press "a" keyboard button.
  3. Paste the script here (if you are using Putty application, that can be done with right mouse click)
  4. Press "esc" keyboard button and type ":x"
  5. Type "chmod +x /bin/script.sh" (if you have chosen different script name do not forget to use same name here and in step 6)
  6. Connect to router's WebUI, navigate to "System -> User scripts" menu and type "/bin/script.sh" above existing "exit 0" line.
  7. Restart the router.

Once your router is restarted, it should create new file in your external storage. Once router will get "GPS fix" (i.e. find out it's GPS location) it should start storing GPS information in this file.

Let me know if you have managed to successfully run the script and that this is indeed what you were looking for.

by
Thanks for the script. Just what I'm looking for - well, almost!

Do you know if it's possible to write the file to a network share instead? I'm running a low power Ubuntu box on the same network with an attached USB drive I would like to write too.
by

The above script works for me, but an & is needed in the Startup Script in order to send the process to the background. 

i.e. /bin/script.sh &

Else the script will hang and prevent the router from being soft re-bootable.