Hey there!
I'm facing a problem with my ublox Neo 6M and the Arduino Mega 2560.
The GPS module is connected to 5V, RX to Pin 0, TX to Pin 1.
I've also tried different setups like RX/TX to 14-19 or in reverse or RX to 10/11, since I've read there are some issues with the Mega and the RX Pins.
I'm using the TinyGPSPlus library which is in the library folder of the IDE installation.
The baud rate of the serial monitor is set to 9600.
I'm working with OSX.
This is the code I'm using:
/*
* Rui Santos
* Complete Project Details https://randomnerdtutorials.com
*/
#include <SoftwareSerial.h>
// The serial connection to the GPS module
SoftwareSerial ss(0, 1);
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);
}
}
This is what is given out at the serial monitor:
�b��b��b��b��b��bbbbb�r��b�r��b�r��R��j
$GPGSV,3,1,10,01,5�
or alternativly:
/*
* Rui Santos
* Complete Project Details https://randomnerdtutorials.com
*/
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
static const int RXPin = 0, TXPin = 1;
static const uint32_t GPSBaud = 9600;
// The TinyGPS++ object
TinyGPSPlus gps;
// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);
void setup(){
Serial.begin(9600);
ss.begin(GPSBaud);
}
void loop(){
// This sketch displays information every time a new sentence is correctly encoded.
while (ss.available() > 0){
gps.encode(ss.read());
if (gps.location.isUpdated()){
Serial.print("Latitude= ");
Serial.print(gps.location.lat(), 6);
Serial.print(" Longitude= ");
Serial.println(gps.location.lng(), 6);
}
}
}
The serial monitor stays empty in this case.
Both Sketches work perfectly on the Arduino Uno.
I hope you can help me.
Thank You!
Marc