FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
+2 votes
4,551 views 5 comments
by anonymous
As I'm listening to MQTT all the time on a central broker, I'm also interested in getting position posted at a constant rate. Therefore it would be great to have somewhere to listen constantly. Normally this would be achieved by opening /dev/ttyUSB1 and just consume the data, but I can imagine that there are other applications that would be sad. What is the intended use of GPS-data? Am I supposed to open and listen for a couple of seconds and then close?

The intended MQTT posts would be something like this:

evt/gps/speed {"value":0, "unit":"km/h", "position": {"lat":"5934.820063,N", "long":"01730.328929,E"}, "timestamp":1540634880}

This would allow me to store data in influx and use grafana to visualize speed on time. Then I can see on a graph when vehicle is moving and place it on a map.
by anonymous
Hi,

I would also be interested by this feature. I found it hard to use the GPS protocol to get the data (other question posted here on this topic: https://community.teltonika-networks.com/1226/how-to-control-gps-life-cycle)

1 Answer

+1 vote
by
Hi,

Available parameters using MQTT you can find here:

https://wiki.teltonika.lt/view/Monitoring_via_MQTT
Best answer
by anonymous
Thanks!

The fencing and other stuff is good. The program mqtt_pub produces that.

I would like to listen to /dev/ttyUSB1 though and produce above mentioned data on MQTT.

The GPS return a lot of data and I know how to use it:

$GPGGA,222916.00,5934.824099,N,01730.324840,E,1,10,0.6,44.6,M,27.0,M,,*5D
$GPVTG,108.0,T,105.1,M,0.0,N,0.0,K,A*2F
$GPRMC,222916.00,A,5934.824099,N,01730.324840,E,0.0,108.0,261018,2.9,E,A*3E
$GPGSA,A,2,01,06,10,12,14,15,17,19,24,25,,,0.9,0.6,0.7*30
$GPGSV,4,1,15,01,07,007,32,06,11,109,36,10,06,278,27,12,55,237,30*7A
$GPGSV,4,2,15,15,14,194,35,17,36,056,45,19,52,092,40,22,02,015,33*77
$GPGSV,4,3,15,24,69,174,34,25,17,248,26,14,09,327,,32,25,313,*70
$GPGSV,4,4,15,39,,,36,40,,,34,49,,,34*7B
$GPGGA,222917.00,5934.824137,N,01730.324778,E,1,10,0.6,44.5,M,27.0,M,,*5E
$GPVTG,108.0,T,105.1,M,0.0,N,0.0,K,A*2F
$GPRMC,222917.00,A,5934.824137,N,01730.324778,E,0.0,108.0,261018,2.9,E,A*3E
$GPGSA,A,2,01,06,10,12,14,15,17,19,24,25,,,0.9,0.6,0.7*30
$GPGSV,4,1,15,01,07,007,32,06,11,109,35,10,06,278,29,12,55,237,32*75
$GPGSV,4,2,15,15,14,194,34,17,36,056,45,19,52,092,41,22,02,015,34*70
$GPGSV,4,3,15,24,69,174,33,25,17,248,26,32,25,313,27,14,09,327,*72
$GPGSV,4,4,15,39,,,36,40,,,33,49,,,35*7D
$GPGGA,222918.00,5934.824158,N,01730.324748,E,1,11,0.6,44.5,M,27.0,M,,*5A
$GPVTG,108.0,T,105.1,M,0.0,N,0.0,K,A*2F
$GPRMC,222918.00,A,5934.824158,N,01730.324748,E,0.0,108.0,261018,2.9,E,A*3B
$GPGSA,A,2,01,06,10,12,14,15,17,19,24,25,32,,0.9,0.6,0.7*31
by

Seems this command should help to you:

root@Teltonika-RUT955:~# gpsctl

usage: gpsctl OPTIONS

  -h, --help                    Print Help

  -i, --latitude                Get Latitude

  -x, --longitude               Get Longitude

  -f, --fix                     Get fixtime (unix timestamp*1000)

  -e, --datetime                Get datetime (DDMMYYhhmmss)

  -a, --altitude                Get altitude

  -v, --speed                   Get speed

  -p, --satellites              Get satellites count

  -c, --course                  Get course over ground

  -s, --status                  Get fix status

  -u, --accuracy                Get accuracy

by anonymous
That were helpful!

Is there a lib that I can use exposing this functionality to a C-program?
by anonymous
Also take a look into a GPS protocol if you will use this data on your own server:

https://wiki.teltonika.lt/view/RUT955_Protocols