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?
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... )
 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!
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.
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.
"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...
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.