Search code examples
arduinogps

Neo-6M GPS returning no values on Arduino Nano


I have recently bought a GPS module for my Arduino Nano. The GPS is not picking up any satellites. I have checked my code and wiring and cannot see anything that could be affecting it. Sometimes when the code is first run, it sends a jumbled NMEA code, but stops. My code is below.

#include <Arduino.h>
#include <Adafruit_BMP085.h>
#include <Wire.h>
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
#include "AltSoftSerial.h"



Adafruit_BMP085 bmp;
AltSoftSerial ss;
TinyGPSPlus gps;
float lat = 10;
float lon = 10;

void setup() {
  Serial.begin(9600);
  bmp.begin();
  ss.begin(9600);
} 

void loop() {
  Serial.print("Pressure:");
  Serial.print(bmp.readPressure());
  Serial.println(" ");
  Serial.print("Temp:");
  Serial.print(bmp.readTemperature());
  Serial.println("C* , ");
  gps.encode(ss.read());
  if (ss.available() > 0){
    Serial.print("Latitude= "); 
    Serial.print(gps.location.lat());
    Serial.print(" Longitude= "); 
    Serial.println(gps.location.lng());
    Serial.print("GPS Height:");
    Serial.println(gps.altitude.meters());
    Serial.print("Number of Sattilites:");
    Serial.println(gps.satellites.value());
    Serial.print("Date:");
    Serial.println(gps.date.day() + "/" + gps.date.month());
  }

  delay(3000);
}

Here is a snip of what is shown on the Serial Monitor

Pressure:100397 
Temp:30.10C* ,
Latitude= 0.00 Longitude= 0.00
GPS Height:0.00
Number of Sattilites:0
Date:/
Pressure:100396 
Temp:30.10C* ,
Latitude= 0.00 Longitude= 0.00
GPS Height:0.00
Number of Sattilites:0
Date:/

Thanks


Solution

  • Thanks, that seems to have fixed it. All the tutorials I looked at used delay(), so I didn't think it would affect it