The. Title explains it all
If your phone has a SIM800 cellular module, the answer is no.
If your phone has a SIM7600 cellular module, the answer is… it should since that module supports GPS, but I haven’t been able to get it to work. The module has a separate coaxial connector (the middle one) for a GPS antenna. I do not have a GPS antenna, and attempts to just use a simple 2G antenna have not worked. Perhaps if someone has a real GPS antenna to connect to that connector, it might work. I have used the following sketch to try to get GPS to work; good luck:
#include <MAKERphone.h>
#include <stdlib.h>
#include <string.h>
MAKERphone mp;
float Lat = 0;
float Log = 0;
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 (Serial1.available() > 0) { // Clean the input buffer
Serial1.read();
}
//Serial1.println(ATcommand); // Send the AT command
Serial1.print(ATcommand);
Serial1.print("\r");
x = 0;
previous = millis();
// This loop waits for the answer
do {
if (Serial1.available() != 0) {
// if there are data in the UART input buffer, reads it and checks for the answer
response[x] = Serial1.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=0", "OK\n", 1000); // stop GPS session
delay(5000);
sendATcommand("AT+CGPS=1,1", "OK\n", 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 (Serial1.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 (Serial1.available() > 0) {
RecMessage[i] = Serial1.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);
mp.display.setTextColor(TFT_YELLOW);
mp.display.fillScreen(TFT_BLACK);
mp.display.setCursor(0,0);
mp.display.print(RecMessage);
mp.display.pushSprite(0,0);
Serial.print("\n");
if (strstr(RecMessage, ",,,,,,,,") != NULL) {
memset(RecMessage, '\0', 200); // Initialize the string
i = 0;
answer = 0;
delay(1000);
mp.buttons.update();
if(mp.buttons.released(BTN_B)) {mp.loader();} //B reboots firmware if available
}
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("Longitude is ");
Serial.print(Log);
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;
}
void setup()
{
//pinMode(26, OUTPUT);
//digitalWrite(26, 0);
Serial.begin(115200);
//Serial1.flush();
//Serial1.begin(115200, SERIAL_8N1, 17, 16);
//pinMode(17, INPUT_PULLUP);
//delay(100);
mp.begin(1);
mp.inCall = 1;
}
void loop()
{
//mp.update();
GPSPositioning();
sleep(1);
mp.buttons.update();
if(mp.buttons.released(BTN_B)) {mp.loader();} //B reboots firmware if available
}
The sim 7600 is 4g right
Yes. You can see the 7600 written on the module right through the rear plastic. Mine says SIM7600A, but there are other modules for other countries.
The code should work, if i ad the antenna, right? Sorry, I’m new at this, also what would this particular code do
I think it should work, as a demo, but couldn’t get it to show any non-empty sentence using a spare 2G antenna on the middle connector. The original code would break down the sentence and print the GPS data fields to the USB serial debug port, but only if the sentence was complete. I added code to display the sentence to the Ringo screen, just so I could see whether it was empty (all commas) or not without being tethered to a computer. All I ever see is an empty sentence as the reply from the SIM7600 module. Perhaps a proper GPS antenna will produce a non-empty sentence and the broken down info on the serial debugging port. If it does, then you could write a more useful sketch to do whatever you want with the GPS data. If it still doesn’t work, then I really don’t know why, as this module is documented as having this capability.
should i tell you if i get it to work?
I’m sure everyone would be interested if you get the SIM7600 GPS capability working on the Ringo! Please post here on the community to let us know.