#170319

I have never done anything with Arduino before. But would like to do something like this, so that if an alarm is activated at our small school, it will automatically text to a dozen numbers “Emergency at school.” Maybe repeat three times.
Could you help me with how to change the code to add more numbers?
Can I use any Arduino?
Can I use any GSM 800?
Or is there a specific one that is better?

#170340

sure, I will try my best to help you for this project, but I cannot guarantee its working because it is difficult for me to test and confirm it practically.
I recommend only Arduino UNO for this project, and no other variant.
Yes, you can use any GSM 800 but SIM800L or SIM800A are the most commonly used modules. SIM900 also works but is slightly older. Ensure that your module supports your countrys mobile network frequencies.

You can modify the existing receiver code in the following manner, for fulfilling your desired specifications:

#include
SoftwareSerial gsm(9,8);

String phoneNumbers[] = {
“+911234567890”, // Replace with actual numbers
“+919876543210”,
“+911122334455”
}; // Add more numbers if needed

void setup() {
gsm.begin(9600); // Setting the baud rate of GSM Module
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
delay(100);
}

void loop() {
if (Serial.available() > 0) {
switch(Serial.read()) {
case ‘s’:
case ‘S’:
sendEmergencySMS();
break;
case ‘r’:
case ‘R’:
Recieve();
break;
}
}

if (gsm.available() > 0) {
Serial.write(gsm.read());
}

// Example alarm condition: If a digital input pin goes HIGH, trigger SMS
if (digitalRead(7) == HIGH) { // Change 7 to the actual alarm pin
sendEmergencySMS(); // Send SMS when alarm is triggered
delay(60000); // Wait 1 minute before checking again to avoid spam
}
}

void sendEmergencySMS() {
for (int i = 0; i < sizeof(phoneNumbers) / sizeof(phoneNumbers[0]); i++) { gsm.println("AT+CMGF=1"); // Set SMS mode delay(1000); gsm.print("AT+CMGS=\""); gsm.print(phoneNumbers[i]); gsm.println("\""); delay(1000); gsm.println("Emergency at school!"); // Message content delay(100); gsm.write(26); // ASCII code of CTRL+Z to send the message delay(5000); // Wait before sending to next number } }void Recieve() { gsm.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS delay(1000); }

#170531

Thanks for your comments. I will give it a try.

#170543

No problem..

#59722

hello sir,
i am not getting the reply from gsm module..can you lease help to how to get the reply..and there was a error showing in the program at in this line
mySerial.print(“AT+CMGS=”+91xxxxxxxxxx”r”);
if we given like shown below its not showing any error
mySerial.print(“AT+CMGS=\”+91xxxxxxxxxx\”\r”);

Need Help? Please Leave a Comment! We value your input—Kindly keep it relevant to the above topic!

Your email address will not be published. Required fields are marked *