Adafruit Ultimate GPS Breakout On the Raspberry Pi NERP: Not Exclusively Raspberry Pi Craig LeMoyne Chicago Electronic Distributors www.chicagodist.com Tutorial excerpts courtesy Adafruit Industries GPS refresher, courtesy Wikipedia: The Global Positioning System (GPS) is a space- based satellite navigation system that provides location and time information in all weather conditions, anywhere on or near the Earth where there is an unobstructed line of sight to four or more GPS satellites. It is maintained by the United States government and is freely accessible to anyone with a GPS receiver. The GPS system became fully operational in 1994. Interesting fact: After Korean Air Lines Flight 007, a Boeing 747 carrying 269 people, was shot down in 1983 after straying into the USSR's prohibited airspace, President Ronald Reagan issued a directive that would make GPS freely available for civilian use, A GPS receiver calculates its position by precisely timing the signals sent by GPS satellites high above the Earth. Each satellite continually transmits messages that include the time the message was transmitted satellite position at time of message transmission The receiver uses the messages it receives to determine the transit time of each message and computes the distance to each satellite using the speed of light. Each of these distances and satellites' locations define a sphere. The receiver is on the surface of each of these spheres when the distances and the satellites' locations are correct. These distances and satellites' locations are used to compute the location of the receiver using the navigation equations.
Bill of Materials Raspberry Pi Model A or B $25 or $35 Adafruit Ultimate GPS: $39 USB TTL (Terminal) Cable: $9 Power supply: $10 External GPS antenna: $15 (optional, but useful) SD card: $10 Setting everything up The easiest way to get the GPS module working is by connecting it to the Raspberry Pi with a USB TTL adaptor Cable. The module can be hooked up via UART as well. First, solder the header pins onto the GPS module. We then connect the TTL cable to the GPS module as follows: Once you plug the USB cable into the Pi, the adapter should show up as /dev/ttyusb0 (though the '0' may be different if you have other ttyusb adapters present). To list the active USB terminal connections: ls /dev/ttyusb* You can confirm the attached USB devices by typing sudo lsusb To check the data coming out of the GPS: sudo cat /dev/ttyusb0 Next, run the following command to install the GPS Daemon and required packages: sudo apt- get install gpsd gpsd- clients python- gps Then we need to tell the GPS Daemon where our module is: sudo gpsd /dev/ttyusb0 - F /var/run/gpsd.sock
Testing it out cgps - s Occasionally, you may find that you need to restart the GPS service to get a fix, use the following command to do so: sudo killall gpsd sudo gpsd /dev/ttyusb0 - F /var/run/gpsd.sock gpxlogger is a tool for logging GPS output. Example: gpxlogger - d - f trip.log" It is easy to take the output and upload it to a site like gpsvisualizer.com and come up with a map like this;
A few things to note about using the Raspberry Pi in a car: Finding a suitable display can be a little tricky. Anything that runs on Composite will have poor resolution. We got around this with a 4.3 NTSC display and large text output. With this combination, CGPS worked pretty well. Here I am at the Skyway McDonalds: As we all know, the Pi needs a good power source. You can run the Pi off a cigarette lighter USB dongle, but these are not all created equal. Make sure it puts out 1 amp of power. If you really want a good solution, check out MausBerry Circuit s Kickstarter project: http://www.kickstarter.com/projects/1312527055/raspberry- pi- car- power- supply- ignition- switch?ref=live The power supply maintains power until the Pi has safely finished the boot- down process and then removes power. The supply is most easily installed by connecting to 3 wires behind your radio: the +12V(car battery), ground and ACC (switched ignition) wires.
Other fun projects: Wardriving with a GPS enabled Kismet server. Wardriving is the practice of driving around scanning for WiFi networks. We can t endorse such activity, but this is a good way to see if your networks are secure. Kismet includes GPS support, and a quick Google search shows a lot of people that have figured this out. Appendix / other fun stuff PiFM, an FM Transmitter Did you know your Pi can be an FM Transmitter? Obviously this can only be used in an anechoic chamber. Assuming you have an RF isolation chamber, all you need is the code in the link below and a 20 cm wire on GPIO pin 4. Check out the tutorial here: http://www.icrobotics.co.uk/wiki/index.php/turning_the_raspberry_pi_into_an_f M_Transmitter Adding a 7 segment clock to your Pi This is also a quick and gratifying project! This helps keep me on time. All you need is the $10 Adafruit 7- segment display and their example code. http://chicagodist.com/blogs/news/8464281- back- to- basics- building- a- 7- segment- display- clock- for- a- raspberry- pi