This tutorial explains how easy it is to connect a GPS receiver using A-blocks (no soldering required). We use a EM-406A Sirf III receiver but for other GPS device the connections would be very similar.
The EM-406A is delivered with a 6 pin connection cable. It has one gray wire which is pin 6. Starting with the wire from pin 1 we carefully remove the wires from pin 1 to 4 from the connector.
We do not need the wires from pin 5 and 6 so we leave these in the connector.
Next we connect the wires to a wire connecter A-Block. You can also choose to solder them to a small A-Blocks prototype board. The connections should be done like this:
We now connect the A-block to the interface board. We use the NewSoftSerial library to connect it to a different port then D1 so we can output the results to the hardware serial port of the Arduino (which uses the D1 pins).
To process the GPS data we use the tinygps library. For more information about tinygps visit
Arduiniana. Here is the code we use:
#include <NewSoftSerial.h>
#include "TinyGPS.h"
TinyGPS gps;
NewSoftSerial nss(9,8); // The GPS is connected to port D5, so pins 9 and 8 are used
void setup()
{
nss.begin(4800); // Input GPS
Serial.begin(9600); // Output to the Arduino Serial Monitor
Serial.print("Searching...");
}
void loop()
{
long lat, lon;
unsigned long fix_age, time, date, speed, course;
while (nss.available())
{
char c = nss.read();
if (gps.encode(c))
{
// Here we have a valid NMEA message
// retrieves +/- lat/long in 100000ths of a degree
gps.get_position(&lat, &lon, &fix_age);
// We print the latitude, longitude and fix age to the Serial Monitor
Serial.print(lat);
Serial.print(",");
Serial.print(lon);
Serial.print(",");
Serial.println(fix_age);
}
}
}
You need a valid satelite fix so depending on the sensitivity of your GPS you need to be near a window or outside. If you use the EM-406A you can watch the onboard LED to see the status.
If the LED is on it is searching for a signal. If the LED is blinking it has a position fix.