We used Google Maps in Javascript to interface with the Beaglebone Black and display our GPS information.

We used Google Maps in Javascript to interface with the Beaglebone Black and display our GPS information.

−

Robert started work on this, first using Dr. Yoder's Boneserver script to create a simple server. A new webpage was added that just had map on it.

+

Robert worked on the webpage, first using Dr. Yoder's Boneserver script to create a simple server. A new webpage was added that just had map on it.

+

Google provides free documentation for their API, and it turns out it's fairly straight forward to use. One of the many features that Google offers with

Google provides free documentation for their API, and it turns out it's fairly straight forward to use. One of the many features that Google offers with

−

this API is the ability to draw on the map, such as placing markers and drawing lines. By using the marker class in conjunction with actionlisteners, I was able to create a button that would place a marker on coordinates specified by the user. The next step will be to have a script that will read from a file and place markers or lines on the map given a time range.

+

this API is the ability to draw on the map, such as placing markers and drawing lines. By using the marker class in conjunction with actionlisteners, we were able to create a button that would place a marker on coordinates specified by the user.

+

+

This was only a proof of concept. The ability to place arbitrary markers was not left in, but the code used to create these markers was incorporated into creating paths. To test this, we would feed live data from the GPS-tracker to the frontend webpage. We were able to see our position in real time. After this functionality was added, the ability for the user to interact with our system came next. A time-range functionality was added, which allowed the user to specify over what time period he or she would like to see the position of the Bone. Lastly, we added the ability for the user to choose whether they wanted to be in live mode or search mode with the use of radio buttons.

Executive Summary

Chris Hopwood and Robert Fendricks will be working on a way to interface the Beaglebone Black with a GPS tracker using UART. We plan on using this data to track the Bone's location on a map via a web interface.

Packaging

The GPS, battery, and wifi dongle are the only components needed outside of the beaglebone. We would make a small cape for the GPS and a charging circuit for a lithium battery to power the system. The board and cape would go into a project box, with an antenna protruding for the GPS.

According to [ 50.995484] 481a8000.serial: ttyO4 at MMIO 0x481a8000 (irq = 61) is a OMAP UART4 our port is mapped to ttyO4.

To test if the GPS is connected correctly, run:

root@beaglebone# screen /dev/ttyO4 9200

replacing ttyO4 with whatever device dmesg reported earlier.

To disconnect from the screen session correctly, press <ctrl>+<shift>+<:>, then type "quit" and hit <enter>

Installing pyserial

First, install pip, python's package manager:

root@beaglebone# opkg install python-pip

After that finishes, downgrade pip using easy_install (which should be installed now) because the latest pip uses ssl, and complains about certificates.

root@beaglebone# easy_install pip=1.2.1

Now instal pyserial

root@beaglebone# pip install pyserial

pyserial should now be installed! Load it in python by doing:

import serial

Creating the Database

First, install sqlite3 on your beaglebone if you haven't already.

cd to the project's ./bin directory and run ./make_db. This creates a sqlite3 database in the project's ./var directory.

Starting the Tracker

To start up the tracker, first run ./webpage/MapServer.js, then run ./bin/gps_tracker.py. It should now be serving a webpage on port 8080!

User Instructions

The user instructions are based off of the assumption that you have already followed the installation instructions and have ran into no issues.

Browse to the web interface hosted by your beagle on port 8080. From here, you should be able to see a map centered on Rose-Hulman. At the top you will see two modes, live and search. Selecting live will let you see what GPS data you're receiving in realtime. If no satelites have been acquired or a fix hasn't been established, no data will be displayed. In search mode, new data acquired from the GPS won't be shown. Instead, you can specify a time range you'd like to display on the map. By setting the Start Time, the End time, and then hitting go, you can display any GPS data acquired during this time.

Whether you're in live mode or search mode, the time of the most recently plotted information will be displayed just above the map.

The color of the path changes depending on the Horizontal Dilution of Precision (HDP) received from the GPS tracker. Green indicates a good HDP, red indicates a less optimal HDP.

Highlights

Our project is able to track its position and recall the path later. Once the beaglebone is connected to a computer (wirelessly or by other means), it is able to serve up a webpage, where the user can either view the position with live updates or search for past locations the device was at.

Check out this video to see a quick demonstration of the GPS tracker in action. It is fairly raw and unedited, so we apologize for the lack of clarity.

Theory of Operation

We broke the project into three major parts: A python back-end, a Javascript server, and a Javascript client. The python back-end reads from the GPS tracker through UART then processes the data, stores it, then sends it to the JS Server when requested. The JS server acts as a middle man between the Python side and the client side. The server also serves the webpage to the user when they try to connect to the interface. The JS Client handles displaying information and sending user requests to the server.

Within the Python Backend, there are three processes, one handling the GPS serial connection, one listening for incoming messages from the server, and one handling search requests from the server. These threads share state through a SQL database and a semaphore controlling access to it.

Serial Thread

