Gprs SIM900 and Gps NEO-6M don't work together

I’m trying to get gps position and send to my API through the shields Gprs SIM900 and Gps NEO-6M.

On setup(), first I start gprs shield and call the function that connects to internet. Then on loop(), I start to capture gps position and finally I sending to api, but my code don’t work with this logic. I’d like connects once and get gps coordinates and send to api many times making a tracking.

The app stops if I run the code. connectToInternet() on setup() and getGpsPosition() loop(). The shield SIM900 connects but the shield NEO6-M does not display the coordinates. The GPS only capture the coordinates if I do not connect to internet.

Could someone help me? Following is my code and print of the response AT commands.

#include <SoftwareSerial.h>
#include <TinyGPS++.h>
#include <inetGSM.h>

static const int RXPin = 4, TXPin = 3;

InetGSM inet;
TinyGPSPlus gps;
SoftwareSerial serialGps(RXPin, TXPin);

char msg[50];
boolean started = false;
const char* dataCoord = "";

void setup() {
// Serial connection.

Serial.print(F("------------------------------------------------- \r\n"));
Serial.println(F("Starting App Tracking Arduino"));
Serial.print(F("------------------------------------------------- \r\n"));

// Turn on GPRS
// Start configuration of shield SIM900 with baudrate.
if (gsm.begin(2400)) {
started = true;
else Serial.println(F("\nstatus=IDLE"));

if (started)

// Start configuration of shield GPS NEO-6M with baudrate.

void loop() {
// This sketch displays information every time a new sentence is correctly encoded.
while (serialGps.available() > 0)
if (gps.encode(


Power up
void powerUpGprs() {
pinMode(9, OUTPUT);
digitalWrite(9, HIGH);
Serial.println(F("\nPower Up SIM900!"));

Connect to Internet via GSM
void connectToInternet() {
Serial.print(F("------------------------------------------------- \r\n"));
Serial.print(F(" CONNECT TO INTERNET \r\n"));
Serial.print(F("------------------------------------------------- \r\n"));

//GPRS attach, put in order APN, username and password.
if (inet.attachGPRS("", "vivo", "vivo"))
//Read IP address.

Get GPS position
void getGpsPosition() {

Serial.print(F("------------------------------------------------- \r\n"));
Serial.print(F(" GET POSITON \r\n"));
Serial.print(F("------------------------------------------------- \r\n"));
// geolocation
TinyGPSDate &d =;
TinyGPSTime &t = gps.time;
char* timestamp;
if (!d.isValid()) {
timestamp = "00/00/0000 00:00:00";
}  else  {
char sz[32];
sprintf(sz, "%02d/%02d/%02d %02d:%02d:%02d",, d.month(), d.year(),
        t.hour(), t.minute(), t.second());
timestamp = sz;
String position = String("");
position.concat(String("timestamp=") + String(timestamp));
position.concat(String("&latitude=") + String(, 6));
position.concat(String("&longitude=") + String(gps.location.lng(), 6));
position.concat(String("&altitude=") + String(gps.altitude.meters()));
position.concat(String("&speed=") + String(gps.speed.kmph()));

Send To API, The function inet.httpPOST(),
this is submit method POST via http request
void send2Api() {
Serial.print(F("------------------------------------------------- \r\n"));
Serial.print(F(" SEND TO API\r\n"));
Serial.print(F("------------------------------------------------- \r\n"));

// Read until serial buffer is emapty.

// TCP Client HTTP, send a POST request to the server and save the reply.
int numdata = inet.httpPOST("", 80, "/geolocations ", dataCoord, msg, 100);

// Print the results.
Serial.print(F("\nNumber of data received: "));
Serial.print(F("\nData received: "));

If I connect to internet the GPS does not display the coordinates

But, if I don’t connect to internet the GPS display the coordinates.

Which pins are you using to communicate with the SIM900?

Same thread on Stackexchange:

I solved.... This example also serves to help other developers who are facing the same problem or a similar problem with Gprs SIM900 and Gps NEO-6M working together.

Hi! I saw that you solved your problem and posted a guide on GitHub. How do I send the coordinates to a mobile phone by text message? How do I make the electrical connections? I need to use the connections with Jumpers, without connecting a SIM900 card directly to Uno. Could you please help me with this?

Is that possible to set a specific range to that GPS Neo-6M and make the GSM sim900 to send message when someone crosses that range?