OpenWrt Forum Archive

Topic: wireless vehicle tracking

The content of this topic has been archived on 27 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have a little school project here that involves some Linksys wrt54gs and openWRT. I'm creating a wireless vehicle tracking system for the University of Arizona CatTran shuttle. This is going to be as simple as possible, and I will only be implementing a test - this won't be a full-scale deployment. I've come up with what I think will be a very simple solution, but I'm missing a few details and I was hoping you guys could point me in the right direction.

I'm going to place a few AP's around campus with big directional antennas pointed at timed stops. The shuttles will have an AP in client mode sitting on the dash board (or somewhere near a window). My thought is to have the AP's running a cron job that will check every minute or so whether one of the client AP's on the shuttle has connected to it, then send that data back to a server. The server will then put all the information on a web page that will be accessed by faculty and students. I will use the mac addresses of the client machines as identifiers for shuttles, and the mac address of the AP sending the server the information will tell me which AP the shuttle is near and therefore where the shuttle is.

What I need to know is, is there some sort of log file that keeps track of what mac addresses are connected at any given time? Or perhaps I could bind mac addresses to IP's and then I just need to know where to find the list of IP's?

I've looked at a few bandwidth useage scripts like this: http://openwrt.org/forum/viewtopic.php?id=304

Is this the right direction? I don't need a full solution, mainly because I want to figure it out on my own. But any hints, tips, prods, etc. are very welcome. Please let me know if this is a bad explanation. I'll keep you all updated on the project. It's not very interesting at the moment, but if I can get this basic stuff out of the way then I can move on to more interesting applications.

Thanks for any help.

I think I found what I'm looking for. I can use 'arp', or just 'cat /proc/net/arp' to find mac address and IP pairs. Hopefully that will get the job done.

GPS was what came to my mind immediately as well, however, one of the requirements is no subscription fees.

Also, how would I upload the GPS coordinates? I'd have to wait until I reached one of my AP's, which would basically accomplish what I'm doing now, but with more equipment to buy.

Thanks for the link to the serial port hack. Eventually I may add cameras to take pictures of how crowded the shuttle is.

Got an other idea, heared it somewhere.

It's called foxhunt, played by radio amatures
place your ap's in a grid and measure the signal strength, i think it comes in a variable from WL or something else
it requires some test measurements to oak the thing but it's maybe possible at your campus.
with the required effort it should work

was thinking of doing the same thing in my free time, but at the moment i aint got any

Good idea. I'm assuming this will use some sort of triangulation? Again I run into this problem of uploading the location data to the web where everyone can see it.

