Yes, the SIM7600 should easily supply GPS coordinates over its serial port if asked. I believe the relevant AT commands are
AT+CGPS=1,1
AT+CGPSINFO
AT+CGPS=0
but you should look up the command set for the SIM7600 to get all the details.
The string that is read back over the serial port just needs to be parsed for lat and lon (plus date, time, and whatever other info is provided).
I found a sample fragment of code on the internet, and while itās not directly applicable to the Ringo/Makerphone, I think it gives you a general clue to what needs to be done. For example, the SIM7600 is accessed via serial port named Serial1 in the Ringo firmware, while this example fragment uses SIM7600Serial, but you get the general idea:
uint8_t sendATcommand(const char* ATcommand, const char* expected_answer, unsigned int timeout)
{
uint8_t x = 0, answer = 0;
char response[100];
unsigned long previous;
memset(response, '\0', 100); // Initialize the string
delay(100);
while (SIM7600Serial->available() > 0) { // Clean the input buffer
SIM7600Serial->read();
}
SIM7600Serial->println(ATcommand); // Send the AT command
x = 0;
previous = millis();
// This loop waits for the answer
do {
if (SIM7600Serial->available() != 0) {
// if there are data in the UART input buffer, reads it and checks for the answer
response[x] = SIM7600Serial->read();
Serial.print(response[x]);
x++;
// check if the desired answer is in the response of the module
if (strstr(response, expected_answer) != NULL) {
answer = 1;
}
}
// Waits for the asnwer with time out
} while ((answer == 0) && ((millis() - previous) < timeout));
// SIM7600Serial->print("\n");
return answer;
}
bool GPSPositioning()
{
uint8_t answer = 0;
bool RecNull = true;
int i = 0;
char RecMessage[200];
char LatDD[3], LatMM[10], LogDD[4], LogMM[10], DdMmYy[7] , UTCTime[7];
int DayMonthYear;
Lat = 0;
Log = 0;
memset(RecMessage, '\0', 200); // Initialize the string
memset(LatDD, '\0', 3); // Initialize the string
memset(LatMM, '\0', 10); // Initialize the string
memset(LogDD, '\0', 4); // Initialize the string
memset(LogMM, '\0', 10); // Initialize the string
memset(DdMmYy, '\0', 7); // Initialize the string
memset(UTCTime, '\0', 7); // Initialize the string
Serial.print("Start GPS session...\n");
sendATcommand("AT+CGPS=1,1", "OK", 1000); // start GPS session, standalone mode
delay(2000);
while (RecNull) {
answer = sendATcommand("AT+CGPSINFO", "+CGPSINFO: ", 1000); // start GPS session, standalone mode
if (answer == 1) {
answer = 0;
while (SIM7600Serial->available() == 0);
// this loop reads the data of the GPS
do {
// if there are data in the UART input buffer, reads it and checks for the asnwer
if (SIM7600Serial->available() > 0) {
RecMessage[i] = SIM7600Serial->read();
i++;
// check if the desired answer (OK) is in the response of the module
if (strstr(RecMessage, "OK") != NULL) {
answer = 1;
}
}
} while (answer == 0); // Waits for the asnwer with time out
RecMessage[i] = '\0';
Serial.print(RecMessage);
Serial.print("\n");
if (strstr(RecMessage, ",,,,,,,,") != NULL) {
memset(RecMessage, '\0', 200); // Initialize the string
i = 0;
answer = 0;
delay(1000);
}
else {
RecNull = false;
sendATcommand("AT+CGPS=0", "OK:", 1000);
}
}
else {
Serial.print("error \n");
return false;
}
delay(2000);
}
strncpy(LatDD, RecMessage, 2);
LatDD[2] = '\0';
strncpy(LatMM, RecMessage + 2, 9);
LatMM[9] = '\0';
Lat = atoi(LatDD) + (atof(LatMM) / 60);
if (RecMessage[12] == 'N') {
Serial.print("Latitude is ");
Serial.print(Lat);
Serial.print(" N\n");
}
else if (RecMessage[12] == 'S') {
Serial.print("Latitude is ");
Serial.print(Lat);
Serial.print(" S\n");
}
else {
return false;
}
strncpy(LogDD, RecMessage + 14, 3);
LogDD[3] = '\0';
strncpy(LogMM, RecMessage + 17, 9);
LogMM[9] = '\0';
Log = atoi(LogDD) + (atof(LogMM) / 60);
if (RecMessage[27] == 'E') {
Serial.print("Longitude is ");
Serial.print(Log);
Serial.print(" E\n");
}
else if (RecMessage[27] == 'W') {
Serial.print("Latitude is ");
Serial.print(Lat);
Serial.print(" W\n");
}
else {
return false;
}
strncpy(DdMmYy, RecMessage + 29, 6);
DdMmYy[6] = '\0';
Serial.print("Day Month Year is ");
Serial.print(DdMmYy);
Serial.print("\n");
strncpy(UTCTime, RecMessage + 36, 6);
UTCTime[6] = '\0';
Serial.print("UTC time is ");
Serial.print(UTCTime);
Serial.print("\n");
return true;
}