The serial thread reads data from the GPS, parses the important fields from it, and stores the results into a SQL database. It also checks if theh application is running in "live" mode, and if so, emits the latest info to the server.

Settings Handler

This thread manages updates to settings in the software. It sets up several callbacks, and waits for messages from the server. Currently, there are only two messages, "mode", which sets whether it is operating "live" or by "search", and "time_query", which stores in the SQL database that a time_query is pending along with its start and end times.

Search Handler

The search handler checks the SQL database for pending queries, executes them, and emits the results to the server.

JavaScript Server

As mentioned before, this acts as the middle-man between the backend and frontend. It uses SocketIO to listen for emissions from one side and then broadcasts the data to the other side.

Webpage Frontend

Javascript is used to create the majority of the webpage (Google Maps) and to listen for user input. Any user commands, such as a search request or a request to switch to live mode, are emitted to the JavaScript server. Further, the JS frontend is also listening for emissions from the server. These emissions are usually plot requests.

Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.

Also list here what doesn't work yet and when you think it will be finished and who is finishing it.

Python Backend

Chris worked on the python side of the program. This included logging data, parsing messages from the GPS, and interfacing with Robert's server.

Google Maps Webpage

We used Google Maps in Javascript to interface with the Beaglebone Black and display our GPS information.

Robert worked on the webpage, first using Dr. Yoder's Boneserver script to create a simple server. A new webpage was added that just had map on it.

Google provides free documentation for their API, and it turns out it's fairly straight forward to use. One of the many features that Google offers with
this API is the ability to draw on the map, such as placing markers and drawing lines. By using the marker class in conjunction with actionlisteners, we were able to create a button that would place a marker on coordinates specified by the user.

This was only a proof of concept. The ability to place arbitrary markers was not left in, but the code used to create these markers was incorporated into creating paths. To test this, we would feed live data from the GPS-tracker to the frontend webpage. We were able to see our position in real time. After this functionality was added, the ability for the user to interact with our system came next. A time-range functionality was added, which allowed the user to specify over what time period he or she would like to see the position of the Bone. Lastly, we added the ability for the user to choose whether they wanted to be in live mode or search mode with the use of radio buttons.

Ad Hoc Networking

For this project, we felt that being able to connect to the Beaglebone directly to access the web interface would be beneficial. To do this, we looked into setting up an ad-hoc wireless network.

To do this, first make sure that you have a wireless interface installed an configured on the Bone. We used Adafruit's RTL8192CU wireless adapter on our bone.

Once your wireless adapter has been configured, you are now ready to set up the Ad Hoc network. The following commands must be run on both the Beaglebone and the computer you want to connect to the Beaglebone. Note that this will utilize the wireless adapter on your computer, so you won't be able to use it for connecting to the internet. These commands are:

Once these commands have been run on both machines, you now want to assign an IP address to both. The most straight forward way is to use a static IP for both, making sure they are on the same subnetwork. Running the following command on each will accomplish this:

bash# ip addr add <IP address>/<subnet mask> dev <interface>
#e.g.: ip addr add 192.168.5.1/24 dev wlan0
#This should go without saying, but make sure the IP address is different on the two machines

Now you should be able to ping the IP of the opposite machine and get a response. If you get it, you're done! In our experience, it can take a while of pinging before we get a response back. We will have to look into what the cause of this is.

Automated Script

For our project, we compiled these changes into a easy to use script, called "ad-hoc_setup.sh". The script works as follows:

ad-hoc_setup.sh <interface> <IP_Address> <SSID>

This script must be run on both the Bone and the host that you want to add to the ad-hoc network. Keep in mind that the IP_Address must be different (but on the same subnet, /24) and the SSID must be the same.

Future Work

Adding the ability to hover over lines to get data would be a good feature. For example, hovering over a line and seeing that it was tracked at at certain time and being able to see the exact longitude and latitude associated with it would be a nice feature.

Another feature that may be harder is adding algorithms that would analyze the GPS data and attempt to fix it or give a better sense of the accuracy of the reading. While we were using our tracker, we found that it often would stray a few meters from where we actually were, especially if we were moving fast. Given more time, we may have been able to find a way to rectify the accuracy issues.

The UI has plenty of room for improvement as well. More search options could be added, such as by speed or proximity to a location. If the wifi dongle were replaced by a 3G modem, it could be set to send notifications to the operator when the tracker gets near certain locations, or if the tracker isn't near certain locations at schedule times (e.g., if your child isn't at school when they were supposed to).

Conclusions

Working with the Beaglebone to interface with a GPS tracker and then allow a user to view this information was a fun and interesting exercise. We had to work on a wide range of issues from working on the hardware to creating a usable user interface. Luckily the Beaglebone Black as a platform gave us many tools that made this possible and not ridiculously difficult. Through this project, we learned not only more about how the Beaglebone works, but about some non-Beaglebone related topics such as Javascript, HTML, and GPS Standards. Overall, working on this GPS Tracker for the Beaglebone was an interesting and enlightening project.