I have a little problem using GSM SIM900 module connected to the Arduino the call is working alright but it doesn't send me SMS I don't know why. This is my code:

#include <SoftwareSerial.h>
SoftwareSerial SIM900(2, 3);

void setup()
  delay(20000);  // give time to log on to network. 

void SIM900power()
// software equivalent of pressing the GSM shield "power" button
  digitalWrite(9, HIGH);
  digitalWrite(9, LOW);

void sendSMS()
  SIM900.print("AT+CMGF=1\r");                                                        // AT command to send SMS message
  SIM900.println("AT + CMGS = \"00201155706922"
  "");                                     // recipient's mobile number, in international format
  SIM900.println("Hello, world. This is a text message from an Arduino Uno.");        // message to send
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(5000);                                     // give module time to send SMS
  SIM900power();                                   // turn off module

void loop()
  do {} while (1);
  • \$\begingroup\$ The line where you give the mobile number seems odd and there should not be spaces in the command. Also after the number you have to wait for the module to respond with > before sending the message body. \$\endgroup\$ – Bence Kaulics Mar 8 '17 at 11:31
  • \$\begingroup\$ Have you check your sim card sending sms to this number through your cell phone? \$\endgroup\$ – Kapil Singh Rawat Mar 8 '17 at 11:34
  • \$\begingroup\$ use this "mySerial.println("AT+CMGS=\"+91xxxxxxxxxx\"\r");" where +91 is country code xxxxxxxxxx is you mob number. \$\endgroup\$ – Kapil Singh Rawat Mar 8 '17 at 11:37
  • \$\begingroup\$ i tried the same code for call but it worked \$\endgroup\$ – omarrageh rageh Mar 8 '17 at 11:49
  • \$\begingroup\$ You mean the same number format? Please fix the AT+CMGS=\"+91xxxxxxxxxx\"\r" line. Either using + or 00 format. \$\endgroup\$ – Bence Kaulics Mar 8 '17 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.