GPS tracking project

Hello everyone. I explain the problem quickly, I want, with a GPS module (the GP735T) receiving these own GPS coordinates. Here is my program for now:

#include <SoftwareSerial.h>
#include <TinyGPS.h>

long lat,lon;

SoftwareSerial gpsSerial (0, 1);
TinyGPS gps;

void setup(){
  Serial.begin(9600);
  gpsSerial.begin(4800);
}

void loop(){
  while(gpsSerial.available()){
    if (gps.encode(gpsSerial.read())){
      gps.get_position(&lat,&lon);
      Serial.print("Position: ");
      Serial.print("lat: ");Serial.print(lat);Serial.print(" ");
      Serial.print("lon: ");Serial.println(lon);
    }
  }
}

The program is compatible with Arduino Uno but when I want to use it, nothing appears in the console. Could someone give me a hand please? : D

You're using SoftwareSerial on the Hardware UART. That won't work.

The UNO only has one Hardware UART (Serial) on pins 0 and 1, that's used for programming and debugging over USB. You can't use these pins for anything else if you want to use Serial.

Use SoftwareSerial on different pins, or get an Arduino that has an extra Hardware UART for the GPS module (e.g. Leonardo).
SoftwareSerial is a hack. You shouldn't use it.

Pieter

I changed the connection and the program, I now the 2 for RX and the 3 for TX. Still nothing appears in the console.

Suppozit-war:
I changed the connection and the program, I now the 2 for RX and the 3 for TX. Still nothing appears in the console.

Please post your updated code.

#include <SoftwareSerial.h>
#include <TinyGPS.h>

long lat,lon;

SoftwareSerial gpsSerial (2, 3);
TinyGPS gps;

void setup(){
  Serial.begin(9600);
  gpsSerial.begin(4800);
}

void loop(){
  while(gpsSerial.available()){
    if (gps.encode(gpsSerial.read())){
      gps.get_position(&lat,&lon);
      Serial.print("Position: ");
      Serial.print("lat: ");Serial.print(lat);Serial.print(" ");
      Serial.print("lon: ");Serial.println(lon);
    }
  }
}

Hi,
You have pin2 as Rx and pin3 as Tx.

Have you got pin2Rx connected to gpsTx pin?
and
Have you got pin3Tx connected to gpsRx pin?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile:

Hi,
Have you read the spec/manual on the GPS?

The default output sentences are GPGGA, GPGSA, GPGSV, GPRMC, GPVTG and GPGLL. The default UART communication parameters are 9600 bps, 8 data bits, 1 stop bit, and no parity. Other baud rate and related configurations could be requested based on MOQ.

You may need to try 9600 instead of 4800 in Software Serial..

Tom.. :slight_smile:

GP-735T-150203.pdf (605 KB)

You do have the GPS outdoors dont you ?

Unless the GPS has a fix, you wont see anything on the console, since its got no position to report.

Before using a GPS library check that the GPS is actuall outputing characters.

The 'Simple_SoftwareSerial_GPS_Echo' program will read characters form the GPS and print to the serial monitor, adjust the GPS TX and RX pins and baud rate to suit. The program can be found here;

https://github.com/LoRaTracker/Test-Programs

Hi,
Even without a sat fix, it will output data, usually zero's in the standard format.

Tom... :slight_smile:

There are better software serial libraries described here. It also describes connecting the GPS correctly.

That page is from the Installation instructions for 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.