[SOLVED]SIM900 do not respond to AT commands

hi i've been testing my SIM900 and Arduino mega but when i try to communicate with sim900 via Serial and Serial1 the SIM900 does not respond. Here is the sample code i use for testing



void setup()
{
  //Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
  Serial.begin(9600);
  
  //Begin serial communication with Arduino and SIM900
  Serial1.begin(9600);

  Serial.println("Initializing...");
  delay(1000);

  Serial1.println("AT"); //Handshaking with SIM900
  updateSerial();
  Serial1.println("AT+CSQ"); //Signal quality test, value range is 0-31 , 31 is the best
  updateSerial();
  Serial1.println("AT+CCID"); //Read SIM information to confirm whether the SIM is plugged
  updateSerial();
  Serial1.println("AT+CREG?"); //Check whether it has registered in the network
  updateSerial();
}

void loop()
{
  updateSerial();
}

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

this should be the output:

SIM900-GSM-Shield-Basic-AT-Commands-on-Arduino

but all i got is this:
kkkk

can you help me?

btw iim using hardware serial of the SIM900 and i also connected both gND pins of arduino Mega and SIm900

What’s the delay(500) for ?
It potentially just ignores around 500 received characters..

A sketch of your wiring could be helpful, even though you described the ground pins in the Arduino..

can you provide detials of the SIM900 module and how it is connected
e.g. using
image

the following code works

// SIM900 GSM modem test for Arduino Mega - working 15 May 2022

// serial monitor line ending should be Carriage Return Carriage Return or CR & NL

/* when you power the SIM900 the PWR LED should light
if you press the PWRKEY on the SIM900 
1. the STATUS LED should lingth
2. the Netlight should blink

and the following appear on the terminal
RDY
+CPIN: NOT INSERTED
+CFUN: 1

*/

// UART connections
// j17/j18 set D7/D8 
//     connect SIM900 TXD (pin D8) to Mega pin 19  RXD (pin D7) to pin 18
// j17/j18 set D1/D0 
//     connect SIM900 TX (pin D0) to Mega RX1 (pin 19) SIM900 RX (pin D1) toMega TX1 (pin 18)

// see https://create.arduino.cc/projecthub/mitov/send-and-receive-text-messages-sms-with-gsm-sim900-shield-6d53c6

// AT+CGMI  returns the manufacturer's name
// AT+CGMM returns the MODEM model number
// AT+CGMR returns details of the software and model revision level
// AT+CGSN returns the MODEM's serial number

#define mySerial Serial1  

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {  }
  Serial.println("Mega SIM800 test!");
  // set the data rate for the Serial port
  mySerial.begin(9600);//115200);//115200);
}

void loop() { // run over and over
  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  while (Serial.available()) {
    char ch;
    mySerial.write(ch=toupper(Serial.read()));
    Serial.write(ch);
  }
}

@horace That is the connection i used when i test the module

@lastchancename the wiring is the same as the one replied by @horace. The delay must be for entering commands only..maybe... i'll try to remove it and see what is the output.

is it the same SIM900 PCB as shown in post 3?
if so if you run the code of post 3 and press the power button you should see output similar to

RDY
+CPIN: NOT INSERTED
+CFUN: 1

@horace i tried your code and still no outpu of

i tried checking my module using a FTDI programmer and it works. Every command i entered on the serial monitor get a response from the module.

@lastchancename @horace is it okay if i use the Tx & Rx pins of the module instead of (D0,D1) and (D7,D8) to connect to the serial1 of the arduino mega?


@horace @lastchancename like this?

post 1 referred to a Mega the diagram in post 7 is a UNO which does not have a spare hardware serial port

I have used a UNO communicating with a SIM800 using AltSoftSerial on pins

//SIM800L TXD to UNO RX pin 8
//SIM800L RXD to UNO TX pin 9

I seem to remember using the same code on a SIM900

@horace i used the Tx, Rx and GND pins near the 3.5mm barrel jack to communicate with the arduino mega and it works like a charm....

`// SIM900 GSM modem test for Arduino Mega - working 15 May 2022

// serial monitor line ending should be Carriage Return Carriage Return or CR & NL

/* when you power the SIM900 the PWR LED should light
if you press the PWRKEY on the SIM900 
1. the STATUS LED should lingth
2. the Netlight should blink

and the following appear on the terminal
RDY
+CPIN: NOT INSERTED
+CFUN: 1

*/

// UART connections
// j17/j18 set D7/D8 
//     connect SIM900 TXD (pin D8) to Mega pin 19  RXD (pin D7) to pin 18
// j17/j18 set D1/D0 
//     connect SIM900 TX (pin D0) to Mega RX1 (pin 19) SIM900 RX (pin D1) toMega TX1 (pin 18)

// see https://create.arduino.cc/projecthub/mitov/send-and-receive-text-messages-sms-with-gsm-sim900-shield-6d53c6

// AT+CGMI  returns the manufacturer's name
// AT+CGMM returns the MODEM model number
// AT+CGMR returns details of the software and model revision level
// AT+CGSN returns the MODEM's serial number

#define mySerial Serial1  

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {  }
  Serial.println("Mega SIM800 test!");
  // set the data rate for the Serial port
  mySerial.begin(9600);//115200);//115200);
}

void loop() { // run over and over
  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  while (Serial.available()) {
    char ch;
    mySerial.write(ch=toupper(Serial.read()));
    Serial.write(ch);
  }
}

also i tried this code that you posted and it returns the desired output

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