Community discussions

MUM Europe 2020
 
aporozny
just joined
Topic Author
Posts: 4
Joined: Fri May 23, 2008 3:24 am

GPS

Mon May 26, 2008 2:46 am

CAn anyone tell me if they have successfully implemented a GPS reciever thru a MiKrotiK box. What I want to do is get the reciver to work, and somehow get the info from it every 30 seconds. THis info can either be fetched or if possible sent to a ftp server.

Any suggestions?

Cheers
Andre
 
User avatar
eebng_1422
Frequent Visitor
Frequent Visitor
Posts: 83
Joined: Sun Dec 23, 2007 12:39 am
Location: Assiut, Egypt
Contact:

Re: GPS

Mon May 26, 2008 2:54 am

that is right Mr. aporozny,
I also wants to be one of GPS users here in Egypt
============
Ahmed Bakhiet
skype Name: abakhiet
Mob: +2/0108944553
Move 2 Improve
 
changeip
Forum Guru
Forum Guru
Posts: 3804
Joined: Fri May 28, 2004 5:22 pm

Re: GPS

Mon May 26, 2008 5:17 am

[admin@home] > /system gps monitor
date-and-time: may/26/2008 02:16:19
longitude: "W 117 X' 51''"
latitude: "N 33 X' 48''"
altitude: "201.699997m"
speed: "0.166680 km/h"
valid: yes

date-and-time: may/26/2008 02:16:21
longitude: "W 117 X' 51''"
latitude: "N 33 X' 48''"
altitude: "201.699997m"
speed: "0.092600 km/h"
valid: yes
Colo and Wholesale Bandwidth Available! Sales at SanDiegoBroadband dot com
 
aporozny
just joined
Topic Author
Posts: 4
Joined: Fri May 23, 2008 3:24 am

Re: GPS

Wed May 28, 2008 4:20 am

Thanks for that guru, however, how do i get that information to either a mapping server or an ftp server automaticatlly?

Thanks in advance
Andre
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24317
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: GPS

Wed May 28, 2008 10:27 am

if your router travelling a lot :) ?

you could use the API, or some SSH/PERL script to get that info.
No answer to your question? How to write posts
 
aporozny
just joined
Topic Author
Posts: 4
Joined: Fri May 23, 2008 3:24 am

Re: GPS

Fri May 30, 2008 2:08 am

yup, I am putting the mikrotik box with the 3g router in a bus. People travelling will be able to purchase time or data and get online in the bus.

THe customer wants to see where the bus is at the same time. Keep track of where it has been.

I do not know how to get a script to read the serial port to get the info from the gps.

I also need to load the GPS software on the microtik box so any help ther would be good as well.


Cheers
Andre
 
Tanker
Member Candidate
Member Candidate
Posts: 131
Joined: Fri Nov 24, 2006 10:46 am

Re: GPS

Fri Jun 27, 2008 6:07 pm

**BUMP**

Info guys.... has anyone got this working????

Today I got an enquiry for the same type of thing.

T
 
changeip
Forum Guru
Forum Guru
Posts: 3804
Joined: Fri May 28, 2004 5:22 pm

Re: GPS

Sat Jun 28, 2008 8:03 am

gps works fine... do you need to write a /tool fetch script to post the location periodically? whats your goal ?

Sam
Colo and Wholesale Bandwidth Available! Sales at SanDiegoBroadband dot com
 
Tanker
Member Candidate
Member Candidate
Posts: 131
Joined: Fri Nov 24, 2006 10:46 am

Re: GPS

Sat Jun 28, 2008 6:07 pm

We've had a request from a client that does geographical mapping in a desert...

We've installed several BSS for them... and they want to get GPS data from the BSS and triangulate from their equipment to get exact positions.....

I said I'd ask...

T
 
sskillin
just joined
Posts: 13
Joined: Tue Jan 06, 2009 10:05 pm

Re: GPS

Tue Jan 06, 2009 10:10 pm

Is it possible to gather the location information (LAT/LON) from SNMP OID values? This would do what I need done, and I could then grab them whenever I wished with an SNMP GET.
 
QpoX
Member
Member
Posts: 387
Joined: Mon Mar 24, 2008 7:42 pm
Location: Lemvig, Denmark

Re: GPS

Fri Jan 09, 2009 1:58 pm

What you will need:
A webserver
A database
A serverside programming language

you can use the fetch command in ROS and use the GET function in your script on your webserver from the http header.
the script logs every thing to the database...

i use something similar to monitor wifi clients status (will be posted in the wiki when it is done).
 
BuccaNET
newbie
Posts: 40
Joined: Fri Mar 28, 2008 4:30 pm

Re: GPS

Wed Feb 04, 2009 11:07 am

What GPS are you using? I am looking for a GPS I can connect to the serial port of the MT.

Thank you,

Cory
 
User avatar
eben
Member
Member
Posts: 479
Joined: Mon Feb 16, 2009 8:37 pm
Location: Somerset West, South Africa
Contact:

Re: GPS

Sat Mar 21, 2009 11:58 pm

What GPS are you using? I am looking for a GPS I can connect to the serial port of the MT.
bump
 
Chipi
Frequent Visitor
Frequent Visitor
Posts: 57
Joined: Thu Nov 24, 2005 12:02 am

