Linksprite GPS with the Uno and Mega2560

Apologies if this is the wrong forum but I have a Linksprite GPS which works perfectly with the Uno but refuses to talk to the Mega2560.
Is this because of the differences in voltage levels used by the serial ports of the Uno and the 2560?

Uno and Mega both 0/5V outputs on the serial ports.

You probably used SoftwareSerial on the UNO... but I don't see your code, so I don't know for sure. Hint, hint. Be sure to read the "How to use this forum".

Not all pins can be used for SoftwareSerial, but on the Mega you might as well use a real HardwareSerial instead: Serial1, Serial2 or Serial3. Again, showing us your code would tell us what you tried.

Cheers,
/dev

I’m using the standard example.
Having said that many of the instances of this example point to pins 4 and 3 as you can see from the commented section. I think that is for a different version of the board.

My board, the V2B, has jumpers for pins 2,3
again many instances say connect rx to mtx and tx to mrx but that doesn’t work for me.

Suffice to say that I’m still on the learning curve for serial port use.

The code below is fine on the UNO, but can’t communicate with the 2560.

#include <SoftwareSerial.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;
SoftwareSerial ss(2, 3);

static void smartdelay(unsigned long ms);
static void print_float(float val, float invalid, int len, int prec);
static void print_int(unsigned long val, unsigned long invalid, int len);
static void print_date(TinyGPS &gps);
static void print_str(const char *str, int len);

void setup()
{
Serial.begin(9600);

Serial.print(“Testing TinyGPS library v. “); Serial.println(TinyGPS::library_version());
Serial.println(“by Mikal Hart”);
Serial.println();
Serial.println(“Sats HDOP Latitude Longitude Fix Date Time Date Alt Course Speed Card Distance Course Card Chars Sentences Checksum”);
Serial.println(” (deg) (deg) Age Age (m) — from GPS ---- ---- to London ---- RX RX Fail”);
Serial.println("-------------------------------------------------------------------------------------------------------------------------------------");

ss.begin(9600);

pinMode(6, OUTPUT);
digitalWrite(6, LOW);

}

void loop()
{
float flat, flon;
unsigned long age, date, time, chars = 0;
unsigned short sentences = 0, failed = 0;
static const double LONDON_LAT = 51.508131, LONDON_LON = -0.128002;

print_int(gps.satellites(), TinyGPS::GPS_INVALID_SATELLITES, 5);
print_int(gps.hdop(), TinyGPS::GPS_INVALID_HDOP, 5);
gps.f_get_position(&flat, &flon, &age);
print_float(flat, TinyGPS::GPS_INVALID_F_ANGLE, 10, 6);
print_float(flon, TinyGPS::GPS_INVALID_F_ANGLE, 11, 6);
print_int(age, TinyGPS::GPS_INVALID_AGE, 5);
print_date(gps);
print_float(gps.f_altitude(), TinyGPS::GPS_INVALID_F_ALTITUDE, 7, 2);
print_float(gps.f_course(), TinyGPS::GPS_INVALID_F_ANGLE, 7, 2);
print_float(gps.f_speed_kmph(), TinyGPS::GPS_INVALID_F_SPEED, 6, 2);
print_str(gps.f_course() == TinyGPS::GPS_INVALID_F_ANGLE ? "*** " : TinyGPS::cardinal(gps.f_course()), 6);
print_int(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0xFFFFFFFF : (unsigned long)TinyGPS::distance_between(flat, flon, LONDON_LAT, LONDON_LON) / 1000, 0xFFFFFFFF, 9);
print_float(flat == TinyGPS::GPS_INVALID_F_ANGLE ? TinyGPS::GPS_INVALID_F_ANGLE : TinyGPS::course_to(flat, flon, LONDON_LAT, LONDON_LON), TinyGPS::GPS_INVALID_F_ANGLE, 7, 2);
print_str(flat == TinyGPS::GPS_INVALID_F_ANGLE ? "*** " : TinyGPS::cardinal(TinyGPS::course_to(flat, flon, LONDON_LAT, LONDON_LON)), 6);

gps.stats(&chars, &sentences, &failed);
print_int(chars, 0xFFFFFFFF, 6);
print_int(sentences, 0xFFFFFFFF, 10);
print_int(failed, 0xFFFFFFFF, 9);
Serial.println();

smartdelay(1000);
}

…further functions

Remember this from "How to use this forum"?

7. If you are posting code or error messages, use "code" tags

Are you stacking it like a shield, or are you running wires between the Arduino and the Linksprite?

I see the V2B can jumper the GPS TX to any of { D0, D1, D2}, and the GPS RX to any of { D0, D1, D3 }.

This allows you to use Serial for the GPS device, but that would prevent using it for debug/info messages to the PC.

The example program is using SoftwareSerial on pins 2 (RX) and 3 (TX). For the UNO, this means you should jumper the GPS TX to D2 and the GPS RX to D3, as shown on their wiki.

Unfortunately, the Mega does not support SoftwareSerial on pins 2 and 3. Instead, you will have to choose a pair of pins from the list here, and connect them with a wire on the shield, instead of using the jumper block.

Cheers,
/dev

Yes it was beginning to dawn on me that stacking it on the Mega wasn't going to work. Time to dig out a breadboard. Thanks for your help.

You can still stack them. You just can't use those jumper blocks.

Cheers,
/dev

Ok, so pardon my ignorance here but how would I jump from the GPS board to presumably Pins 19,18 for Serial 1 on the mega.
Would I have to link pins 2,3 on the GPS to 19,18 on the Mega or is there a better way?

I'll remember the code tags next time!

Use 2 male-to-female “Dupont” wires to go from the Linksprite RX & TX pins, to the Arduino 18 & 19 sockets:

Linksprite wiring.jpg

Cheers,
/dev

Many thanks, I happen to have some from one of my spending sprees on useful looking electrical items on Amazon. Will let you know how it goes.