I am making a gps tracker with neo6m gps module and esp32 dev board.
I checked wiring and coding but still my module isn't catching a signal
I am already on roof of my house in case it require clear sky to connect
This is my code
#include <WiFi.h>//for connecting esp32 to a wifi
#include <TinyGPS++.h>//to obtain gps data from neo-6m gps module
#define WIFI_SSID "Airtel_pawa_4182"//wifi name in simple words
#define WIFI_PWD "Ahuja6230"//wifi password
TinyGPSPlus GPS;//creating a gps object from tinygps++ library
void setup() {
Serial.begin(9600);
//wifi setup{
WiFi.begin(WIFI_SSID, WIFI_PWD);
Serial.println("connecting to wifi");
while(WiFi.status() != WL_CONNECTED){
Serial.println(".");
delay(100);
}
Serial.print("Successfully connected to ");
Serial.println(WIFI_SSID);
//}
//gps setup{
Serial2.begin(9600);
delay(1000);
Serial.println(".");
Serial.println("ESP32-GPS Tracker");
Serial.println("Initializing...");
//}
}
void loop() {
if(Serial2.available() > 0) {
if(GPS.encode(Serial2.read())) {
if(GPS.location.isValid()) {
double latitude = GPS.location.lat();
double longitude = GPS.location.lng();
Serial.print(F("- latitude: "));
Serial.println(latitude);
Serial.print(F("- longitude: "));
Serial.println(longitude);
}
else{
Serial.println(F("- location: INVALID"));
}
Serial.println();
}
}
if (millis() > 5000 && GPS.charsProcessed() < 10) {
Serial.println(F("No GPS data received: check wiring"));
}
}
The connection is simple
VCC(gps)--->3V3(esp32)
Gnd--->Gnd
Rx---->GPIO17(Tx)
Tx---->GPIO16(Rx)
This is what serial monitor reads:
connecting to wifi
.
.
.
.
.
Successfully connected to Airtel_pawa_4182
.
ESP32-GPS Tracker
Initializing...
No GPS data received: check wiring
No GPS data received: check wiring
No GPS data received: check wiring
No GPS data received: check wiring
How to resolve this issue?
Edit: the breadboard was initially wired wrong but later this was fixed.thanks to Starcat for correcting mistake But still the gps module is taking very much time to catch signal. When it starts, it first print that no gps data recived for some time then it says location is invalid. Only then it prints the lat. and long.Also, the lat and long are not being updated on serial moniter on time. The delay is just one second but it is taking much more time... If anybody has a solution then pls answer..