A6 GSM/GPRS Module (Send an SMS)
 Page :   [ 1 ]    [ 2 ]  

I'll need to use SoftwareSerial which is a bit problematic at 115200 so setting the module to a lower baud rate is necessary.

To do this issue the following AT commands:

AT+IPR=57600
AT&W

The AT&W writes this permanently.

Well supposedly it writes it to a user profile however it seems that it gets reset constantly.  I experimented a bit with changing the baud rate when the arduino started up but that was just too much of a kludge so I decided to use an ISP programmer to load the sketches to the arduino and used SoftwareSerial with a serial breakout to monitor output from the module.

So hooking it up went like this:

 Arduino       A6 Module
------------------------
Pin 0 (RX)       U_TXD
Pin 1 (TX)       U_RXD


 Arduino       Serial Breakout
------------------------------
Pin 10 (RX)       TXD
Pin 11 (TX)       RXD


Also make sure everything has a common GND.

The ISP programming is done with a USBTinyISP.  This also powers the arduino.

And now here is a super simple sketch to send an SMS.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // rx tx

String phone = "+12065555555";

void setup() {

  Serial.begin(115200); // to A6 module
  while (!Serial) {
    ; 
  }
  
  mySerial.begin(115200); // serial breakout with SoftwareSerial (for monitoring)
  
  Serial.println("AT+CMGF=1");    
  delay(200);
  Serial.println("AT+CMGS=\"" + phone + "\"\r");
  delay(200);
  Serial.print("test message from A6");
  Serial.println (char(26)); // ctrl-z

}

void loop(){

  if (Serial.available()) {
    mySerial.write(Serial.read());
  }

  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }

}

Simple enough.

Mission accomplished.  Sending an SMS with this module!

 

(Page 2 of 2)