-1

I am using a SIM800 GSM/GPRS module. I connected it using 4 wires: Vcc 3.7 volt (2 amp supply), RX and TX and GND. Whenever I try to send a command it shows me nothing. Here is my code.

//Serial Relay - Arduino will patch a
//serial link between the computer and the GPRS Shield
//at 19200 bps 8-N-1
//Computer is connected to Hardware UART
//GPRS Shield is connected to the Software UART

#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;
  }
}

It is an independent module. I've already read the hardware manual and AT command manual. I did everything according to the manual.

2 Answers 2

1

Are you sure the baud rate is correct? You could try 115200 and 57600. Is the serial monitor set to "Carriage Return" or "Both NL & CR"? If this isnt set, the modem won't respond to your commands since it requires a '\r' to terminate every command. Is there any indication that the modem is powered (like the net LED blinking)? Your code looks alright but, to be sure everything's okay, use this test program to interact with the modem using the serial monitor; just change your loop() to this:

    void loop(){
        while (Serial.available())
            GPRS.write(Serial.read());
        while (GPRS.available())
            Serial.write(GPRS.read());
    }

This way, everything you type in the monitor will be relayed to the modem and everything from the modem will be relayed to the PC, all via the arduino.

0

There doesn't seem to be anything wrong with your code. I'm going to assume you have got the right VCC and the right Serial speed.

Do you have a way of connecting the device directly to your PC and then using a terminal emulator to see if the device is talking?

Is there a library that you could use? Maybe there is some setting that you need that isn't documented.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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