Hi, I've been trying to make this GPS tracker but when I check the output, it says "No GPS detected: check wiring" I connected my GPS RX to Arduino D3 then TX to D2. Could somebody please help me with this problem? I've been searching for a few days. Thanks!
#include <TinyGPSPlus.h>
#include <SoftwareSerial.h>
static const int RXPin = 6, TXPin =5;
static const uint32_t GPSBaud = 9600;
// The TinyGPS++ object
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);
// The serial connection to the GPS device
void setup()
{
Serial.begin(9600);
ss.begin(GPSBaud);
}
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()
{
int h, s, m, m1, h1;
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(" "));
// int h, s, m, m1, h1;
if (gps.time.isValid())
{
if (gps.time.minute() + 30 >= 60)
{
h = gps.time.hour() + 6;
Serial.print(h);
Serial.print(F(":"));
m = (gps.time.minute() + 30) - 60;
if (m < 10) Serial.print(F("0"));
Serial.print(m);
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 if (gps.time.minute() + 30 < 60)
{
h1 = gps.time.hour() + 5;
Serial.print(h1);
Serial.print(F(":"));
m1 = gps.time.minute() + 30;
if (m1 < 10) Serial.print(F("0"));
Serial.print(m1);
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 moved your topic to an appropriate forum category @leftnrightgnight.
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
well, 5 and 6 doesn't sound like 2 and 3.. does it?
when you do SoftwareSerial ss(RXPin, TXPin);, the RXPin is the pin on which to receive data, so it must be connected to the Tx pin of the GPS module and the TXPin is the pin on which you send data so it must be connected to the Rx pin of the GPS module
I used an Arduino Nano with this. And when I connected the Rx pin of the GPS module to the TXPin of the Nano and the Tx pin of the GPS module to the RXPin of the Nano, the uploading would take some time, and then it became an error.
An error occurred while uploading the sketch
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00