R4 + GSM shield SIM900

Hi,
Has anyone tried connecting Arduino Uno R4 to the SIM900 shield? It works fine for me with Arduino Uno R3. When using the same shield, the same code, and the same pins, the SIM900 doesn't send or receive SMS on Arduino Uno R4.

Example code:

//Program to send and receive SMS using SIM900A, Arduino and a terminal
//https://ee-diary.blogspot.com

#include <SoftwareSerial.h>

//configure software serial on Arduino pin 8 and 7 to communicate with SIM900
SoftwareSerial sim900(7,8); //Rx, Tx

void setup()
{
  //configure serial communication with terminal
  Serial.begin(9600);
  //configure serial communication with SIM900A GSM module
  sim900.begin(19200);
  Serial.println("Initializing...ok"); 
  delay(1000);
  Serial.println("Press 's' to send and 'r' to receive SMS"); 
}

void loop()
{
  if (Serial.available()>0)
         switch(Serial.read()){
          case 's':
            sendSMS();
            break;
          case 'r':
            recieveSMS();
            break;
         }
}

void serialPrint()
{
  delay(500);
  while (Serial.available()) 
  {
    sim900.write(Serial.read());//send typed text on terminal to SIM900A
  }
  while(sim900.available()) 
  {
    Serial.write(sim900.read());//send received text on SIM900A to terminal
  }
}

 void sendSMS(){
          sim900.println("AT+CMGF=1");    //Sets GSM Module in SMS Mode
          serialPrint();
          sim900.println("AT+CMGS=\"+XXXXXXXXXXXXX\""); // set phone number to send SMS
          serialPrint();
          sim900.println("From Sim900A: ee-diary");// SMS content
          sim900.write(26);// CTRL+Z ascii code to exit SMS mode
          serialPrint();
      }

 void recieveSMS(){
          sim900.println("AT+CMGF=1");  //set GSM module in SMS mode
          serialPrint();
          sim900.println("AT+CNMI=1,2,0,0,0");  //select SMS read mode to show received SMS
          serialPrint();
      }

"Solved, I connected the shield to pins 0 and 1 and modified the code. It's working now."

Hola, ¿qué tal? Me alegro de que lo hayas solucionado, a mí me está ocurriendo el mismo problema, podrías mostrarme más detalles de la conexión que hiciste entre el shield y el Arduino, como también el cambio en el código. Te lo agradecería mucho, ya que aún no logro utilizar el sim900 en mi Arduino R4.

Hello, use the above-mentioned sketch. Connect the TX pin on the shield to the RX pin on the Arduino, and then connect the RX pin to TX. GND to GND. Power the shield with a 9V source. Pay attention to the correctly set jumpers J11 and J12. They must be on D1 (RX) and D0 (TX).

edit: One more important thing, set sim900.begin(57600);

You changed SoftwareSerial sim900(7,8) to SoftwareSerial sim900(0,1), and another question, what would be the tx and rx pin of the shield sim900?

fixed code:

//Program to send and receive SMS using SIM900A, Arduino and a terminal
//https://ee-diary.blogspot.com

#include <SoftwareSerial.h>

//configure software serial on Arduino pin 0 and 1 to communicate with SIM900
SoftwareSerial sim900(0,1); //Rx, Tx

void setup()
{
  //configure serial communication with terminal
  Serial.begin(9600);
  //configure serial communication with SIM900A GSM module
  sim900.begin(57600);
  Serial.println("Initializing...ok"); 
  delay(1000);
  Serial.println("Press 's' to send and 'r' to receive SMS"); 
}

void loop()
{
  if (Serial.available()>0)
         switch(Serial.read()){
          case 's':
            sendSMS();
            break;
          case 'r':
            recieveSMS();
            break;
         }
}

void serialPrint()
{
  delay(500);
  while (Serial.available()) 
  {
    sim900.write(Serial.read());//send typed text on terminal to SIM900A
  }
  while(sim900.available()) 
  {
    Serial.write(sim900.read());//send received text on SIM900A to terminal
  }
}

 void sendSMS(){
          sim900.println("AT+CMGF=1");    //Sets GSM Module in SMS Mode
          serialPrint();
          sim900.println("AT+CMGS=\"+XXXXXXXXXXXXX\""); // set phone number to send SMS
          serialPrint();
          sim900.println("From Sim900A: ee-diary");// SMS content
          sim900.write(26);// CTRL+Z ascii code to exit SMS mode
          serialPrint();
      }

 void recieveSMS(){
          sim900.println("AT+CMGF=1");  //set GSM module in SMS mode
          serialPrint();
          sim900.println("AT+CNMI=1,2,0,0,0");  //select SMS read mode to show received SMS
          serialPrint();
      }

My question is about the tx and rx that is used to connect to the arduino one R4, I have it connected in this way, I do not know if it will be the correct one.

I think it's okay.


I get this response from the serial monitor and I do not receive any SMS to the number indicated. Any suggestion or test? Maybe try another type of connection?

Could you please show me the connection you used (wires, pins, jumper) between the shield and the arduino R4, I have been trying 2 days in a row and I still can't get it, I am suspecting my shield is damaged.

check that the power LED is lit and the control LED that lights up after pressing the side button. I also had to use a 9V supply (for shield) because 5V was not enough.