[resolved] SIM800L GSM Module on arduino, AT>OK, Receive SMS but don't send

Hi,

I'm using a Sim800L module to communicate between arduino and my smartphone
My SIM Card works (tested all fonctions with phone)
I can communicate with the module via AT commands, Config, receiving and reading SMS, is OK
BUT I CAN'T sending SMS

My power supply give 12V 5A and a LM2596 Regulator to 4V and can drain up to 3A

Need more Power, signal to poor?
NB: RX/TX level is 5v directly cnnected to arduino pin, some people says it's OK, some other not...
Anybody knows? :confused:

Thanks
Bertrand

module ref : http://www.ebay.fr/itm/Smallest-SIM800L-GPRS-GSM-Module-Card-Board-Quad-band-Onboard-With-Antenna-TTL-/222138747564?hash=item33b8804aac:g:5LYAAOSwOVpXT~uE

I use this sketch _commande.ino on arduino to use AT command
I use _envoi.ino to send SMS (because I don't know how to do ctrl+Z on serial terminal... :frowning: )

Base_GSM_commande.ino (463 Bytes)

Base_GSM_envoi.ino (1.39 KB)

Take a look at this block...

  readSerial(number);
  sim800l.print("AT+CMGS=");
  sim800l.print(number);
  sim800l.print("\"\r");
  // message
  delay(100);
  Serial.print("Enter your message to send to : ");

There is one subtle but important error, and one thing I'd be careful about.
Sketch the output string on paper - you may spot it.

Try to tell us, then I'll help if you are still stuck.
When you get it working, try to replace the delay() with millis() timers... you'll thank me later!

Thank you lastchancename

Maybe « "» less or more? I'm right?

Sorry i don't understand very well the «/r»
And i was thinking« ""\r"» was a complete string,

I got this code from this site:
http://letmeknow.fr/blog/2015/10/14/tuto-module-gsm-sim800l-envoyer-un-sms/

But without some explainations i can't resolve this mistake, however i'll try!

Maybe « "» less or more? I'm right?
You're very close! Balance your double-quotes around the phone number

" is the correct escape character for the double-quote character

The other thing worth being careful about - is that you're not checking responses from the modem at all.
The initial > prompt and the subsequent OK/ERROR responses are critical to ensure reliable sending.

Hi lastchancename,

I find it and it works well!
I replace

sim800l.print("AT+CMGS=");
sim800l.print(number);
sim800l.print(""\r");

into

sim800l.print("AT+CMGS="");
sim800l.print(number);
sim800l.print(""\r");

:smiley:

Thanks to you lastchancename, thanks for your good advices :wink:

however is the code correctly done or have you other elements to suggest to improve it?

Bertrand

Good work!
The correct handling of bursts of asynchronous serial data is an art in itself, and is beyond a casual forum post... I've been doing it for years, and still learn / fine-tune my approaches!

The best way I've found - which sounds hard, but just requires discipline when you start out - is to use a state machine which everyone talks about, but only a few expose their actual methods.

In this case - I'd use states something like this for sending an SMS...
My messages are queued using a FIFO to hold multiple messages - and to send them as rapidly and reliably as possible...

  • **SMS_IDLE **- nothing happening or queued - SMS process is 'idle'

Initiate a message send... +CMGS followed by number etc...

  • **SMS_WAITPROMPT **- waiting for the > mesage prompt character

Prompt received so send the message

  • **SMS_SENDBODYSMS **- we have sent the message, waiting for the OK/ERROR response

We are expecting a response or error response... may take several seconds.

  • **SMS_WAITCOMPLETE **- the response has been received (useful to determine timeout)

Then return to SMS_IDLE or leave the message in your outgoing queue for retry.

thanks lastchancename

"state machine" , i've never heard this term before, is it a method?

Now i try to keep your suggest in my head to check response from the modem... i'll try to write the correct code but it's not evident, maybe i'll request you one more time in the future... :wink:

Bertrand

lastchancename:
Maybe « "» less or more? I'm right?
You're very close! Balance your double-quotes around the phone number

" is the correct escape character for the double-quote character

The other thing worth being careful about - is that you're not checking responses from the modem at all.
The initial > prompt and the subsequent OK/ERROR responses are critical to ensuring reliable sending.

You can write this code to this too:

sim800l.print("AT+CMGS=number ""\r");

can you provide the full source code?