Trying to connect a Arduino to a GPS using TinyGPSPlus

As part of a larger project I am trying to read and save LAT and LONG values as long variables. So I am trying to get the TinyGPSPlus decoder to work but I cant get the sample code DeviceExample to work. I have tried messing with it and and the hardware is set up exactly as it is stated in the code. I would like to know if you have any idea what the issue could be. Thanks for your time.

The GPS will probably not get a fix indoors.

Do you think it would help the forum to help you if you told us;

What arduino your using ?

What sketch or code you are using ?

Which GPS you are using ?

Which GPS unit? Which Arduino? When you run the example what happens? Do you get anything on the serial monitor? "Doesn't work" tells us nothing useful. The more we know the more we can help.

I get a string of nonsense code

Have you double checked the line speeds?
Do you have an inversion due to RS232 levels?

(You need to provide more details without having to be prompted - we are not mind-readers)

Board: Audino Uno
GPS: Gowoops GPS Module U-blox NEO-6M with 3m Active Antenna for Arduino STM32 51 Single Chip
Microcomputer

code: (Unchanged DeviceExample sample code for TinyGPS++)

#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 = 4800;

// 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();
}

I'm pretty new at this so I'm not sure how to check line speed or if I have an inversion.

From messing around with the code I figured out that my GPS isn't sending full strings so it was suppressing the output. I am right by a window and have been able to get signal here before when I just used a blank program to check if the GPS worked. Is there a reason the GPS would'nt get signal now and would before? Or do you think I have a bad install of TinyGPS?

static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 4800;

I have a Ublox Neo 6M and the default baud rate is 9600. Are the RX and TX pins wired right?

All the Ublox GPSs I have used have all been 9600 baud.

i have tried at both 4600 and 9600 baud. The TX and RX should both be correct. I am using a breadboard but it is a pretty clear connection for both. Should I try going outside with my laptop?

Outside is certainly better. Can You copy and paste a few lines that you are getting from the GPS. That may help us figure out what is wrong.

Do you change the serial monitor baud rate when you change the baud rate in the sketch? Do you have RX to TX, TX to RX?

well I had Rx to Rx and Tx to Tx connections and it was outputting
I⸮c ⸮ -J皤

and then stopping. I changed to Rx to Tx like you suggested and got infinite lines of
⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮

To read the GPS with TinyGPS++ it should be GPS TX to Arduino RX (GPS RX does not need to be connected). Only if using the Arduino as an FTDI should it be RX to RX, TX to TX.
GPS (software serial) baud rate should be 9600. Serial monitor baud rate should be 115200 (Serial.begin(115200).

I connected my Neo 6M per the sketch from your post, loaded the sketch, only changing the static const uint32_t GPSBaud = 4800 to static const uint32_t GPSBaud = 9600. Sitting at my desk in side my house I got a lock and good position and time data within a few minutes.

So, the sketch is OK. It is your GPS or wiring or serial port settings that has a problem.

Wow thank you so much I just got it running.

mm3v8:
Wow thank you so much I just got it running.

So what had you done wrong ?

A little late to this party, but you might be interested in my NeoGPS library. NeoGPS is smaller, faster, more accurate and more reliable than all other GPS libraries. Many other libraries' examples are not structured properly, and they break when you modify them.

NeoGPS is available from the Arduino Library Manager, under the menu Sketch-> Include Library-> Manage Libraries. Even if you don't use it, there are lots of tips on the Installation and Troubleshooting pages. Be sure to read the sections on choosing a serial port and connecting the device. Using SoftwareSerial is the worst choice.