1

enter image description here 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..

7
  • Could you include a picture or a schematic of how your ESP32 and GPS are connected and powered?
    – StarCat
    Mar 31 at 6:02
  • @StarCat added picture. I am currently powering it with my laptop
    – Yug Ahuja
    Mar 31 at 7:30
  • 1
    You're using the breadboard wrong. The parts on either side of the center bar of of the breadboard are not connected to each other (see here) so the white and orange wires and the black yellow and wires are not making a connection. Put the wires on the same side of the breadboard and you have a higher change of a working GPS.
    – StarCat
    Mar 31 at 7:52
  • @StarCat It worked... It was my first time using mini bread board. I have always used normal sized breadboard that are connected vertically (when placed as landscape), so didn't know that it didn't had connection across the middle bar....
    – Yug Ahuja
    Mar 31 at 8:29
  • But still the location is showing INVALID for some reason
    – Yug Ahuja
    Mar 31 at 8:31

2 Answers 2

1

The "No GPS detected" message means that 5 seconds have passed and less than 10 valid characters have arrived at the GPS serial port. Could be a baud rate mismatch.

1

The breadboard is wired wrong. The parts on either side of the center bar of of the breadboard are not connected to each other (see here), so the white and orange wires and the black yellow and wires are not making a connection.

Solution: Put the wires on the same side of the breadboard and you have a higher change of a working GPS.

You should now at least receive output from the GPS, even if it is just reporting the fact that it has not yet received a valid position. It may take some time (especially when using it for the first time) to get a fix. I would give it at least 30 minutes for the first fix.

1
  • It is working but every time I start it, It says no gps data recieved for some time then then the location is invalid and only then it output the latitude and longitude. Also the latitudes and longitudes are updated to serial moniter with much delay even I just added a delay of 1 second in my program... Do you have solution to this?
    – Yug Ahuja
    Mar 31 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.