Go Down

Topic: GSM Modem Reversed Pins (Read 366 times) previous topic - next topic

pankaj21

I have a gsm modem (sim900) connected to a Arduino Uno.
But I cannot send SMS with any normal code or standard Serial Port (pin0, pin1).
I have to use the SoftareSerial Code only with reversed pins 1, 0 to make the modem work.
Can someone point out what is wrong (hardware/software)?

My working code -

#include <SoftwareSerial.h>
SoftwareSerial SIM900(1, 0);     // THIS IS THE REVERSAL I HAVE TO DO TO MAKE THINGS WORK
                                            //  BUT IT DOESN'T WORK IF I REVERSE THE HARDWARE WIRES
 
void setup()
{
  SIM900.begin(9600); 
  delay(2000);  // give time to log on to network.
}
 
void sendSMS()
{
  SIM900.println("ATH");                        // AT command to send SMS message
  delay(1000);
  SIM900.println("AT +CMGF=1");           // AT command to send SMS message
  delay(1000);
  SIM900.println("AT +CMGS=\"+919200000000\"");                          // recipient's mobile number
  delay(9000);
  SIM900.println("This is a text message from an Arduino Uno.");        // message to send
  delay(5000);
  SIM900.println((char)26);                     // End AT command with a ^Z, ASCII code 26
  delay(100);
  SIM900.println();
  delay(5000);                                      // give module time to send SMS
}
 
void loop()
{
  sendSMS();
  do
  {
    delay(1000);
  } while (1);
}

Riva

Please edit your post and put your code in code tags </> to make it more readable.

What GSM modem are you using (links please).

If you have your UNO connected to the PC using USB then it will be using the hardware serial pins 0 & 1 so may be upsetting comms with your GSM modem. Putting software serial to also use the same pins is not the way to do it.
Don't PM me for help as I will ignore it.

Go Up