Sending SMS hangs thing.handle Arduino

Hey all,

So my code is written such that if a SMS is recieved by the SIM900 module, it will send a reply back to me as an SMS as well as update the thinger page about the state of each sensor.

But, when it sends an SMS the handle hangs and refuses to reconnect to the thinger platform.

Is it a problem with the Module, or does the thing.handle not allow to use any other SIM900 commands?

I have enabled debug and got confirmation that it refuses to reconnect.

Thanks in advanced

Hi @VarunNelakanti, can you share your code? Not sure if such kind of device is able to send SMS and use GRPS connection simultaneously, without breaking connection.

Hey @alvarolb, yeah sure I have pasted the code down below, I have not included the setup of the APN and the other steps(Hoping that is okay as I doubt it will make a difference)

void loop()



String readSIM900A() //Function ot read SMS recieved
String buffer;

while (Serial1.available())
    char c =;

  return buffer;

void loopControl() //Perform actions based on SMS recieved

String inchar = readSIM900A();
inchar.remove(0, 51);
int len = inchar.length();
inchar.remove(len - 2, 2);
if (inchar == "Stats")
  stats();   // These are different functions
if (inchar == "Temperature")
  temp();	//Functions
if (inchar == "RelayON")
  RelayON();	//Functions
if (inchar == "RelayOFF")
  RelayOFF();	//Functions

String stats()
msg= “Hello, Is SIM900 working?”;

void SendMessage(String M)


Thank You in advanced

Hey @alvarolb, Also I created a function just to call thing.handle for a few seconds and then call thing.stop to close the connection so that the SIM900 can recieve SMS again.

But by doing so , i have noticed that the SIM900 later refuses to connect to its GPRS and also sometimes to its network.

Thanks in advanced.

PS- the functions is just

void thingstuff() // This is called from loop every 30 seconds using the BlinkwithoutDelay logic

Hi @VarunNelakanti, I am not sure if you can read from the serial connection as you are doing. I mean, the current implementation (or any other working with sockets) will be working with the Serial connection also for handling the socket connection. If you are “interfering” with the Serial, there will be packets in the socket that will be missing, and the connection will be interrupted. It should recover eventually, but as long as you keep reading from it, the problem will persist.

Regarding the stop connection, it should just disconnect the socket, and not the network. But not sure what will happen when you are also working with the serial by your side… Maybe this is the problem?

Hey @alvarolb, yeah i guess that is the problem. Thank you so much for helping me. Guess i have to use another method to get a message from the project. Possibly an email?

Thanks again. :smiley: