0

For some reason I cannot establish serial connection between the two devices. The shield is connected to the network because my number can be called, but I cannot send it any commands via the serial. I tried several ways to wire it up: shield rx&tx (the ones that require female jumper) to 7 & 8 of arduino, declaring 7 & 8 in the serial. shield pins 7 & 8 (they have (serial) as label) to 7 & 8 of arduino, declarting 7 & 8 in the serial. shield rx&tx the little holes to 7 & 8 of arduino, declaring 7 & 8 in the serial. Tried even different pins other than 7 & 8. None worked. I'm powering the shield with 12v transformator that can provide up to 3Ah and the arduino is connected to laptop. Any suggestions ? Here's the code:

#include <SoftwareSerial.h>

//Create software serial object to communicate with SIM900
SoftwareSerial mySerial(7, 8); //SIM900 Tx & Rx is connected to Arduino #7 & #8

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

  //Begin serial communication with Arduino and SIM900
  mySerial.begin(9600);

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

  mySerial.println("AT"); //Handshaking with SIM900
  updateSerial();

  mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
  updateSerial();
  mySerial.println("AT+CMGS=\"+ZZxxxxxxxxxx\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms
  updateSerial();
  mySerial.print("Last Minute Engineers | lastminuteengineers.com"); //text content
  updateSerial();
  mySerial.write(26);
}

void loop()
{
}

void updateSerial()
{
  delay(500);
  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
  }
}

And also, why are there so many RX/TX on the shield ? I see RXD/TXD and RX/TX.

0

And also, why are there so many RX/TX on the shield ? I see RXD/TXD and RX/TX.

There aren't. There is only one of each. They just have them in multiple convenient places.

J11 selects the pins to use on the shield. Make sure that is set to D7 and D8. You then use pins D7 and D8 on the shield. Normally that would be mounted directly onto an Arduino and you would just use those pins in your code.

However, if you want to attach it to something that doesn't have an Arduino UNO footprint you can solder wires to the TX/RX pins in the J10/J17 "UART" header. That ignores the J11 jumpers, which only pertain to using the Arduino UNO shield headers.

As to why you can't communicate, my guess is:

  • You have 9600 baud in your code:

mySerial.begin(9600);

However, on the Amazon product you linked to:

The factory default setting for the GPRS Shield UART is 19200 bps 8-N-1. (Can be changed using AT commands).

Using 19200 instead of 9600 should improve matters somewhat.

  • It doesn't improve anything. I've tried ALL the rates. If there was a mismatch, I'd at least see some squares or other strange shapes, but I don't see anything on the serial at all! – decata plachat Jan 8 at 22:46
  • Does your shield have jumpers on J11? The picture shows them missing. – Majenko Jan 8 at 22:54
  • Compare it to the one shown in this tutorial: randomnerdtutorials.com/sim900-gsm-gprs-shield-arduino – Majenko Jan 8 at 22:54
  • I pulled out all the wires so I could take a picture. imgur.com/a/jhpzyI7 That's how j11 and j12 look. I've tried plugging females to the pointy ones. The tutorial above has some jumper caps that I have no idea what they are. edit: I took a closer look and itseems mine are not in the same position, but I never thought these could be plugged out and replugged in, lol. That's the first thing I am going to try after work. Could you explain about those ? – decata plachat Jan 8 at 23:00
  • Looks like its set right. Just plug it direct into your arduino. No need for wires. – Majenko Jan 8 at 23:05

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.