GPS - strange error

Hi, I got my GPS to run a bit better, yet still thats quite weird... has anyone seen such an output before?











All those strange things like Â, Ö and so on look quite strange. There are no soldered parts in this set up but i used a clamp (?) to attach the cables from the gps to the breadboard...

Any ideas if there is any help for me?

The bytes are obviously corrupted (the first two always get dropped?), but it's hard to say if that is a result of some noise source or something else, it's hard to say.

Is this a software serial implementation of some flavor?

Do you have a good ground connection between the two?


I’m using

//Created August 15 2006
//Heather Dewey-Hagborg
//reworked to GPS reader
//Dirk, december 2006

#include <ctype.h>
#include <string.h>

#define bit9600Delay 84
#define halfBit9600Delay 42
#define bit4800Delay 188
#define halfBit4800Delay 94

byte rx = 6;
byte tx = 7;
byte SWval;
char dataformat[7] = "$GPRMC";
char messageline[80] = "";
int i= 0;

void setup() {
  digitalWrite(13,HIGH); //turn on debugging LED
  SWprint('h');  //debugging hello
  SWprint(10); //carriage return

void SWprint(int data)
  byte mask;
  for (mask = 0x01; mask>0; mask <<= 1) {
    if (data & mask){ // choose bit
      digitalWrite(tx,HIGH); // send 1
      digitalWrite(tx,LOW); // send 0
  //stop bit
  digitalWrite(tx, HIGH);

char SWread()
  byte val = 0;
  while (digitalRead(rx));
  //wait for start bit
  if (digitalRead(rx) == LOW) {
    for (int offset = 0; offset < 8; offset++) {
      val |= digitalRead(rx) << offset;
    //wait for stop bit + extra
    return val;
void char2string()
  i = 0;
  messageline[0] = SWread();
  if (messageline[0] == 36) //string starts with $
    messageline[i] = SWread();
    while(messageline[i] != 13 & i<80) //carriage return or max size
      messageline[i] = SWread();
    messageline[i+1] = 0; //make end to string
void loop()
 //only print string with the right dataformat
  if (strncmp(messageline, dataformat, 6) == 0 & i>4)
    for (int i=0;i<strlen(messageline);i++)
      Serial.print(messageline[i], BYTE);

  //Serial.print(SWread(),BYTE); //use this to get all GPS output, comment out from char2string till here


to read the code

what do you mean with your last sentence?

That looks like the (old) standard software serial library. Try NewSoftSerial which seems to perform noticeably better; there's also a GPS library which you may find useful.

Ground connection - you know, connect the GPS GND to the Arduino GND? strangely enough, a serial link with only TX and RX (but not ground) connected can sometimes work, although certainly not well.