Go Down

Topic: No response to AT command in Arduino shield SIM900  (Read 183 times) previous topic - next topic

amaansour

I have an Arduino Uno board companied with a SIM900 shield (the one in the picture). By uploading this code to Arduino, I am able to send an SMS to my phone number (I think that means; the Arduino and the shield are working properly)
However, when typing AT command in serial monitor of Arduino program I don't get an "OK" response, but I get nothing. Could you explain what's going on to this shield, please? 



Code: [Select]

/*********
  Complete project details at http://randomnerdtutorials.com 
*********/

#include <SoftwareSerial.h>

// Configure software serial port
SoftwareSerial SIM900(7, 8);

void setup() {
  // Arduino communicates with SIM900 GSM shield at a baud rate of 19200
  // Make sure that corresponds to the baud rate of your module
  SIM900.begin(19200);
  // Give time to your GSM shield log on to network
  delay(20000);   
 
  // Send the SMS
  sendSMS();
}

void loop() {
 
}

void sendSMS() {
  // AT command to set SIM900 to SMS mode
  SIM900.print("AT+CMGF=1\r");
  delay(100);

  // REPLACE THE X's WITH THE RECIPIENT'S MOBILE NUMBER
  // USE INTERNATIONAL FORMAT CODE FOR MOBILE NUMBERS
  SIM900.println("AT + CMGS = \"+212625429762\"");
  delay(100);
 
  // REPLACE WITH YOUR OWN SMS MESSAGE CONTENT
  SIM900.println("Message example from Arduino Uno.");
  delay(100);

  // End AT command with a ^Z, ASCII code 26
  SIM900.println((char)26);
  delay(100);
  SIM900.println();
  // Give module time to send SMS
  delay(5000);
}

MarekBujko

#1
May 18, 2018, 01:17 pm Last Edit: Jun 18, 2018, 09:16 pm by MarekBujko
Hello,
capture photo with your connection and send here.

Check the connection:
GSM module 7/8/GND pin to 7/8/GND pin on Arduino Uno.
GND is needed because it is a common ground.
Check jumpers on GSM module board are set to D8 (RX) and second clip to D7 (TX).

Check your baudrate -> Serial Monitor (in your code 19200 baud). Then check is selected Both NL & CR.


If it still does not work, try this direct code:
Code: [Select]
#include <SoftwareSerial.h>

SoftwareSerial SIM900(7, 8);

void setup()
{
SIM900.begin(19200);
Serial.begin(19200);
}

void loop()
{
if (SIM900.available())
  Serial.write(SIM900.read());
if (Serial.available())
  SIM900.write(Serial.read()); 
}


How to send SMS directly with AT commands on Arduino Serial Monitor:
Code: [Select]
AT //answer is OK, for verify connection only
AT+CMGF=1 //this command start SMS text mode
AT+CMGS="phone number of recipient" //number start with country code ex. +420
> Now you write SMS.
For send SMS you need end AT command with a ^Z / CTRL + Z, ASCII code 26

If you want to send SMS directly with Arduino Serial Monitor, you need end symbol as in your code (End AT command with a ^Z, ASCII code 26). On more non-ASCII keyboards you will not send it. Notepad++ can help you understand this encoding. You press ALTGR+026. You'll see the blurred word SUB, you copy it. Paste into Arduino Serial Monitor, there is shown as a cube and the ones you send it for send SMS.

How to unlock and disable pin code on SIM with AT commands:
Code: [Select]
AT //answer is OK, for verify connection only
AT+CPIN="pin code here"
AT+CPIN? //answer is +CPIN: READY <- unlocked and ready for SIM AT commands
AT+CLCK="SC",0,"pin code here" //disable sim pin usage

AT+CLCK="SC",1,"pin code here" //enable sim pin
AT+CPIN="PUK code","pin code here" //when you want to input the PUK code
                                   //after you input 3 times of the wrong pin

Go Up