-1
\$\begingroup\$

This question already has an answer here:

Problem:

I have this ATK-SIM900A GSM / GPRS module which will be used to send sms. But I can't figure out how to interface it with an Arduino as there are no documentation available online.

Module Specification

ATK-SIM900A GSM/GPRS Board from Alientek

sim900a

Things I've tried so far

Connection

I've tried connecting the module with Arduino in following manner SIM900A TX <-> Arduino RX SIM900A RX <-> Arduino TX SIM900A GND <-> Arduino GND

I've powered up the ATK-SIM900A module with 12V-2A DC supply

Programming

  1. Tried SoftwareSerial library
  2. Tried a some GSM libraries and programs

What I'm doing wrong? Any kind of help will be much appreciated.

Why it isn't a duplicate of other questions:

I am working with ATK-SIM900A GSM / GPRS module, it has different features and pinout than the module asked in those questions. I've tried the solution stated in this question (Connecting GSM SIM900A module with Ardunio), it didn't work.

\$\endgroup\$

marked as duplicate by PeterJ, Bence Kaulics, Daniel Grillo, Dave Tweed Sep 12 '16 at 12:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ If it came without any documentation throw it away and buy a unit with documentation. \$\endgroup\$ – Leon Heller Sep 11 '16 at 11:50
  • \$\begingroup\$ @LeonHeller, throwing away is not a solution, only this kind of module is available in my country. I hope someone has used it and has a workable solution. Thanks anyway. \$\endgroup\$ – Manash Mandal Sep 11 '16 at 12:43
  • \$\begingroup\$ What exactly did you try from the other question? \$\endgroup\$ – hcabral Sep 11 '16 at 12:46
  • \$\begingroup\$ @hcabral Tried to connect the module through RS-232 Serial port. \$\endgroup\$ – Manash Mandal Sep 11 '16 at 12:50
  • \$\begingroup\$ @Manash Did you use the level converters the answers to that question were talking about? \$\endgroup\$ – hcabral Sep 11 '16 at 12:57
2
\$\begingroup\$

Solution

I am just posting the solution if anyone needs it. Everyone seems to downvote the problem instead of giving solutions.

  • First of all, remove all the jumpers [see the picture]

rem

  • Then add two Male to Female cable to the S-TX and S-RX [Here S stands for SIM900, you can find the pins after removing the jumpers.]

  • Short the grounds of both arduino and ATK-SIM900A module

  • S-TX must be connected to the arduino RX and S-RX must be connected to the arduino TX.

  • Normally power up the module [Don't forget to press PWR Key afterwards]

Code

#include <SoftwareSerial.h>
#define BAUD 9600
#define RX 10
#define TX 11

SoftwareSerial gsm(RX, TX);

int8_t sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout) {

  uint8_t x = 0,  answer = 0;
  char response[100];
  unsigned long previous;

  memset(response, '\0', 100);    // Initialize the string

  delay(100);

  while ( gsm.available() > 0) gsm.read();   // Clean the input buffer

  gsm.println(ATcommand);    // Send the AT command


  x = 0;
  previous = millis();

  // this loop waits for the answer
  do {
    // if there are data in the UART input buffer, reads it and checks for the asnwer
    if (gsm.available() != 0) {
      response[x] = gsm.read();
      x++;
      Serial.println(response);
      // check if the desired answer is in the response of the module
      if (strstr(response, expected_answer) != NULL)
      {
        answer = 1;
      }
    }
    // Waits for the asnwer with time out
  } while ((answer == 0) && ((millis() - previous) < timeout));

  return answer;
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(BAUD);
  gsm.begin(BAUD);
}


//Code for sending sms, replace the stars and country code with your corresponding phone number

void loop() 
{
  sendATcommand("AT+CMGF=1\r\n", "OK", 500);
  sendATcommand("AT+CMGS=\"+880******582\"\r", "OK", 500);
  delay(500);
  gsm.println("Hello world"); //The message to be sent
  delay(500);
  gsm.println((char)26); // Done
  delay(500);
}

Thanks to all.

\$\endgroup\$
  • \$\begingroup\$ At first you wrote to connect SRX to ATX and STX to ARX. But in your code you defined 10 as RX and 11 as TX! Is there any purpose for it? \$\endgroup\$ – opu 웃 Jul 17 '18 at 14:09

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