I connected my GPS UP501 from Fastrax to my Arduino Leonardo and used the following code:
// Test code for Adafruit GPS modules using MTK driver
// such as UP501 Breadboard-friendly 66 channel GPS module w/10 Hz updates [MTK3329] : ID 660 : $49.95 : Adafruit Industries, Unique & fun DIY electronics and kits
// Pick one up today at the Adafruit electronics shop
// and help support open source hardware & software! -ada
// #if (ARDUINO >= 100)
#define rxPin 2
#define txPin 3
#include <SoftwareSerial.h>
SoftwareSerial mySerial(rxPin, txPin);
// #else
// If you're using Arduino IDE v23 or earlier, you'll
// need to install NewSoftSerial
//#include <NewSoftSerial.h>
//NewSoftSerial mySerial(2, 3);
// #endif
// Connect the GPS Power pin to 3.3V
// Connect the GPS Ground pin to ground
// Connect the GPS VBAT pin to 3.3V if no battery is used
// Connect the GPS TX (transmit) pin to Digital 2
// Connect the GPS RX (receive) pin to Digital 3
// For 3.3V only modules such as the UP501, connect a 10K
// resistor between digital 3 and GPS RX and a 10K resistor
// from GPS RX to ground.
// different commands to set the update rate from once a second (1 Hz) to 10 times a second (10Hz)
#define PMTK_SET_NMEA_UPDATE_1HZ "$PMTK220,10001F"
#define PMTK_SET_NMEA_UPDATE_5HZ "$PMTK220,2002C"
#define PMTK_SET_NMEA_UPDATE_10HZ "$PMTK220,100*2F"
// turn on only the second sentence (GPRMC)
#define PMTK_SET_NMEA_OUTPUT_RMCONLY "$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,029"
// turn on ALL THE DATA
#define PMTK_SET_NMEA_OUTPUT_ALLDATA "$PMTK314,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,028"
// to generate your own sentences, check out the MTK command datasheet and use a checksum calculator
// such as the awesome NMEA MTK checksum calculator
void setup()
{
Serial.begin(57600);
while(!Serial)
{//This waits for the serial port of the Leonardo to connect.
}
Serial.println("Test for Leonardo and Computer Communication\n");
// 9600 NMEA is the default baud rate
mySerial.begin(9600);
// uncomment this line to turn on only the "minimum recommended" data for high update rates!
//mySerial.println(PMTK_SET_NMEA_OUTPUT_RMCONLY);
// uncomment this line to turn on all the available data - for 9600 baud you'll want 1 Hz rate
mySerial.println(PMTK_SET_NMEA_OUTPUT_ALLDATA);
// Set the update rate
// 1 Hz update rate
mySerial.println(PMTK_SET_NMEA_UPDATE_1HZ);
// 5 Hz update rate- for 9600 baud you'll have to set the output to RMC only (see above)
//mySerial.println(PMTK_SET_NMEA_UPDATE_5HZ);
// 10 Hz update rate - for 9600 baud you'll have to set the output to RMC only (see above)
//mySerial.println(PMTK_SET_NMEA_UPDATE_10HZ);
}
void loop() // run over and over again
{
if (mySerial.available()) {
Serial.print((char)mySerial.read());
}
if (Serial.available()) {
mySerial.print((char)Serial.read());
}
}
Unfortunately all I see is the Test for Leonardo and Computer Communication message and then it stops transmitting and the transmit light does not appear. I was wondering if anyone had any advice. (Some additional information I am using an Arduino Leonardo us the Mac OS X and used the wiring diagram from adafruit.)