Introduction: Embed an OEM GPS Into Anything
Building a complete customized system is a lot of work. It normally requires specific knowledge about several components. Even after each component is learned, it still takes a considerable amount of time to put everything together. I first considered trying to build my own GPS receiver, but after taking a look at a paper about GPS and GLONASS theory, I decided against the endeavor as it probably would take half a year.
Fortunately for those of us who are eager to incorporate GPS into our custom projects (I use them in robotics), or just learn more, there are a huge selection of OEM GPS units.
The OEM means that it is meant to be incorporated into other projects and doesn't come with a screen, casing, or any extras. The great thing about the majority of these devices is that they are extremely versatile and easy to hook up.
As usual, I have provided this tutorial in video format as well:
I'll do my best to explain each section in detail as we proceed.
Step 1: Supplies Needed
1. Power around 5v
(3 AA or AAA batteries in series is 4.5V or a 9V with a voltage regulator)
2. If using a 9V - 5v voltage regulator
3. Wire connector to the 9v battery
5. female serial port
6. some wires to attach to the serial port
7. soldering iron
If you have trouble finding a serial port, you can take apart an old device. I tore apart an old digital camera adapter.
The model that I will be demonstrating how to hook up and use is a Garmin GPS15L. However, these instructions should apply quite well across different models.
It is important when selecting an OEM device to pay close attention to the output format of the unit. The GPS15L outputs based on RS232 level serial where as the Parallax Gps unit outputs at TTL levels. This means the Parallax model won't work the way we are hooking this unit up. TTL levels are generally used for integrated circuit communication. So the Parallax unit would be better suited if you wanted to have it connect right to a micro controller and not to your PC.
Step 2: Hooking It Up
Actually hooking up the unit is pretty simple. If you are using a voltage regulator, make sure to connect the ground to the negative terminals of the battery, serial port, and GPS. You can use any type of power source you want as long as you provide it within the range provided in the manufacturers manual. (GPS15L 3.3 - 5.4VDC)
The USB port outputs 5.05V normally, so that is also an option.
I originally had a broken fiber optic light that took 3 AA batteries. One AA or AAA battery is 1.5 volts. The fiber optic light had the batteries connected in series, so the actual output was 3x1.5 = 4.5volts. I originally used the fiber optic lights power source cut out and put in the Tupperware container with the GPS unit. The only difference is that there was no voltage regulator. I just hooked the grounds together and directly soldered the wires.
Step 3: Testing on Linux
Comm port access
Before you are able to do anything with your GPS unit on Linux, you will probably need to make sure to grant read and write access to the port you will be testing with. Usually the serial ports are in /dev/ttys0, /dev/ttys1, ...etc
If you are using a serial to usb adapter, you may be able to find it at /dev/ttyUSB
Out of all of the applications that I initially tried to use for serial/parallel port examination on Linux, the easiest that I found to use was "minicom". This application is hit and miss if it is pre-installed or not depending on the distribution you use. Ubuntu 8 didn't come with it pre-installed, but as you can see from the screen shots, it only takes a few minutes to get it installed and working.
The first thing you need to do with minicom is configure it to use the correct parameters. You can configure the application by using the command line switch -s
Also when you are running minicom, you can access the menu by pressing "ctrl" and "a" and then pressing "z"
Serial to USB Adapter
The adapter that I currently use, I built myself. However, I would reccomend to purchase an adapter based on the FTDI series of chips. FTDI offers excellent driver support across all platforms! Sparkfun offers a few pre-assembled solutions. They also have a great tutorial on using the RS232RL chip with Eagle in order to make your own.
Step 4: Testing on Windows
In order to test things like this on Windows I always use Hyperterminal. It comes installed by default most of the time. I think I had to install it from add/remove programs once on a system running Windows Server.
The initial settings that you will need to configure Hyperterminal with are normally located in the manufacturers manual. For the GPS15L, the default baud rate is 4800bps.
I have included a screen shot of the serial to usb adapter that I used with my robotics gps project. It should be mentioned that this was done on a Windows 2000 machine. The driver support for this cable is rather limited. See the previous step for the adapter I reccomend.
Step 5: Understanding the Output
The GPS15L is able to output in either NMEA 0183 v2 or NMEA 0183 v3 sentences. NMEA 0183 is just a fancy name for saying that the unit outputs text sentences in a certain format. This is the format that is pretty much universal between GPS units for output of the data. Thankfully, the manual for the GPS15L/H describes each of these sentences in detail.
When you first start up the 15L it outputs a whole bunch of different sentences. In the robotics application I used this for, I turned off every other sentence except for the Recommended Minimum Specific GPS/TRANSIT Data (RMC). The following is an example of this sentence.
The sentence contains longitude, latitude, speed over ground, course over ground, and much more helpful information. Be aware that if you disable all of the sentences except RMC, when you go to use the unit with non-custom software, some of the features may depend on the other sentences. I'll next show you how to modify the settings on the 15L/H.
Step 6: Modifying GPS Settings
Assuming that you were able to successfully test the unit using Minicom or Hyperterminal, you should be able to send commands to it as well. It you look in the product manual, there is a section called "GPS 15H and 15L Software Interface". This section describes all of the sentences that you can send back to the GPS unit in order to configure it. It is really simple. All you have to do is type out one of the program sentences.
For example, in Hyperterminal you could type something like:
would disable the GPRMC sentence.
You can also write all of the commands you want executed in a text file, then have hyperterminal "type" that file to the GPS unit for you.
Step 7: Programming
The real beauty of an OEM unit comes out when you decide to create custom software for it. I have to confess that I have a decent amount of programming experience. It certainly isn't trivial to write a serial buffer in order to read data into a custom application.
If you don't want to write custom software for the unit, then I would highly recommend the program gpsDrive for Linux. It will work directly out of the box with anything that is outputting NMEA 0183 sentences.
If you do want to write custom software, then you are in luck. I have attached a class that I wrote in Java that can send and receive data to the serial port. It should be mentioned that Java does not come by default with the classes needed to support serial communication. For the class that I have attached, I am making use of the open source library RXTX.
If you are skeptical and would like to see the unit and code in action, you can head over to my website and check out the video of the autonomous robot navigation project. I also have the complete source code available that was used to navigate the robot.
Most importantly, have fun with your GPS!