3

I am on a very exciting project, by the SIM800L module is resisting hard !

The hardware :

  • clone arduino nano (dx.com)
  • SIM800L module + antenna (dx.com)
  • Lipo battery 3.7V 150mAh (letmeknow.com)

SIM800L picture

The problem :

the SIM800L module does not respond to AT commands.

In detail, sometimes the serial is available, put print nothing on the Serial monitor.

The code :

#include <SoftwareSerial.h>

String Arsp, Grsp;
SoftwareSerial gsm(11, 12); //  RX, TX

void setup() {

  Serial.begin(9600);
  Serial.println("Setup");
  Serial.println("Testing GSM SIM800L");

  pinMode(LED_BUILTIN, OUTPUT);

  gsm.begin(9600);
}

void loop() {
  // turn on the led
  digitalWrite(LED_BUILTIN, HIGH);

  if(gsm.available())
  {
    Serial.println("gsm available");
    Grsp = gsm.readString();
    Serial.println(Grsp);
    Serial.println("gsm available end");
  }

  if(Serial.available())
  {
    Arsp = Serial.readString();

    Serial.println("Serial available");
    Serial.println(Arsp);
    gsm.println(Arsp);
    Serial.println("Serial available end");
  }

  // turn off the led
  digitalWrite(LED_BUILTIN, LOW);

  delay(500);
}

My trials & errors so far :

  • I took care of correctly powering the SIM800L with proper voltage.
  • all ground are common (battery and arduino).
  • rx to tx and tx to rx checked 100 times.
  • changing pin numbers also.
  • the sim inserted is connected to network sometimes, but not always. When connected, I can call the number and I hear the correct "ring" tone in the line.
  • the led of the sim800L module is blinking slowly when connected. But 50% of the time it's also blinking 1 Hz like it's looking for network.
  • the RST pin of the sim800L module is connected to the 3.3V port of the arduino.
  • I have changed the baud rate of the softwareserial object to 1200 2400 4800 and 9600 without success.
  • I have checked "Both NL & CR" in the serial monitor settings.
  • I have post "AT" and "at" and all other things.
  • whatever the command, the module never answer a clear string. It's either empty, or "?" signs.
  • and finally, without touching it, the module is "available" from time to time and output nothing.

Here is a log as an example after a reset:

screenshot

I am lost ! All help will be greatly appreciated, thanks a lot.

NoonanRosenblum
  • 149
  • 1
  • 1
  • 5

1 Answers1

1

Ok folks I am now successfully interacting with the module ! Here is the few steps which helped me:

  1. changed Grsp = gsm.readString(); to char c = gsm.read();. I guess high level functions like readString() can be too much sometimes. The string is a complex object to handle. It seems that reading char by char is safer is this case.
  2. removing the delay(500);
  3. changed my "turn on" routine to let more time to the modem for powering on. Basically I plug the battery so modem turns on. I plug the arduino to the laptop so arduino turns on. Then open the serial monitor (not flashing the arduino). And then click on the reset button on the board.

Here is a screenshot of the serial monitor. And bellow the new code I used.

screenshot

#include <SoftwareSerial.h>

SoftwareSerial mySerial(11, 10); // RX, TX 

void setup()  
{
  // Open serial communication
  Serial.begin(9600);

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);

  delay(1000);
  Serial.println("Testing SIM800L module");
  Serial.println();
  Serial.print("Sizeof(mySerial) = "); Serial.println(sizeof(mySerial));
  Serial.println();

}

void loop() // run over and over
{

  if( mySerial.available() )
  {
    char c = mySerial.read();
    Serial.print(c);
  }

  if(Serial.available())
  {
    String Arsp = Serial.readString();

    Serial.println("Serial available");
    Serial.println(Arsp);
    mySerial.println(Arsp);
    Serial.println("Serial available end");
  }

}

I found this using an old project I did using a GPS module. I hope this will helps others.

NoonanRosenblum
  • 149
  • 1
  • 1
  • 5