I am using an Arduino Uno with a SIM900A module. I want to send a simple SMS but it is not working, as it either has no response in Serial monitor or there are reversed question marks. I have attached a picture of my setup.
My module didn't work on day, then worked for a day and then now has stopped working, but it is not a hardware issue, as the board switches on and when I try to call the connected SIM, a ring is heard, meaning it has been connected.
I am using a 12V 2A power supply for the board, but I have previously tried with a 12V 1.5A power supply as well, and at the beginning even tried with the Arduino 5V pin. So I do not believe it is a power supply issue either.
Next, I checked the wiring. I confirmed the wires were working by testing them on another sensor, and then used them for this module. I also checked the connections. I have connected the GND pin of the SIM900A to the GND of the Arduino, connected the RX to D9 and then connected the TX to D10. This worked at first, but now shows no response in Serial monitor, so then I tried to reverse the pins (RX to D10 and TX to D9) while keeping the code the same, which produced reversed question marks. But then, upon trying again, this also produced no response.
One of the common online answers was a mismatch in baud rates, so I tried changing the GSM's baud rate from 9600 to everything up to 115200. When the reversed question marks were produced, changing the baud rate just produced weirder characters, and now, as there is no response at all, changing the baud rate has no impact.
I have also tried using pins 2 & 3 and 7 & 8 instead of 9 & 10, but there is no difference.
The code I am currently using is as follows, and is copied directly from here, but I have tried multiple other codes from different solutions to no avail:
SoftwareSerial mySerial(9, 10);
void setup()
{
mySerial.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':
mySerial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000); // Delay of 1 second
mySerial.println("AT+CMGS=\"+91xxxxxxxxxx\"\r"); // Replace x with mobile number
delay(1000);
mySerial.println("Technolab creation");// The SMS text you want to send
delay(100);
mySerial.println((char)26);// ASCII code of CTRL+Z for saying the end of sms to the module
delay(1000);
break;
case 'r':
mySerial.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS
delay(1000);
break;
}
if (mySerial.available()>0)
Serial.write(mySerial.read());
}
Please help me out, I've tried everything I can think of.
