3
votes

I'm a programmer trying hardware

I'm trying to connect a SIM900 shield I bought online. So I've followed plenty of tutorials out there to connect the SIM shield with the Arduino UNO.

Well, it's not going so well.

I've put an unlocked sim in it, and the netlight led blinks 3 in 3 seconds meaning its found the network.

I have also set the pins to D7 and D8, as plenty of people indicate. I am also using a power supply of 9v with 1A.

But when I try to run a simple basic example codes, they don't execute as normally.

I run this example code:

#include <SoftwareSerial.h>

SoftwareSerial GPRS(7, 8);

unsigned char buffer[64];  // buffer array for data receive over serial port
int count=0;               // counter for buffer array 

void setup()
{
  GPRS.begin(19200);
  Serial.begin(19200);
}

void loop()
{
  if (GPRS.available())
  {
    while(GPRS.available())
    {
      buffer[count++]=GPRS.read();
      if(count == 64)break;
    }
    Serial.write(buffer,count);
    clearBufferArray();
    count = 0;
  }
  if (Serial.available())
    GPRS.write(Serial.read());
}

void clearBufferArray() 
{
  for (int i=0; i<count;i++)
  {
    buffer[i]=NULL;
  }
}

After that I type

AT

in the Serial Monitor with the 19200 baud selected and it prints this enter image description here (Two ??)

Seems like the commands aren't being sent ...

Here is how I have stuff built enter image description here enter image description here

Please help!! What am I doing wrong?

1
You're supposed to use a 2 A supply. But still you're most likely using the wrong baud rate with the module. Try 9600 and 115200, in GPRS.begin()SoreDakeNoKoto
Make sure that you are sending CR/LF after AT. Sometimes your GSM module is set to specific baud-rate in this case you can do AT\r 2-3 times then it will do auto baud-rate and you receive OK response for the same. Also it's worth giving a try the suggestion from @TisteAndiiHallMark

1 Answers

2
votes

I fixed it!

I went in to my GSM library (located in the libraries folder) and, in the GSM.cpp changed the rx and tx pin the 7 and 8, accordingly. Thanks for helping!