Hey, I am stuck in my project and decided to write my problem here because i tried all my solutions and can not find any help or examples for the GPS Modul on this page:
I having a:
- MG2639 Cellular (with all Assets like on the picture)
https://learn.sparkfun.com/tutorials/mg2639-cellular-shield-hookup-guide
The GPRS is working, i can send and receive Data from a Web Server fine, but i have troubles getting the GPS working:
- I don't get a Fix on the GPS Status Indicator LED (Already tried to change Shield, Cable and GPS Modul)
- If i connect an Ultimate GPS Modul from Adafruit it works, so it seems to be a Problem with my code
In the description i found that:
Communication with the cellular and GPS module’s occurs on two separate serial UARTs. To leave the Arduino’s hardware UART free for debugging and uploading sketches, both UARTs are broken out to digital pins – intended for use with the SoftwareSerial library.
Because the SoftwareSerial library can’t reliably support high-ish baud rates, we’ve intentionally slowed down the MG2639’s cellular UART to 4800 bps, rather than the module’s default bit rate of 115200. This slower rate ensure data reliability, and gives the Arduino some extra time to process large strings.
The GPS UART is hard-coded to 115200 baud, which make it harder to use with SoftwareSerial. Instead, we recommend using the AltSoftSerial library with this part of the module.
So my first Code Option was with AltSoft. But i don't recieve any data with my MG2639. When i played around i found out that if i plug the TX Port from an Ultimate GPS Modul from Adafruit to the RX Port of the MG2639 Module, i get the Coordinates over the Ultimate GPS Modul from Adafruit. But i think its not the idea to put two gps modules on a board:
#include <TinyGPS++.h>
#include <SFE_MG2639_CellShield.h>
TinyGPSPlus gps;
//RX=8 TX=9
#include <AltSoftSerial.h>
AltSoftSerial ss;
void setup()
{
Serial.begin(9600);
ss.begin(9600);
Serial.println(F("Start:"));
}
void loop()
{
// This sketch displays information every time a new sentence is correctly encoded.
while (ss.available() > 0)
if (gps.encode(ss.read()))
displayInfo();
}
void displayInfo()
{
Serial.print(F("Location: "));
if (gps.location.isValid())
{
Serial.print(gps.location.lat(), 6);
Serial.print(F(","));
Serial.print(gps.location.lng(), 6);
}
else
{
Serial.print(F("INVALID"));
}
Serial.print(F(" Date/Time: "));
if (gps.date.isValid())
{
Serial.print(gps.date.month());
Serial.print(F("/"));
Serial.print(gps.date.day());
Serial.print(F("/"));
Serial.print(gps.date.year());
}
else
{
Serial.print(F("INVALID"));
}
Serial.print(F(" "));
if (gps.time.isValid())
{
if (gps.time.hour() < 10) Serial.print(F("0"));
Serial.print(gps.time.hour());
Serial.print(F(":"));
if (gps.time.minute() < 10) Serial.print(F("0"));
Serial.print(gps.time.minute());
Serial.print(F(":"));
if (gps.time.second() < 10) Serial.print(F("0"));
Serial.print(gps.time.second());
Serial.print(F("."));
if (gps.time.centisecond() < 10) Serial.print(F("0"));
Serial.print(gps.time.centisecond());
}
else
{
Serial.print(F("INVALID"));
}
Serial.println();
}
btw., as soon i add int beginStatus = cell.begin(); to the code, the script doesn't give me any coordinates anymore, so i think there is a conflict with the ports between Software Serial&Cell Funktion and AltSoftSerial.
Next option:
I found an example from TinyGPS++, should it work with it?
If it set GPSBaud to 115200 i get at least an output:
Location: INVALID Date/Time: INVALID INVALID
with this code:
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
static const int RXPin = 8, TXPin = 9;
static const uint32_t GPSBaud = 115200;
// The TinyGPS++ object
TinyGPSPlus gps;
// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);
void setup()
{
Serial.begin(115200);
ss.begin(GPSBaud);
Serial.println(F("DeviceExample.ino"));
Serial.println(F("A simple demonstration of TinyGPS++ with an attached GPS module"));
Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
Serial.println(F("by Mikal Hart"));
Serial.println();
}
void loop()
{
// This sketch displays information every time a new sentence is correctly encoded.
while (ss.available() > 0)
if (gps.encode(ss.read()))
displayInfo();
if (millis() > 5000 && gps.charsProcessed() < 10)
{
Serial.println(F("No GPS detected: check wiring."));
while(true);
}
}
void displayInfo()
{
Serial.print(F("Location: "));
if (gps.location.isValid())
{
Serial.print(gps.location.lat(), 6);
Serial.print(F(","));
Serial.print(gps.location.lng(), 6);
}
else
{
Serial.print(F("INVALID"));
}
Serial.print(F(" Date/Time: "));
if (gps.date.isValid())
{
Serial.print(gps.date.month());
Serial.print(F("/"));
Serial.print(gps.date.day());
Serial.print(F("/"));
Serial.print(gps.date.year());
}
else
{
Serial.print(F("INVALID"));
}
Serial.print(F(" "));
if (gps.time.isValid())
{
if (gps.time.hour() < 10) Serial.print(F("0"));
Serial.print(gps.time.hour());
Serial.print(F(":"));
if (gps.time.minute() < 10) Serial.print(F("0"));
Serial.print(gps.time.minute());
Serial.print(F(":"));
if (gps.time.second() < 10) Serial.print(F("0"));
Serial.print(gps.time.second());
Serial.print(F("."));
if (gps.time.centisecond() < 10) Serial.print(F("0"));
Serial.print(gps.time.centisecond());
}
else
{
Serial.print(F("INVALID"));
}
Serial.println();
}
My Question is:
- What is the GPSBaud from MG2639 GPS: 4800 or 9600 or 115200?
- Can i only use AltSoftSerial or is there a way how it works with Software Serial?
- Is there any Test Script to test the GPS Modul for MG2639? I searched all Web an can not find any test script, just for GPRS.