SIM800L send SMS to many receivers or disable the returned balance info after each SMS

hi

my main goal: I want to use sim800l to send the same SMS to multiple people at the same time or after one another.

The problem: as per multiple posts online i cant send to many numbers together and most of them used delay between each request but i only receive the first SMS.

What i tried: i used delays between each request up to 5 seconds and still cant receive the second message, also After each message i receive balance information that i think its interferes with the second SMS as i see in serial monitor

What I'm looking for : better way to send SMS to many receivers or find the bug in my code

My code basically read values of two temperature sensor, and check if their values are reasonable (not faulty) if both of them are good then it checks the actual values and if its above 33 degree it should send SMS to two numbers with delay between them

#include <OneWire.h>
#include <DallasTemperature.h>
#include <SoftwareSerial.h>


// Data wire is plugged into digital pin 2 on the Arduino
#define ONE_WIRE_BUS 14

SoftwareSerial mySerial(26, 27); //SIM800L Tx & Rx is connected to Arduino #3 & #2

// Setup a oneWire instance to communicate with any OneWire device
OneWire oneWire(ONE_WIRE_BUS);  

// Pass oneWire reference to DallasTemperature library
DallasTemperature sensors(&oneWire);

float tem1;
float tem2;
int tem1Led = 12 ;
int tem2Led = 13 ;

void setup() {
  // put your setup code here, to run once:

mySerial.begin(9600);
Serial.begin(9600);     // start the serial protocol
delay(200);              // make delay for short time
pinMode(tem1Led, OUTPUT);
pinMode(tem2Led, OUTPUT);
Serial.println("The tempreature and humidity NOW is");
Serial.println("Initializing..."); 
mySerial.println("AT"); //Once the handshake test is successful, i t will back to OK
updateSerial();
sensors.begin();
  mySerial.println("AT+CPIN=3516"); //Once the handshake test is successful, i t will back to OK
  updateSerial();

delay(2000);
}

void loop() {
  // put your main code here, to run repeatedly:

  sensors.requestTemperatures(); 

  tem1 = sensors.getTempCByIndex(0);
  tem2 = sensors.getTempCByIndex(1);
  Serial.println( tem1);
  Serial.println( tem2 );


if ( tem1 < 70 && tem1 > 5)
{
  digitalWrite(tem1Led , HIGH);    //GREEN LED ON
  if(tem1 >33){
  mySerial.println("AT+CPIN=3516"); //Once the handshake test is successful, i t will back to OK
  updateSerial();
  delay(2000);

  mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
  updateSerial();
  mySerial.println("AT+CMGS=\"+96**********\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms
  updateSerial();
  mySerial.print("Warning !!! check the tower"); //text content
  updateSerial();
  mySerial.write(26);
  delay(2500);
  updateSerial();  
  delay(2500);

  mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
  updateSerial();
 mySerial.println("AT+CMGS=\"+96**********\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms
  updateSerial();
  mySerial.print("Warning !!! check the tower"); //text content
  updateSerial();
  mySerial.write(26);

  }

  }

  else
    digitalWrite(tem1Led , LOW);    //GREEN LED OFF




if ( tem2 < 70 && tem2 > 5)
{
  digitalWrite(tem2Led , HIGH);    //GREEN LED ON
  if(tem2 >33){
  mySerial.println("AT+CPIN=3516"); //Once the handshake test is successful, i t will back to OK
  updateSerial();
  delay(2000);
  
  mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
  updateSerial();
 mySerial.println("AT+CMGS=\"+96**********\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms
  updateSerial();
  mySerial.print("Warning !!! check the tower"); //text content
  updateSerial();
  mySerial.write(26);
    updateSerial();
  delay(2500);
  updateSerial();  
  delay(2500);
  mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
  updateSerial();
 mySerial.println("AT+CMGS=\"+96**********\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms
  updateSerial();
  mySerial.print("Warning !!! check the tower"); //text content
  updateSerial();
  mySerial.write(26);

  }

  }

  else
    digitalWrite(tem2Led , LOW);    //GREEN LED OFF


  updateSerial();
Serial.print("tem1 & tem2 = ");
Serial.print(tem1);
Serial.print(" |  ");
Serial.println(tem2);
}




void updateSerial()
{
  delay(500);
  while (Serial.available()) 
  {
    mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
  }
  while(mySerial.available()) 
  {
    Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
  }
}

Why did you insert the updateSerial() function after every serial call? This function is for debug communication between two Serial ports. Why is it in this code? What do you have attached to the HardwareSerial?

because I need to see the progress and check if everything as expected, i will delete it when it's done.

you mean the original TX, RX ? I'm using it with the serial monitor to check the progress

Ok, but anyway using the 500ms delay is absolutely senseless.

during this time, the serial port will have time to transmit and receive several hundred characters, but the port buffer is only 64 bytes. With these settings, you will lose most of the messages

Please show what answers you receive from the modem during sending process? You write that the first SMS is leaving, but the second is not. Are the modem responses during sending these two messages different?

ohh that may explain why some words from time to time comes with missing letters in the begining.

ok i will try, SMS is expensive here and i already tried several times.
but once i try again i will capture the output.

I thought there a way or AT command that sends the same SMS to many receivers like what we have on our phones.

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