Hello, I need to read the readings off my GPS module onto the Serial monitor. Ive tested out using Arduino MEGA and it went fine. However, when it comes to Arduino UNO, I did not get any data. I can only use TinyGPS.h library as TinyGps++. h library always gives me empty data. I don't know why.
I waited for 20+ minutes in an open area. My Arduino board is in working condition and the module has light blinking. I've tried 2 different configuration for RX and TX for both times but still no result (empty serial monitor). My connection is per below:
Configuration 1: RX = Pin 3, TX = Pin 4 while for configuration 2: RX = Pin 1 (TX), TX = Pin 0 (RX). For configuration 2, I did it that way because I've seen in multiple post where the RX of GPS is to connect to TX (same concept w TX of GPS). Both configuration: VCC = 5V, GND = GND
Codes below is by using Configuration 1. For Serial Monitor and NMEA Code
#include <SoftwareSerial.h>
// The serial connection to the GPS module (configuration 1)
SoftwareSerial ss(3, 4);//rx,tx
void setup(){
Serial.begin(9600);
ss.begin(9600);
}
void loop(){
while (ss.available() > 0){
// get the byte data from the GPS
byte gpsData = ss.read();
Serial.write(gpsData);
}
}
Codes below is by using Configuration 1. For Serial Monitor and lat/long Code
#include <TinyGPS.h>
#include <SoftwareSerial.h>
float lat,lon;
TinyGPS gps; // create gps object
// The serial connection to the GPS module (configuration 1)
SoftwareSerial ss(3, 4);//rx,tx
void setup(){
Serial.begin(57600); // connect serial
Serial.println("The GPS Received Signal:");
Serial1.begin(9600); // connect gps sensor
}
void loop(){
while(ss.available()){ // check for gps data
if(gps.encode(ss.read()))// encode gps data
{
gps.f_get_position(&lat,&lon); // get latitude and longitude
Serial.print("Position: ");
//Latitude
Serial.print("Latitude: ");
Serial.print(lat,6);
Serial.print(",");
//Longitude
Serial.print("Longitude: ");
Serial.println(lon,6);
}
}
}