Search code examples
arduinogsmarduino-unogprssim900

Arduino Uno R3 + SIM900


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?


Solution

  • 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!