TinyGPS++ is being really inconsistent. Using an Arduino UNO & U-blox GPS.

Hey Everyone, I'm running an Arduino UNO with a U-blox-CAM-M8Q-Breakout Multi GNSS Modul GPS, using the TinyGPS++ library. Compiling the "DeviceExample" example, I'm getting very inconsistent results. Sometimes, I'll get my correct coordinates, date and time, but other times I won't get anything. Sometimes, I'll get a few pings of information, then it will all go garbled. Other times I just get garbled for the entire time.

^^^When the GPS works (gives me correct coords and time) however,for only 3 pings. and then just garbled junk^^^

^^^The GPS not working at all. Just garbled junk^^^

^^^I got an INVALD in place of Location and time here^^^

I'm not sure what the problem is. Sometimes it works, and other times It doesn't. I've kept everything consistent on my end. As far as being in the same location, etc.

Please post your code and output properly, using code and quote tags, as described in the post "How to use the forum" at the head of every forum topic.

For a GPS module to work properly, you must be outside, with a clear view of the sky.

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
/*
   This sample sketch demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) 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).
*/
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

void setup()
{
  Serial.begin(115200);
  ss.begin(GPSBaud);

  Serial.println(F("DeviceExample.ino"));
  Serial.println(F("A simple demonstration of TinyGPS++ with an attached GPS module"));
  Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
  Serial.println(F("by Mikal Hart"));
  Serial.println();
}

void loop()
{
  // This sketch displays information every time a new sentence is correctly encoded.
  while (ss.available() > 0)
    if (gps.encode(ss.read()))
      displayInfo();

  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
    Serial.println(F("No GPS detected: check wiring."));
    while(true);
  }
}

void displayInfo()
{
  Serial.print(F("Location: ")); 
  if (gps.location.isValid())
  {
    Serial.print(gps.location.lat(), 6);
    Serial.print(F(","));
    Serial.print(gps.location.lng(), 6);
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F("  Date/Time: "));
  if (gps.date.isValid())
  {
    Serial.print(gps.date.month());
    Serial.print(F("/"));
    Serial.print(gps.date.day());
    Serial.print(F("/"));
    Serial.print(gps.date.year());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F(" "));
  if (gps.time.isValid())
  {
    if (gps.time.hour() < 10) Serial.print(F("0"));
    Serial.print(gps.time.hour());
    Serial.print(F(":"));
    if (gps.time.minute() < 10) Serial.print(F("0"));
    Serial.print(gps.time.minute());
    Serial.print(F(":"));
    if (gps.time.second() < 10) Serial.print(F("0"));
    Serial.print(gps.time.second());
    Serial.print(F("."));
    if (gps.time.centisecond() < 10) Serial.print(F("0"));
    Serial.print(gps.time.centisecond());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.println();
}

Here's my code. All of tests were conducted outside under a blue clear sky.

Please edit your post to use code tags instead of quote tags.

jremington:
Please edit your post to use code tags instead of quote tags.

Done!

TinyGPS++ is being really inconsistent.

I doubt that, its a very reliable library, never had a problem with it myself.

Is the example you posted completly unchanged ?

Is the GPS module you are using (hint! you did not provide a link) suitable for connecting to a 5V Arduino, the Ublox GPSs are 3.3V devices ?

srnet:
I doubt that, its a very reliable library, never had a problem with it myself.

Is the example you posted completly unchanged ?

Is the GPS module you are using (hint! you did not provide a link) suitable for connecting to a 5V Arduino, the Ublox GPSs are 3.3V devices ?

The only thing I changed was the baud rate. The default baud rate for the example is 4800. The GPS unit I'm using is 9600 baud rate. The GPS is connected to the 3.3V port on the Arduino.

This is the GPS I'm using:

Did you connect the Arduino 5V serial TX pin to RX on the GPS unit?

If so, that will create problems, if not permanently damage the Arduino and/or the GPS unit.

If you look at your first image, you will note that the Serial.print() output to the Serial monitor is corrupted some time before the TinyGPS++ library functions are first used.

SoftwareSerial can corrupt Serial.print() output in some circumstances, so you need to be sure the serial data coming from the 3.3V GPS is of the right level to be read reliably by a 5V Arduino.

jremington:
Did you connect the Arduino 5V serial TX pin to RX on the GPS unit?

If so, that will create problems, if not permanently damage the Arduino and/or the GPS unit.

The Arduino is connected to the GPS as follows:

Arduino Uno -----> GPS

3.3v -----> VCC
GND -----> GND
Digital Port 4 -----> TX/MISO
Digital Port 3 -----> RX/MUSI
SCL ------> SCL/SCK
SDA ------> SDA/CS

If any of those connections are wrong, let me know :slight_smile:

srnet:
If you look at your first image, you will note that the Serial.print() output to the Serial monitor is corrupted some time before the TinyGPS++ library functions are first used.

SoftwareSerial can corrupt Serial.print() output in some circumstances, so you need to be sure the serial data coming from the 3.3V GPS is of the right level to be read reliably by a 5V Arduino.

How would I go about doing that?

If any of those connections are wrong, let me know

Any 5V output connected to a 3.3V device input can damage both devices. At the very least expect malfunctions.

That is the problem.

The solution is to use 5V to 3.3V level shifters for such connections, or use a 3.3V Arduino.

jremington:
Any 5V output connected to a 3.3V device input can damage both devices. At the very least expect malfunctions.

That is the problem.

The solution is to use 5V to 3.3V level shifters for such connections, or use a 3.3V Arduino.

I'm confused. So is there no difference between the 5v port and the 3.3v port on my Arduino?

Some background inforamtion here, found by a Google search of 'Arduino connecting 5V and 3.3V devices'

You can use 74HC4050 or at least voltage divider for a TX line from UNO comes in RX pin of GPS to level shift signal from 5V UNO to 3.3V. There is no need to use anything from your 3.3V GPS TX pin to UNO RX pin, as it is 3.3V is acceptable as HIGH from UNO.

The maximum speed also depend on crystal frequency which is in of UNO 115200bps at 16MHz.

It is way simpler to use PRO mini at 3.3V, or with a bit of iron skills, you can replace voltage regulator on UNO with 3.3V one, if the device is permanent.

I'm confused. So is there no difference between the 5v port and the 3.3v port on my Arduino?

The digital port pins on a 5V Arduino output 5V. The 3.3V power output is separately produced by a 3.3V regulator on the Arduino board.

So I think either I'm really confused or everyone else is really confused. Everyone on here is saying that my Arduino UNO is a 5v device, and the reason my GPS isn't working is because it's a 3.3v, and the UNO is giving it too much voltage.

However, my UNO has two output pins for power. One for 5v and one for 3.3v. The VCC on my GPS is connected to the 3.3v on my UNO. Correct me if I'm wrong, but doesn't that mean that the UNO is supplying 3.3v to the GPS and not 5v?

5V logic is not 3.3V logic.

You CANNOT CONNECT a 5V data port output pin to a 3.3V data port input pin.

Don't come back to the forum until you have read and understood the links in reply #13 about using logic level shifters. Or have bought a 3.3V Arduino to use with this project.

jremington:
The digital port pins on a 5V Arduino output 5V. The 3.3V power output is separately produced by a 3.3V regulator on the Arduino board.

I didn't see your reply until after I had posted the reply before this one. So what you're saying is that even though the main power supply to the GPS is 3.3v from the Uno, that the digital pins on my UNO (pins 1-13) that I'm using for the RX & TX are all outputting 5v?

Do you have trouble reading?