Re: GPS

Sat Jan 16, 2010 1:24 pm

I´m working with a GARMIN GPS18X PC with serial connection. Others model of Garmin cann´t comunicate with Mikrotik because they have his own protocol.

If you want to use a GPS with Mikrotik you need to check that the GPS use NMEA 0183 protocol.

Regards
----------{Microcom Argentina SA}----------
Distribuidor Mayorista MIKROTIK en Argentina

http://www.microcom.com.ar
 
csickles
Forum Guru
Forum Guru
Posts: 1257
Joined: Fri May 28, 2004 8:46 pm
Location: Phoenix, AZ
Contact:

Re: GPS

Sat Jan 16, 2010 5:46 pm

I have a GPS "Module" that connects via USB...
RouterOS "Sees" it and works....

It costs about $50.00 US ans has a magnetic mount...
It has a 6' USB cable.

It is made by "Ambicom"
Model: GPS-USB

Just Drug it out of the laptop case and it is up and working..

Let me think on the collection idea..
Things that make you go "Hmmmmmmmm"...

Craig
 
User avatar
astounding
Member Candidate
Member Candidate
Posts: 121
Joined: Tue Dec 16, 2008 12:17 am

Re: GPS

Sat Jan 16, 2010 9:34 pm

Assuming the 'once' parameter works and that '/system/gps/monitor' works in the API much like changip's CLI example, then using the Ruby API command-line example script tikjson.rb and changip's example GPS output, one could retrieve the GPS info thus:
user@unixhost:/path% ./tikjson.rb 10.20.30.40 userid password /system/gps/monitor =once=
[{'date-and-time': 'may/26/2008 02:16:19','longitude': 'W 117 X\' 51\"','latitude': 'N 33 X\' 48'\'','altitude': '201.699997m','speed': '0.166680 km/h','valid': 'yes','.tag': 2,'!re': NULL},{'!done': NULL,'.tag': 2}]
user@unixhost:/path%
Or using the Ruby GEM:
#!/usr/local/bin/ruby

require 'rubygems'
require 'mtik'

TIKHOST='10.20.30.40'
TIKUSER='admin'
TIKPASS='password'

def get_location(ip, user, pass)
  location = MTik::command(
    :host => TIKHOST,
    :user => TIKUSER,
    :pass => TIKPASS,
    :command => [
      '/system/gps/monitor',
      '=once='
    ]
  )[0]
  unless location.key?('!re')
    raise RuntimeError.new("No valid reply from MikroTik device to /system/gps/monitor command.")
  end
  unless location['valid'] == 'yes'
    raise RuntimeError.new("GPS location was read, but invalid.")
  end
  return location
end

l = get_location(TIKHOST, TIKUSER, TIKPASS)
puts "GPS Latitude #{l['latitude']} Longitude #{l['longitude']}"
puts "Altitude #{l['altitude']} Date/Time #{l['date-and-time']} Speed #{l['speed']}"

Which might output (barring errors/exceptions):
GPS Latitude N 33 X' 48' Longitude W 117 X' 51''
Altitude 201.699997m Date/Time  may/26/2008 02:16:19 Speed 0.166680 km/h
If you want to save the location in a database, require 'mysql' or another DB (or even 'activerecord') and insert the data. You could even run an eternal script that connected to the device, then continuously monitored the GPS location (by not using the '=once=' parameter) and processing each reply sentence as received:
#!/usr/local/bin/ruby

require 'rubygems'
require 'mtik'

TIKHOST='10.20.30.40'
TIKUSER='admin'
TIKPASS='password'

tikcon = MTik::Connection.new(
  :host => TIKHOST,
  :user => TIKUSER,
  :pass => TIKPASS
)

tikcon.get_reply_each('/system/gps/monitor') do |req, sentence|
  if sentence.key?('!re') && sentence['valid'] == 'yes'
    puts "Time: #{sentence['date-and-time'] Lat: #{sentence['latitude']} " +
      "Lon: #{sentence['longitude']} Alt: #{sentence['altitude']} " +
      "Speed: #{sentence['speed']}\n"
  end
end
## This runs the event loop which should keep reading replies for as long as the device sends 'em
tikcon.wait_all

## This should never happen:
tikcon.close
Which might output a sequence like:
Time: may/26/2008 02:16:19 Lat: N 33 X' 48' Lon: W 117 X' 51'' Alt: 201.699997m Speed: 0.166680 km/h
Time: may/26/2008 02:16:20 Lat: N 33 X' 48' Lon: W 117 X' 50'' Alt: 202.262352m Speed: 2.235236 km/h
Time: may/26/2008 02:16:21 Lat: N 33 X' 48' Lon: W 117 X' 50'' Alt: 201.693527m Speed: 1.012523 km/h
Time: may/26/2008 02:16:22 Lat: N 33 X' 49' Lon: W 117 X' 50'' Alt: 200.838820m Speed: 5.936262 km/h
...
The API in any of the API languages is very useful.

Aaron out.

Disclaimer: No code above was tested for syntatic correctness, and I don't have a GPS attached to a 'Tik so I dunno exact API commands nor output sentence structure. But the basics should be there...

Who is online

Users browsing this forum: No registered users and 26 guests