Hi,
Currently I am undertaking a project that involves texting the unit then returning the GPS coordinates to the number that texted. Using the Arduino UNO and a GPS/GSM Shield (SIM908 based).
The shield interacts using AT commands. I have set the arduino as a serial interface and have been able to retrieve a text, open it and then obtain coordinates. This has worked successfully and I have attached a screenshot of this working.
However I would like the arduino to effectively automate this. I have got it to the stage where it can detect an incoming sms, once this is done an AT command is send to the shield that returns the coordinates. I am attempting to enter the coordinates into a char array before sending, this seems to be limited to so many characters before stopping. I have a feeling this has something to do with the serial buffer size.
Entering GPS result into array
Serial.println("AT+CGPSINF=32");//this outputs the gps into the serial
delay(500);
while (Serial.available() > 0)
{
for(i=0;i<100;i++ )
{
sr = Serial.read(); // Read a character
GPS[i] = sr; // Store it
}
}
This is how I manually control it when the arduino is set as a serial interface.
AT
OK
AT+CGPSPWR = 1
OK
AT+CGPSRST = 1
OK
AT+CMGD = 1,4
OK
+CMTI: "SM",1
AT+CMGR= 1
+CMGR: "REC UNREAD","+447540310540","","17/01/26,09:46:02+00"
Test
OK
AT+CGPSINF=32
32,092545.000,V,0.000000,N,0.000000,E,0.00,0.00,011110,,E,A
OK
The attached file is a screenshot of what the current array is saving once printed back.
Thanks everyone, as I say, I think the problem is to do with the serial buffer so if anyone has any idea why only half of the serial is getting added to the array?