SIM800 sms Send Using Arduino

Hi Friends
Need Huge Help!!

im using below code for send sms via sim800 module and my requirement is to send two SMS to two different numbers with different sms commands!

For example:-
My 1st Number is 0711034141 need to send sms as "Prime"
My 2nd Number is 0706304141 need to send sms as "Coil"

The Code that i needed modifying below!! if some one can help me please!!

#include <SoftwareSerial.h>

//SIM800 TX is connected to Arduino D2
#define SIM800_TX_PIN 2

//SIM800 RX is connected to Arduino D3
#define SIM800_RX_PIN 3

//Create software serial object to communicate with SIM800
SoftwareSerial serialSIM800(SIM800_TX_PIN,SIM800_RX_PIN);

void setup() {
//Begin serial comunication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
while(!Serial);

//Being serial communication witj Arduino and SIM800
serialSIM800.begin(9600);
delay(1000);

Serial.println("Setup Complete!");
Serial.println("Sending SMS...");

//Set SMS format to ASCII
serialSIM800.write("AT+CMGF=1\r\n");
delay(1000);

//Send new SMS command and message number
serialSIM800.write("AT+CMGS="0711034141"\r\n");
delay(1000);

//Send SMS content
serialSIM800.write("Prime");
delay(1000);

//Send Ctrl+Z / ESC to denote SMS message is complete
serialSIM800.write((char)26);
delay(1000);

Serial.println("SMS Sent!");
}

void loop() {

}

What is your problem? Did you try to edit the code yourself?

Yes My Problem is upon code is working fine for sending sms for 1 (one) number but my Requirement is to send multiple sms at onece with different sms body for example see below

1st Number 0711034141 need to send "Prime" to this number
2nd Number 0706034141 need to send "Coil" to this number

Can you please edit this code and help me out here!

What is the problem to repeat the steps, sending the first SMS, to send the second with different number and text?
Did you even try?

yes i tried to repeat those steps but no luck im new to arduino and still learning can you help me out here how to repeat those steps

please show your efforts

//Send new SMS command and message number
serialSIM800.write("AT+CMGS="0711034141"\r\n");
delay(500);
serialSIM800.write("AT+CMGS="0706034141"\r\n");
delay(1000);

//Send SMS content
serialSIM800.write("Prime ");
delay(500);
serialSIM800.write("Coil ");
delay(1000);

How should this work, do you think?
You set the number of the message recipient - and without sending anything, you immediately changed it to another?

Try to understand the logic of sending SMS:

  1. You set the recipient number
  2. You send a text
  3. You send terminating byte 26
    Then everything is the same for another SMS

//Send new SMS command and message number
serialSIM800.write("AT+CMGS="0711034141"\r\n");
delay(500);
serialSIM800.write("AT+CMGS="0706034141"\r\n");
delay(1000);

//Send SMS content
serialSIM800.write("Prime ");
delay(500);
serialSIM800.write("Coil ");
delay(1000);

Please read what I wrote on post #8 carefully

Is it Like this?? Please Help me out here!

//Send new SMS command and message number
serialSIM800.write("AT+CMGS="0711034141"\r\n");
delay(1000);
//Send SMS content
serialSIM800.write("Prime");
delay(1000);

//Send new SMS command and message number
serialSIM800.write("AT+CMGS="0706034141"\r\n");
delay(1000);
//Send SMS content
serialSIM800.write("Coil");
delay(1000);

or like this sir

//Send new SMS command and message number
serialSIM800.write("AT+CMGS="0711034141"\r\n");
delay(1000);
//Send SMS content
serialSIM800.write("Prime");
delay(1000);

//Send Ctrl+Z / ESC to denote SMS message is complete
serialSIM800.write((char)26);
delay(1000);

//Send new SMS command and message number
serialSIM800.write("AT+CMGS="0706034141"\r\n");
delay(1000);
//Send SMS content
serialSIM800.write("Coil");
delay(1000);

//Send Ctrl+Z / ESC to denote SMS message is complete
serialSIM800.write((char)26);
delay(1000);

please

It looks like
Try this code on real board

Thank You! for your time!! i will try this and let you know

compare your sketch with post #8. Do you see the difference?

What commands have to be used for sending one SMS and did you really use all of them in your sketch for the second SMS?

Generally speaking:
Before changing any program make sure that you understand every line and command in the original.
Don't make too big steps. Start with the blink example, understand it, change it (fast/ slow blinking, morsing ...) instead of starting with sending a SMS

1 Like

A post was split to a new topic: Why does my sim800l does not receiving message when it was compile with oled screen?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.