Requesting geolocation through SMS from Arduino controlled GSM and GPS modules.


 if(cell.available() > 0)
inchar =;
 if (inchar == '#') // the start of our command
inchar =;
 if (inchar == 'a')
inchar =;
if (inchar == '0')

Perhaps you aren't delaying long enough hoping for the next character to arrive. Either learn to use end of packet markers or use


That should certainly be long enough.

Thanks PaulS! Let me check it out.

just seen your post just finished a version of a tracker that does exactly what you are doing…

Your code problems are two fold…
you can’t rely on delay times on short messages in text mode.
your sequence is of course right, it appears on endless posts on internet, all them use delays … that works one location one tower at one time.

to send a text sms the true sequence is At command “number” dependent on your setting of local echo I always turn it of on gsm model initialise

you are waiting for then a forward > you have a delay, I have written endless test routines to measure time response from Modem which is dictated by availability of circuits the spread is unbelievable anything from 500mS to 10 seconds.

If you send the text data before the > is returned two errors but most modems do not report either, first carrier lost … you have tried to send when the modem is waiting for cell responses, the other error is data overflow in modems receive buffer.

I wish the numerous examples of SMS send on web made it clear that this time is non deterministic. a few years ago I wasted over 3 months not realising the problem was that easy…

In my code I parse the incoming response stream from the modem at all times, , because are you aware that if a receive call or text occurs in the wait period between number sent and > to send text., then some gsm modems I tested swap to receive mode making the sms send sequence void so after handling the incoming you have to restart from scratch the outgoing sms.

This later problem can be avoided by writing the outgoing to SIM storage which you can later send, the modems seem to multi task this with an incoming call ok.but the timing to storage is also non deterministic, you have to look for the protocol at all times onthis route as well otherwise you get partial or missing ready to send text msgs on SIM.

I have written my own driver for the siemans tc35 , read the reviews its rubbish they say, but once I realized it was a definitive half duplex protocol beast works 100%

    1. Happy Coding…

8) Thanks man! @tgsuperspec