Skip to main content
deleted 18 characters in body
Source Link
dda
  • 1.6k
  • 1
  • 12
  • 18

I'll tell you what worked for me, because I didn't foundfind the schematicschematics of this board. But your board may work differently, so it is always good to check the datasheet and the schematic (if you have one).

#include <SoftwareSerial.h>

SoftwareSerial GPRS(7, 8);         //7 = TX, 8 = RX
unsigned char buffer[64]; port
int count=0;     
int i = 1;                         //if i = 0, send SMS.
void setup(){
  //delay(10000);
  GPRS.begin(19200);               // the GPRS baud rate   
  Serial.begin(19200);             // the Serial port of Arduino baud rate.
  Serial.print("I'm ready");
  Serial.print("Hello?"); 
}

void loop(){
  if (GPRS.available()){         // if date is comming from softwareserial port ==> data is comming from gprs shield
  
    while(GPRS.available()){          // reading data into char array 
      buffer[count++]=GPRS.read();     // writing data into array
      if(count == 64)break;
    }
  Serial.write(buffer,count);            // if no data transmission ends, write buffer to hardware serial port
  clearBufferArray();              // call clearBufferArray function to clear the storaged data from the array
  count = 0;                       // set counter of while loop to zero

 
} 

if (Serial.available())            // if data is available on hardwareserial port ==> data is comming from PC or notebook
  GPRS.write(Serial.read());       // write it to the GPRS shield
 
  if(i == 0){
    GPRS.print("AT+CMGF=1\r"); //sending SMS in text mode
    Serial.println("AT+CMGF=1\r"); 
    delay(1000);
    GPRS.print("AT+CMGS=\"+554988063979\"\r"); // phone number
    Serial.println("AT+CMGS=\"+554988063979\"\r"); 
    delay(1000);
    GPRS.print("Test\r"); // message
    Serial.println("Test\r"); 
    delay(1000);
    GPRS.write(0x1A); //send a Ctrl+Z(end of the message)
    delay(1000);
    Serial.println("SMS sent successfully");
    i++;
  }   
 
} 

void clearBufferArray(){              // function to clear buffer array
  for (int i=0; i<count;i++){
    buffer[i]=NULL;                  // clear all index of array with command NULL
  }
}

I'll tell you what worked for me, because I didn't found the schematic of this board. But your board may work differently, so it is always good to check the datasheet and the schematic (if you have one).

#include <SoftwareSerial.h>

SoftwareSerial GPRS(7, 8);         //7 = TX, 8 = RX
unsigned char buffer[64]; port
int count=0;     
int i = 1;                         //if i = 0, send SMS.
void setup(){
  //delay(10000);
  GPRS.begin(19200);               // the GPRS baud rate   
  Serial.begin(19200);             // the Serial port of Arduino baud rate.
  Serial.print("I'm ready");
  Serial.print("Hello?"); 
}

void loop(){
  if (GPRS.available()){         // if date is comming from softwareserial port ==> data is comming from gprs shield
  
    while(GPRS.available()){          // reading data into char array 
      buffer[count++]=GPRS.read();     // writing data into array
      if(count == 64)break;
    }
  Serial.write(buffer,count);            // if no data transmission ends, write buffer to hardware serial port
  clearBufferArray();              // call clearBufferArray function to clear the storaged data from the array
  count = 0;                       // set counter of while loop to zero

 
}
if (Serial.available())            // if data is available on hardwareserial port ==> data is comming from PC or notebook
  GPRS.write(Serial.read());       // write it to the GPRS shield
 
  if(i == 0){
    GPRS.print("AT+CMGF=1\r"); //sending SMS in text mode
    Serial.println("AT+CMGF=1\r"); 
    delay(1000);
    GPRS.print("AT+CMGS=\"+554988063979\"\r"); // phone number
    Serial.println("AT+CMGS=\"+554988063979\"\r"); 
    delay(1000);
    GPRS.print("Test\r"); // message
    Serial.println("Test\r"); 
    delay(1000);
    GPRS.write(0x1A); //send a Ctrl+Z(end of the message)
    delay(1000);
    Serial.println("SMS sent successfully");
    i++;
  }   
 
}
void clearBufferArray(){              // function to clear buffer array
  for (int i=0; i<count;i++){
    buffer[i]=NULL;                  // clear all index of array with command NULL
  }
}

I'll tell you what worked for me, because I didn't find the schematics of this board. But your board may work differently, so it is always good to check the datasheet and the schematic (if you have one).

#include <SoftwareSerial.h>

SoftwareSerial GPRS(7, 8);         //7 = TX, 8 = RX
unsigned char buffer[64]; port
int count=0;     
int i = 1;                         //if i = 0, send SMS.
void setup(){
  //delay(10000);
  GPRS.begin(19200);               // the GPRS baud rate   
  Serial.begin(19200);             // the Serial port of Arduino baud rate.
  Serial.print("I'm ready");
  Serial.print("Hello?"); 
}

void loop(){
  if (GPRS.available()){         // if date is comming from softwareserial port ==> data is comming from gprs shield
  
    while(GPRS.available()){          // reading data into char array 
      buffer[count++]=GPRS.read();     // writing data into array
      if(count == 64)break;
    }
  Serial.write(buffer,count);            // if no data transmission ends, write buffer to hardware serial port
  clearBufferArray();              // call clearBufferArray function to clear the storaged data from the array
  count = 0;                       // set counter of while loop to zero
} 

if (Serial.available())            // if data is available on hardwareserial port ==> data is comming from PC or notebook
  GPRS.write(Serial.read());       // write it to the GPRS shield
  if(i == 0){
    GPRS.print("AT+CMGF=1\r"); //sending SMS in text mode
    Serial.println("AT+CMGF=1\r"); 
    delay(1000);
    GPRS.print("AT+CMGS=\"+554988063979\"\r"); // phone number
    Serial.println("AT+CMGS=\"+554988063979\"\r"); 
    delay(1000);
    GPRS.print("Test\r"); // message
    Serial.println("Test\r"); 
    delay(1000);
    GPRS.write(0x1A); //send a Ctrl+Z(end of the message)
    delay(1000);
    Serial.println("SMS sent successfully");
    i++;
  }   
} 

void clearBufferArray(){              // function to clear buffer array
  for (int i=0; i<count;i++){
    buffer[i]=NULL;                  // clear all index of array with command NULL
  }
}
WRONG AMPS rate !!! very critical !
Source Link
SoreDakeNoKoto
  • 2.4k
  • 2
  • 14
  • 23

Be sure to use an external source of 5V output with at least 2A (It usessource that can supply up to 2A during short periods of times called "Tx burst", when it Transmit data trough the antena ;) )without dipping significantly.

Be sure to use an external source of 5V output with at least 2A (It uses 2A during short periods of times called "Tx burst", when it Transmit data trough the antena ;) )

Be sure to use an external 5V source that can supply up to 2A without dipping significantly.

Be sure to use an external source of 5V output with at least 1A2A (I used a 3AIt uses 2A during short periods of times called "Tx burst", when it Transmit data trough the antena ;) )

Be sure to use an external source of 5V output with at least 1A (I used a 3A)

Be sure to use an external source of 5V output with at least 2A (It uses 2A during short periods of times called "Tx burst", when it Transmit data trough the antena ;) )

deleted 116 characters in body
Source Link
Avelino
  • 242
  • 1
  • 3
  • 10
Loading
Source Link
Avelino
  • 242
  • 1
  • 3
  • 10
Loading