There is something out there called Place Lab that uses a passive technique to locate wireless access points, (can be anybody's), and then uses those positions, (which you entered into a DB earlier using war driving techniques), and signal strength to calculate your GPS coordinates. I think this is what foxhunting comes down to. It's really cool: http://www.placelab.org/

I thought that maybe I could use a series 60 phone and then send back the coordinates every so often using SMS - but again, I run into subscription fees. Maybe the UofA will get off their butts and install a wireless network across campus - that would solve all of my woes.

GPS was what came to my mind immediately as well, however, one of the requirements is no subscription fees.

GPS is free for everybody in the world - no subscription fees.

So I just need a GPS device? For some reason I thought I would need to pay a subscription. Thanks for the heads up.

Hiya.

you only need a gps and a compatible cable connecting it to a serial or usb port for you.  Verry cool!

I guess I would set up routing on the stationary APs to allow the mobile APs access to some part of your bigger network when they associate.  My best results were obtained running all nodes in adhoc mode instead of AP, and with static IPs, and run an olsr daemon on each node to continually check for neighbors.  This can be done every 0.05s or so, more than adequate.  then, do one of the following:

1 - put a chunk of php on the web server that records a position for a shuttle and have the shuttles repeatedly try to access that php. eg, the shuttles have a shell script that has:

$curgps= $(get latest LL sentence from GPS)
$curlat = $(judicious use of 'cut' to get lat from $curgps)
$curlong = $(judicious use of 'cut' to get long from $curgps)
$thepass=$(make from $curlat and $curlong in a way webserver will be able to interpret)
wget -q http://ip.of.web.server/folder/update.php?shuttle_num=3&gpslat=$curlat&gpslong=$curlong&password=$thepass'
sleep 1s

in a while true loop and the web server has a php file that might be pseudocoded like:

<?php
  if (password, curlat, and curlong were sent and password is properly constructed)
  {
    system("mkdir -p nodes");
    open a text file, overwriting current contents in the name of "nodes/shuttle_num"
    put in file "curlat\ncurlong\n" and close it
 }
  else
    echo 'proper unusage ocurred';
?>

then for your public-viewable page, simply

<?php
  system("ls -1 --color=no --almost-all nodes > just_a_file");
  $a = file("just_a_file"); system("rm just_a_file");
  // get a map ready
  foreach ($a as $b)
  {
    //open the file called $b, grab the lat and lon, plot on map
  }
  //show map to users,
  //refresh often
?>

or, 2 - set up public/private key authentication on all the nodes, and do a shell script like this:

$curgps= $(get latest LL sentence from GPS)
$curlat = $(judicious use of 'cut' to get lat)
$curlong = $(judicious use of 'cut' to get long)
#now make a file called shuttleX where X is some id of the shuttle
//put $curlat and $curlong in it as before, then, assuming shuttle number 3,
scp shuttle3 webserver:/var/www/html/myfolder/shuttle3
sleep 1s;

in a while true loop again, of course.  Then do something similar to the web server as discussed above in part 1, for the public-viewable page.

I do recommend using olsr, as the routing tables update fairly quickly upon neighbor recognition.  It happens independent of ad-hoc association, which I'm not sure how to be notified of.  but when you can ping your shuttle, it's in range.  I've done something like

if [ "`route -n | grep UH | cut -d' ' -f 1 | grep -c 192\.168\.1\.74`" -ne "0" ]

to see if a neighbor exists presently.  running -n to route makes it quick and the UH is something that seems pretty reliable to detect olsr routes.

hope this helps!

P.S.  I've set up a similar system.  some preliminary pics can be found at
http://img.photobucket.com/albums/v342/mrmoj/stc.png
http://img.photobucket.com/albums/v342/mrmoj/dt.png

and at http://doctormojo.com/wrt54g/mesh_status/ you can see an olsr network rearrange itself.  (the image redraws itself every five seconds, and if there are only three nodes, the topology is pretty dull most of the time.  But people walking between the nodes causes it to rearrange itself into some cool shapes.)


Moj

(Last edited by mrmoj on 8 Jun 2005, 21:10)

seanf wrote:

I think I found what I'm looking for. I can use 'arp', or just 'cat /proc/net/arp' to find mac address and IP pairs. Hopefully that will get the job done.

I'm not sure how long the arp cache keeps entries in it, but it's probable they might remain long after a shuttle has left the stop.

Also, I can't see why the arp cache would have any entries before you've commenced ip traffic.  no ping or ssh (etc), no entry in the arp cache.  So your mobile nodes would probably have to be pinging the stationary nodes constantly to keep refreshing the arp cache to make this method work, hence static ips a must..

but then again, olsr is ip traffic, so if you were to use olsr, catting the arp cache would work for you, aside from the stale entries problem aforementioned.

moj

(Last edited by mrmoj on 8 Jun 2005, 21:12)

I'm doing something similiar:

Have a GPS unit & a CDMA modem but you could use GSM

With the dual serial mod, you're good to go.

(Last edited by frogzoo on 10 Jun 2005, 00:58)

Why don't you put the cron events on the AP's riding the bus (assuming their OpenWRT, too). A 15-second sleeping script loop may do the trick as well.

Have each bus AP search for bus stop APs constantly. Once succesfully connected, send whatever info you were looking for to a central server for coordination and processing.

Depending on your storage needs, the "central" server could even be one of your standing boxes...

Also, if you want to tweak the range at which the AP is "discoverable", so that you can control how close a bus is to each stop, you can either modify antenna power or build a script to check signal strength.

Good advice all around. I have so much stuff to try now. :-)
I'll probably put together something that looks very similar to what mmroj put together - in fact this is exactly what I was leaning towards. Then once that's up I will see what I can do with those serial ports - possibly add a gps unit with a cdma modem, or sensors to count passengers as the enter and exit the shuttle...who knows. I'll have to find out what they want.

I'll let you all know how it turns out. Thanks again for the advice - openWRT certainly seems to have an excellent community around it.

Heres what id do. Looks spiffy too big_smile

Hook up a gps, and run gpsd on the wrt's (would have to port it) and then on a webserver, you make a php script that connects to the routers on the gpsd port, gets the gps data, and then (this is the cool part) uses a google maps hack to display the position. Its an awesome effect (one i have actually done.) Loads more info http://stuff.rancidbacon.com/gmaps-standalone/

I am working on a GPSD / TNC based APRS tracker using the Linksys 54g.

At this point I have two serial ports working and GPSD compiled into a flash image based on White Russian RC3.  If you would like to track my program check my blog at www.grennan.com.   

I would like to get GPSD included in the OpenWRT project.  I am willing to maintain the GPSD codebase.  How is the package manager?  Is there a document / FAQ on becoming a package contributer?

My thought (as has already been suggested) is to do a scan and use signal strength. But if you don't need to communicate with the buses otherwise the thing to do would be to put the bustops in client mode, buses in ap, each with a unique ssid. Then you could either cron or run continuously a job which did a scan/scanresults and sent the data to a central server for processing. You might even be able to triangulate a bit if two or more bus stops registered a bus at the same time.

but of course gps is a better solution but perhaps not as much fun smile

- DL

dl wrote:

You might even be able to triangulate a bit if two or more bus stops registered a bus at the same time.

I an KISS kind of guy so if there is a way to do it with less hardware I'm very happy to go that directrion.  So, I like your idea of doing it without a GPS.  So the question is which is more complex,  supporting lots of access points at bus stops, or using a GPS and reporting over a radio instead of WiFi.

Maybe there is another agenda/advantabe.  People could use the WiFi at all the bus stops?

Mark

frogzoo wrote:

0xc0de,
I'd very much like to use your port. There's a HowTo explaining the packaging process here: http://wiki.openwrt.org/BuildingPackagesHowTo

No problem.  All my work, code, documentation and HowTo's even if they are just information on where to download stuff from will be avaible at my web site.  www.grennan.com.

My HAM friends are watch as I get the work done. Some are helping with hardware stuff like the best way to power the WRT so the "Car Power" can't kill it. (Battary backup?)  Others are working on Docs.

Anyway, the project is just geting started but I do plan to have a working units and where/how to get the code my spring.  The coding should be done my January.

mark

The discussion might have continued from here.