User Tools

Site Tools


digispark:tutorials:gps

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
digispark:tutorials:gps [2014/11/09 21:05]
digistump
digispark:tutorials:gps [2016/06/09 12:03] (current)
Line 2: Line 2:
  
 =====Product Description:​===== =====Product Description:​=====
-[[https://​s3.amazonaws.com/​digispark/​images/​m/​gps.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​gps.jpg}}]] +[[https://​s3.amazonaws.com/​digispark/​images/​m/​gps1.JPG|{{https://​s3.amazonaws.com/​digispark/​images/​t/​gps1.JPG}}]] 
-[[https://​s3.amazonaws.com/​digispark/​images/​m/​gps.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​gps.jpg}}]]+[[https://​s3.amazonaws.com/​digispark/​images/​m/​gps6.JPG|{{https://​s3.amazonaws.com/​digispark/​images/​t/​gps6.JPG}}]]
  
 This is an unassembled kit and requires basic soldering. This is designed for use with the Digispark development board, which is not included. This is an unassembled kit and requires basic soldering. This is designed for use with the Digispark development board, which is not included.
Line 30: Line 30:
 =====Assembly:​===== =====Assembly:​=====
  
 +**NOTE:** Before you start: If you have a multimeter check for shorts between the GND pin hole and the other pin holes - if you find any please send us an email at support at digistump dot com and we will replace the board.
  
 +[[https://​s3.amazonaws.com/​digispark/​images/​m/​gps1.JPG|{{https://​s3.amazonaws.com/​digispark/​images/​t/​gps1.JPG}}]]
  
-[[https://​s3.amazonaws.com/​digispark/​images/​m/​gps.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​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. 
 + 
 +[[https://​s3.amazonaws.com/​digispark/​images/​m/​gps2.JPG|{{https://​s3.amazonaws.com/​digispark/​images/​t/​gps2.JPG}}]]
  
  
Line 41: Line 45:
 **Note:** If you are using stackable headers, use them here instead of the standard male headers. **Note:** If you are using stackable headers, use them here instead of the standard male headers.
  
-[[https://​s3.amazonaws.com/​digispark/​images/​m/​gps.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​gps.jpg}}]]+[[https://​s3.amazonaws.com/​digispark/​images/​m/​gps3.JPG|{{https://​s3.amazonaws.com/​digispark/​images/​t/​gps3.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. 
- 
-[[https://​s3.amazonaws.com/​digispark/​images/​m/​gps.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​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. 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.
  
-[[https://​s3.amazonaws.com/​digispark/​images/​m/​gps.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​gps.jpg}}]]+[[https://​s3.amazonaws.com/​digispark/​images/​m/​gps4.JPG|{{https://​s3.amazonaws.com/​digispark/​images/​t/​gps4.JPG}}]]
  
 +[[https://​s3.amazonaws.com/​digispark/​images/​m/​gps5.JPG|{{https://​s3.amazonaws.com/​digispark/​images/​t/​gps5.JPG}}]]
  
 +Optionally - attach the antenna to the board by applying a blob of solder to each solder point and the antenna case. Don't apply too much heat or you may damage the antenna.
  
-=====Programming:=====+[[https://​s3.amazonaws.com/​digispark/​images/​m/​gps6.JPG|{{https://​s3.amazonaws.com/​digispark/​images/​t/​gps6.JPG}}]]
  
-Grab the library at: https://​github.com/​mikalhart/​TinyGPS 
-and use the sketch below as an example sketch: 
  
-<code arduino>​ +=====Programming:​=====
-#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 +NOTE: The first time you use the GPS module it may take 5 minutes or more, near a window or outside, to acquire a fix and produce ​data.
-  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) +A GPS example can be found in the newest Digistump IDE Release - 1.5.8A or higher - under File->​Examples->​Digispark_Examples->​GPS 
-  { +NOTEYou must select the Digispark Pro (16Mhz) (64 byte bufferfor the example to work!
-    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 ** +
-+
-</​code>​+
digispark/tutorials/gps.1415595915.txt.gz · Last modified: 2014/11/09 21:05 by digistump