User Tools

Site Tools


digispark:tutorials:gps

This is an old revision of the document!


Pro GPS Shield Kit Tutorial

Product Description:

gps.jpg gps.jpg

This is an unassembled kit and requires basic soldering. This is designed for use with the Digispark development board, which is not included.

Parts:

Part Quantity Identification
Pro Combo PCB1
Serial GPS Module 1
1x40pin male 0.1“ pitch header 25 pins worth

Resistor Values: For more information on how to identify the value of the resistors we recommend these sites: A nice simple resistor calculator: http://www.ealnet.com/m-eal/resistor/resistor.htm A comprehensive article on identification: http://www.diyaudioandvideo.com/Electronics/Color/

Soldering: If you are new to soldering we recommend the following tutorials: Soldering Basics (http://www.sparkfun.com/tutorials/106) and Soldering Crash Course from the folks at Sparkfun (http://www.sparkfun.com/tutorials/354). How to solder from the Curious Inventor: http://store.curiousinventor.com/guides/How_to_Solder

Adafruit has this excellent guide that starts with the tools needed and then shows detailed pictures, including some of the common problems that beginners experience (http://learn.adafruit.com/adafruit-guide-excellent-soldering)

We assume for these assembly instructions that you know the basics of thru-hole soldering. If you don't check out the links above, these boards are very easy to solder - we promise!

Assembly:

gps.jpg

Cut two lengths of male headers each 9 pins long and one 3 pins long. Insert into corresponding positions (on the bottom of the board) and solder each pin.

Tip: Inserting the headers into a breadboard and then placing the board on top can make this process easier.

Note: If you are using stackable headers, use them here instead of the standard male headers.

gps.jpg

Insert a strip of 4 header pins into the top of the board in the four holes labeled for the GPS module. Solder on the bottom of the board.

gps.jpg

Insert the GPS module into the front of the board onto the 4 pins. Solder the pins to the module, optionally snip off the excess.

gps.jpg

Programming:

Grab the library at: https://github.com/mikalhart/TinyGPS and use the sketch below as an example sketch:

#include <DigiCDC.h>
#include <TinyGPS.h>
 
 
TinyGPS gps;
 
 
void setup()
{
  SerialUSB.begin();
  Serial.begin(9600); //this is the connection to the GPS
}
 
void loop()
{
  bool newData = false;
  unsigned long chars;
  unsigned short sentences, failed;
 
  // For one second we parse GPS data and report some key values
  for (unsigned long start = millis(); millis() - start < 1000;)
  {
    while (Serial.available())
    {
      char c = Serial.read();
      // SerialUSB.write(c); // uncomment this line if you want to see the GPS data flowing
      if (gps.encode(c)) // Did a new valid sentence come in?
        newData = true;
    }
  }
 
  if (newData)
  {
    float flat, flon;
    unsigned long age;
    gps.f_get_position(&flat, &flon, &age);
    SerialUSB.print("LAT=");
    SerialUSB.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    SerialUSB.print(" LON=");
    SerialUSB.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    SerialUSB.print(" SAT=");
    SerialUSB.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
    SerialUSB.print(" PREC=");
    SerialUSB.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
  }
 
  gps.stats(&chars, &sentences, &failed);
  SerialUSB.print(" CHARS=");
  SerialUSB.print(chars);
  SerialUSB.print(" SENTENCES=");
  SerialUSB.print(sentences);
  SerialUSB.print(" CSUM ERR=");
  SerialUSB.println(failed);
  if (chars == 0)
    SerialUSB.println("Error"); //** No characters received from GPS: check wiring **
}
digispark/tutorials/gps.1415595915.txt.gz · Last modified: 2014/11/09 21:05 by digistump