Instructables

Arduino Uno R3 connected to adh8066 GSM?

I'm trying to have my Arduino Uno R3 send SMS texts to my phone with latitude/longitude coordinates with use of the GTPA013 GPS unit. The GPS is working fine but I'm having trouble with the AT codes sent to the GSM module. I keep getting errors and not the "OK" I should be getting. Below is the code I am using if that helps. Thanks for any help!!

Greg.

#include <string.h>
#include <ctype.h>

int PWON = 13; // the pin to switch on the module (without press on button)
int rxPin = 0;                    // RX PIN
int txPin = 1;                    // TX TX

char data[256];
int x;

void setup()
{
  Serial.begin(115200);
  delay(2000);
  pinMode(PWON, OUTPUT);      // sets the digital pin as output
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  PowerModuleOn();
  delay(3000);
  InitializeGSM();
}

void loop()
{
 
}

void PowerModuleOn()
{
  digitalWrite(PWON, LOW); //Pull PWON low
  delay(2000);  //Delay 300 ms
  digitalWrite(PWON, HIGH);  // Pull PWON high, Powers up GSM Module
}

void InitializeGSM()
{
  Serial.println("AT");
  Serial.flush();
  for (x=0;x < 255; x++){
    data[x]='\0';
  }
  /*if(Serial.available() > 0)
  {
    Serial.println("Data Available");
  }
  else{
    Serial.println("No data coming from GSM Module");
  }*/
  x=0;
  do{
    while(Serial.available()==0);
    data[x]=Serial.read();
    x++;
    if(data[x-1]==0x0D&&data[x-2]=='"'){
      x=0;
    }
  }while(Serial.available()>0);
  Serial.println(data);
  delay(10000);
}

First thing: check your codes and interface setup are correct. Use a terminal emulator and talk to the GSM directly, to see how it replies to your interface calls.

Odds on, you've got handshaking turned on on the phone, or the baudrate isn't defaulting to the one you think it is.

Only certain configurations of AT commands yield a plain text "OK" on successful reception.
gregs1992 (author)  steveastrouk1 year ago
I am a noob when it comes to this stuff. I tried downloading a terminal emulator but I cannot figure out how to work it. Can you suggest something that is user friendly?
There's one in most standard Windows - go to Accessories|communications|hyperterminal
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!