Receive SMS with SIM800L v2

Hello everybody,

First of all, thanks for reading me, and for helping !

I use a module SIM800L v2 and an Arduino Uno.

I have succeed to send a SMS and call. So instructions were sent from the Arduino to the module.

The issue is to receive SMS. It seems that the Arduino IDE Monitor doesn't receive any informations from the module.

This is the code I use :

#include <SoftwareSerial.h>
SoftwareSerial sim800l(2, 3);
 
void setup() {
  sim800l.begin(9600);
  Serial.begin(115200);
 
  Serial.println("Starting ...");
  delay(5000);
 
  sim800l.println("AT");e
  Serialcom();
 
  sim800l.print("AT+CMGF=1");
  Serialcom();
 
  sim800l.print("AT+CNMI=2,2,0,0,0");
  Serialcom();
}
 
void loop() {
  Serialcom();
}
 
void Serialcom()
{
  delay(500);
 
  while(Serial.available()) {
    sim800l.write(Serial.read());
  }
 
  Serial.println(sim800l.available());
 
  while(sim800l.available()) {
    Serial.write(sim800l.read());
  }
}

In the serial monitor, it's written : "Starting..."
And then in a loop : "0" due to the line :

Serial.println(sim800l.available());

The alimentation of the module is external, and can supply up to 3A. There is a link between the Arduino GND and the module GND.

Is somebody can help me ?

Thanks again, Nicolas

Try with println not just print for the AT commands

2 Likes

Hello !

Some news, I have tried to activate the echo mode with the command :
ATE1
I have tried the command ATQ0 too :

This parameter setting determines whether or not the TA transmits any result
code to the TE. Information text transmitted in response is not affected by
this setting.
If =0: OK (TA transmits result code)
If =1: (none) (Result codes are suppressed and not transmitted)

I changed nothing... I'm desperate

I will receive an other SIM800L the 7th of july, I will try with this new one

Show us the output on the serial monitor when using println in your first code

Did you change anything in the wiring since then?

Because after setup line: sim800l.println("AT"); you should receive at least an OK response.
This command is sent with Carriage Return, so it is a valid command.

However in your Serialcom() function a command termination is sent again after 500ms and the response is only read after that.

Going forward with this:

sim800l.print("AT+CMGF=1");
Serialcom();

First you sent the command, delay 500ms in Serialcom(), but only terminated the command after delay and the response is immediately checked (which was probably not there yet). However with the next Serialcom() call, the response from the previous command should be arrived.

I would change the function, so it does not send termination to avoid confusion.
Instead send single line commands with println, as @J-M-L pointed out.
And from Serial Monitor send the command with termination (can be selected).

void Serialcom()
{
  delay(500);
 
  while(Serial.available()) {
    sim800l.write(Serial.read());
  }
 
  //don't terminate here
  //Serial.println(sim800l.available());
 
  while(sim800l.available()) {
    Serial.write(sim800l.read());
  }
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.