NANO AND GPS I am getting and issue

I am using a ARDUINO NANO and a NEO 6M GPS Module

#include <SoftwareSerial.h>
#include <TinyGPS++.h>
SoftwareSerial gpsSerial(8,9);
TinyGPSPlus gps;
float lattitude,longitude;

void setup() {

 gpsSerial.begin(9600);
 Serial.begin(9600);
  
  }

void loop()
{
  while (gpsSerial.available())
  {
    int data = gpsSerial.read();
    if (gps.encode(data))
    {
      lattitude = (gps.location.lat());
      longitude = (gps.location.lng());
      Serial.print ("lattitude: ");
      Serial.println (lattitude);
      Serial.print ("longitude: ");
      Serial.println (longitude);
    }
  }
}```
I am not recieving the coordinates on my serial monitor even though under the clear sky view

Is the LED on the GPS module flashing ?

Have you tried the samples in the GPS library?

So what are you seeing in the serial monitor ?

Good idea to change setup() so you can see if the serial monitor is working;

void setup() {

 gpsSerial.begin(9600);
 Serial.begin(9600);
 Serial.println("Program starting");
  
  }

@UKHeliBob - No LED is Flashing
@sonofcy Yes i also tried the examples with different boards

@srnet Serial monitor is empty there is nothing that is printing out there

But did you try the examples with the board that is not working?

Then the GPS has not got a lock on enough satellites to provide data. Are you testing this indoors ?

Well even if the GPS was not getting a fix, the serial monitor should be printing something like;

lattitude: 0.00

The reason why you should at least see the above is that if the GPS is actually producing characters that can be read, then there will be NMEA sentences there. So if there are NMEA sentences to be read (regardless of whether the GPS has a fix) encode() should be returning true so that "lattitude 0.00" and "longitude 0.00" ought as minimum to be printed out.

Try this code and show us the output, note to change the Serial monitor baud rate to 115200;

#include <SoftwareSerial.h>

SoftwareSerial GPS(8, 9);


void loop()
{
  while (GPS.available())
  {
    Serial.write(GPS.read());
  }
}


void setup()
{
  GPS.begin(9600);
  Serial.begin(115200);
  Serial.println("26A_GPS_Echo_SoftwareSerial Starting");
}

After making the changes in the setup now i just received

Program starting

should i want more for morning?

@UKHeliBob I tried outdoor as well but there was no response from there

The sketch in post 10 will should show you the actual output from the GPS.


@srnet

So no output from the GPS, either;

You have the GPS wired wrong.

The GPS baud rate is wrong.

The GPS is faulty.

The Nano is faulty.

Please do not post pictures of code

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

Please post your sketch, using code tags when you do

Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

@srnet can you guide me with the full connection and what i need to make the changes according to the images in post 13
i have uno as well let me try with it

@srnet from where i can get the gps module ?

Would be a better idea to try the GPS with a 3.3V logic level Arduino or Microcontroller.

The GPS will be 3.3V logic level output and its possible the 5V logic level Nano or UNO cannot read the GPS characters properly.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.