This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
digispark:tutorials:gps [2014/11/09 21:03] digistump created |
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/Defragster/OLEDPRO | ||
| - | and use the sketch below as an example sketch: | ||
| - | <code arduino> | + | =====Programming:===== |
| - | #include <DigiCDC.h> | + | |
| - | #include <TinyGPS.h> | + | |
| - | + | ||
| - | /* This sample code demonstrates the normal use of a TinyGPS object. | + | |
| - | It requires the use of SoftwareSerial, and assumes that you have a | + | |
| - | 4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx). | + | |
| - | */ | + | |
| - | + | ||
| - | 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 |
| - | { | + | NOTE: You must select the Digispark Pro (16Mhz) (64 byte buffer) for 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> | + | |