GSM A6 is able to send SMS but doesn't receive

a6

#1

I am from Tunisia, I have a problem with my GSM A6, it only sends sms and produce calls when connected to (0,1) pins of Arduino as RX and TX … when I change connection to (10,11) pins using SoftwareSerial.h it does not works ! that’s would not make big prblem coz I can pull off (0,1) pins while uploding program ! My main problem is that the module didn’t receive sms when I use your program or any other one ! please does onyone encouter a similar problem ?
need a help !
Thankx :slight_smile:


#2

Hi,
Can you please first confirm that AT Commands are working fine when connected to a PC using terminal software?
Then go through this checklist to make sure module working fine.
Although they are for SIMCOM, they should apply here too.

After this only should you proceed to make calls.
My example codes are only for demonstration. I don’t take care of the initialization delay.
In your code, you should wait for module to initialize before sending command after power up.


#4

My problem was with this setting in the Serial Monitor ! I fixe it now :smiley:

Capture


#5

Glad you got it working :slight_smile:


#6

Hello again Mr Ravi, I hope you manage time to read all this haha !
I have a problem again ! I can’t find a logical answer ! When I tried to comuunicatie with the module last month with AT commands, sometimes respond and sometime no !
I had doubs in wires so I fixed all components in an electronic board ! the problem is still remaining ! but what won’t make me doubt of the module it self is that when I use your programm and I send sms to the board it works ! and show command on serial monitor but the module didn’t send an sms or make call ! it only receive !
I searched in forums and I spotted a problem of firmware update or modifiying in library !

////// discussion in forum : {Replace GSM gsmAccess; with GSM gsmAccess(true);
then you will see the data that will be sent to and recieved from gsm module.
What I saw was that at one point (when the hang happens) there is AT command sent but nothing is recieved from module. I guess that the library stays waiting for the reply but nothing happens. for whatever reason I do not have proper solution yet } ////////

I want to know if is there a possibility that the module is partially damaged because it only receive and don’t send ?! maybe that’s why it doens not respond to the AT commands !
thank u again


#7

Hello,
I don’t think one part of the module will be damaged. Its the same hardware doing trasnmission and reception. Just two software parts handling different tasks on the same hardware.
You can check SIM balance or put SIM card in another phone and try sending a SMS. it should confirm your doubts.


#8

Hi again Ravi,
I checked the sim and even used other one … problem still remaining :confused: it works one time and fail in 10 others ! ( here screen shot catched when it works suddenly now ) of a simple programme to use AT command and monitor serie !


#9

this one when I received a call and it already respond to AT by OK


#10

Hello Ravi,
the problem seems resolved when I press Reset to GSM Module ( 0V to Reset pin) and the module communicate proeprly with Serial monitor but whith some strange charachters in beginning… your programm runs properly but the problem is when I reboot the GSM Module ( unplug and plug the power supply) or press Reset, the programm doesn’t work !! until I upload another programm which use communication with Serial Monitor, and then I upload your programm to work again ! is it problem of synchronization between Module and Arduino when the module start powered ?

Here is the programm : (I previously set the baud rate to 9600 with AT+IPR =9600)

  #include <SoftwareSerial.h>
  SoftwareSerial mySerial(10, 11);  // RX-Pin10, TX-Pin11
  unsigned char Buff[250];
  unsigned char BuffIndex;
  boolean Act = false;
  
  void setup()
  {
//Serial.begin(9600);
mySerial.begin(9600);   
pinMode(9, OUTPUT);
digitalWrite(9,HIGH);     
    //Serial.println("GSM Tutorial, Valetron Systems @www.raviyp.com ");
    //delay(3000);
    mySerial.println("AT+CMGF=1");
    delay(3000);
    mySerial.println("AT+CNMI=2,2,0,0,0");
    memset(Buff, '\0', 250);    // Initialize the string
    BuffIndex=5;
  }
  
void SMS_On() {
  mySerial.println("AT+CMGF=1");
  delay(1000);
  mySerial.print("AT+CMGS=\"my phone number");
  mySerial.print(char(34));  // "
  mySerial.print(char(13));  // CR
  mySerial.print('\r');  // hex equivalent of newline
  delay(1000);
  mySerial.println("Motor On");
  delay(500);
  mySerial.println(char(26));  //ctrl_z
 }

  void SMS_Off() {
  mySerial.println("AT+CMGF=1");
  delay(1000);
  mySerial.print("AT+CMGS=\"my phone number");
  mySerial.print(char(34));  // "
  mySerial.print(char(13));  // CR
  mySerial.print('\r');  // hex equivalent of newline
  delay(1000);
  mySerial.println("Motor Off");
  delay(500);
  mySerial.println(char(26));  //ctrl_z
}  
 
  void loop()
  {
 
      while(1)
      {
          if(mySerial.available()>0)
          {
              Buff[BuffIndex] = mySerial.read();    
          
              if((Buff[BuffIndex-1] == 'O') && (Buff[BuffIndex] == 'n'))
              {
                  //Serial.print('\n');
                  //Serial.write(Buff[BuffIndex-1]);
                  //Serial.write(Buff[BuffIndex]); 
                  Act=true;
                  if(Act==true)
                  {
                  SMS_On();
                  digitalWrite(9,LOW);
                  Act=false;  
                  }                    
              }
              
              if( (Buff[BuffIndex-2] == 'O') && (Buff[BuffIndex-1] == 'f') && (Buff[BuffIndex] == 'f'))
              {
                  //Serial.print('\n');
                  //Serial.write(Buff[BuffIndex-2]);
                  //Serial.write(Buff[BuffIndex-1]);
                  //Serial.write(Buff[BuffIndex]);
                  Act=false;
                  if(Act==false)
                  {
                  SMS_Off();
                  digitalWrite(9,HIGH);
                  Act=true;  
                  }        
              }
  
              BuffIndex++;
              if(BuffIndex>250) 
              {
                  BuffIndex=5;
              }
          }
      } 
  }

#11

You need to have sufficient delay before you send any AT command to module on bootup. This much would be enough for it to work properly. I see that you have commented out startup delays.


#13

Hello again, I rewrite it but nothing happened ! module don’t work if I reset it or unpluged and pluged it so I need to upload a sketch and communicate with AT command before I repeat ! I searched in many forums but didn’t faced a similar issue ! have you an idea ?
I used serial monitor to show what buffer receive after
if(mySerial.available()>0)
Buff[BuffIndex] = mySerial.read();

with this command :
Serial.write(Buff[BuffIndex-2]);
Serial.write(Buff[BuffIndex-1]);
Serial.write(Buff[BuffIndex]);

The serial monitor show correctly what I send to the module alongside with AT commands and my motor runs correctly with On and Off messages but when I reset the module or unplug it it shows strange characters ! so this is what I am asking for ! why the contained in the buffer become strange charachters when I reset the module ! please if you understand what I mean answer me my friend !
here the screen shots !
thank you :smile:


#14

When I send " On " to the module !
it show " OnOnn " with other AT command !!!


#15

When I send " Off "

" to the module !


#16

After I reset the module or unplug it and I send again “On” !


#17

Disable Echo mode using ATE0 command.


#18

Hello Ravi,
I tried this command at setup function :
mySerial.println(“ATE0”);
mySerial.println(“AT&W”);

then I tried this one as noticed in some forums:
mySerial.println(“ATE0\r\n”);
mySerial.println(“AT&W\r\n”);

but nothing has changed :frowning:


#19

You should stop getting double characters atleast :slight_smile: