This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
digispark:tutorials:gps [2014/11/10 11:09] 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}}]] |
| - | Sketch below is a work in progress! | ||
| - | Based on: https://www.insidegadgets.com/2013/10/11/playing-around-with-gps-attiny-gps-longlat-logger/ | ||
| - | |||
| - | <code arduino> | ||
| - | #include <DigiCDC.h> | ||
| - | |||
| - | void setup() { | ||
| - | // put your setup code here, to run once: | ||
| - | SerialUSB.begin(); | ||
| - | Serial.begin(9600); | ||
| - | } | ||
| - | |||
| - | |||
| - | char tempBuffer[15]; | ||
| - | |||
| - | |||
| - | void loop() { | ||
| - | // put your main code here, to run repeatedly: | ||
| - | if(Serial.available()){ | ||
| - | char rxData = Serial.read(); | ||
| - | |||
| - | // Start of frame | ||
| - | if (rxData == '$') { | ||
| - | // Read next chars | ||
| - | ReadSerialToComma(); | ||
| - | |||
| - | // Check if GPRMC | ||
| - | if (memcmp(tempBuffer, "GPRMC", 5) == 0) { | ||
| - | ReadSerialToComma(); // Timestamp | ||
| - | //buffer has time right now | ||
| - | SerialUSB.println(tempBuffer); | ||
| - | ReadSerialToComma(); // Validity | ||
| - | |||
| - | // If valid GPS data | ||
| - | if (tempBuffer[0] == 'A') { | ||
| - | |||
| - | ReadSerialToComma(); // Latitude | ||
| - | //buffer has lat right now | ||
| - | SerialUSB.println(tempBuffer); | ||
| - | |||
| - | ReadSerialToComma(); // N or S (ignore | ||
| - | ReadSerialToComma(); // Longitude | ||
| - | //buffer has lon right now | ||
| - | SerialUSB.println(tempBuffer); | ||
| - | | ||
| - | ReadSerialToComma(); // W or E (ignore) | ||
| - | | ||
| - | ReadSerialToComma(); // Speed in knots | ||
| - | //buffer has speed right now | ||
| - | SerialUSB.println(tempBuffer); | ||
| - | | ||
| - | ReadSerialToComma(); // Course made good (ignore) | ||
| - | | ||
| - | ReadSerialToComma(); // Date | ||
| - | //buffer has date right now | ||
| - | SerialUSB.println(tempBuffer); | ||
| - | | ||
| - | SerialUSB.delay(1000); //wait 1 second before fetching again | ||
| - | | ||
| - | |||
| - | | ||
| - | |||
| - | | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | } | ||
| - | } | ||
| - | } | ||
| - | } | ||
| - | SerialUSB.refresh(); | ||
| - | } | ||
| + | =====Programming:===== | ||
| - | byte ReadSerialToComma(void) { | + | 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. |
| - | int x = 0; | + | |
| - | tempBuffer[x] = Serial.read(); | + | |
| - | + | ||
| - | while (tempBuffer[x] != ',') { | + | |
| - | x++; | + | |
| - | tempBuffer[x] = Serial.read(); | + | |
| - | SerialUSB.refresh(); | + | |
| - | } | + | |
| - | x++; | + | A GPS example can be found in the newest Digistump IDE Release - 1.5.8A or higher - under File->Examples->Digispark_Examples->GPS |
| - | tempBuffer[x] = 0; | + | NOTE: You must select the Digispark Pro (16Mhz) (64 byte buffer) for the example to work! |
| - | return x; | + | |
| - | } | + | |
| - | </code> | + | |