Sim900A is not working

#include <SoftwareSerial.h>
//Create software serial object to communicate with SIM900A
SoftwareSerial mySerial(3, 2); //GSM Module Rx & Tx is connected to Arduino #2 & #3

void setup()
{
  //Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
  Serial.begin(9600);  
  //Begin serial communication with Arduino and SIM900A
  mySerial.begin(9600);
}

void loop()
{
  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
  }
}

sim900A has network but not communicating with arduino mega.

tried with the voltage divider also.
but not responding means AT command not working at all.

I'm powering the module with usb cable from my laptop

Show your connections in a diagram, including power supply, and a photo to verify... are you using 5v (5VR/5VT) or 3v3 (3VR/3VT) - and not the RS232 TX/RX connector.

can you give a link to the particular SIM900A module?
also if you are using a Mega why not use a hardware serial port? e..g. Serial1 on pins 18 and 19



5VR is connected to 2
5VT is connected to 3
there is a 10 uF 50v capacitor parallel to the VCC and GND of the sim900A module for stable connection.

I don't know about the Serial1 pinout.
can you please give me a details about this and how to connected and program

this is how I connect my SIM900 to a Mega
image

some modems use 3.3V logic so you have to use a potential divider on the Mega Tx signal to the modem Rx

the program I used

// 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);
  }
}

can you give a closeup photo of the SIM900A or a link to where you purchased it?

have a look at GSM-SIM900A-Arduino-Tutorial-Easy-4-Step
it appears to be the SIM900A module you are using

Mega2560 has more than one Hardware Serial port... Serial1 uses Tx = pin 18, Rx = pin 19) so you would not need SoftwareSerial.h. Your sketch was written for Uno/Nano with only one Hardware Serial port (pins 0/1)

not showing the response just print AT but not showing Ok or anything in the serial monitor

what program are you using?
how have you connected the Mega to the SIM900A? ?
image

as the Mega uses 5V logic you should connect to 5RX and 5TX
e.g. if using the program of post 6
SIM900A 5RX to Mega pin 18 TX1
SIM900A 5TX to Mega pin 19 RX1

if using the program from the link in post 7

SoftwareSerial SIM900A(10,11); // RX | TX
// Connect the SIM900A TX to Arduino pin 10 RX. 
// Connect the SIM900A RX to Arduino pin 11 TX. 

There might not be enough power from there. I believe the SIM900 requires a 2A supply.

connected exactly what you said.
but the setup is not complete because the program gets stuck in the SIM900A.begin() and not proceed further

if you try the program of post 6 connecting

SIM900A 5RX to Mega pin 18 TX1
SIM900A 5TX to Mega pin 19 RX1

can you enter AT commands and get a OK response etc

I have tried and get result with another sim900A borrowed from a person.
I think I have some issues with my module.

Is there anything I can do to fix this.
It has network and seems ok but can't communicate with arduino or other boards

possibly the baudrate has been changed - try 19200, 38400, etc
it may autobaud - on powerup try entering ATATATATATATATAT

should I change the baud rate in code or just the serial monitor?

change the baudrate to the external device
best to have serial monitor at higher baudrate than external device otherwise you may loose data as the serial monitor buffer overruns, e.g.

 Serial.begin(115200);
  // set the data rate for the Serial port
  mySerial.begin(9600);  // << try 19200, 38400, etc