Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

arduino - SIM800l V2 Keeps Blinking Every Second

I'm desperately looking for a solution for my SIM800l v2. The network LED just keeps blinking every second. It does not restart but it keeps blinking and not picking up a signal.

I tried powering up using a laptop USB port but it does not solve it. I also used a charger adapter that is 5V and 2A but still does not solve the problem. I also tried changing the sim card but still does not solve the problem.

Here is the Wiring diagram that I followed:

enter image description here Credits to miliohm.com

Code:

SoftwareSerial sim(10, 11);
int _timeout;
String _buffer;
String number = "+6281222329xxx"; //-> change with your number

void setup() {
  //delay(7000); //delay for 7 seconds to make sure the modules get the signal
  Serial.begin(9600);
  _buffer.reserve(50);
  Serial.println("Sistem Started...");
  sim.begin(9600);
  delay(1000);
  Serial.println("Type s to send an SMS, r to receive an SMS, and c to make a call");
}

void loop() {
  if (Serial.available() > 0)
    switch (Serial.read()) {
    case 's':
      SendMessage();
      break;
    case 'r':
      RecieveMessage();
      break;
    case 'c':
      callNumber();
      break;
    }

    if (sim.available() > 0)
      Serial.write(sim.read());
}

void SendMessage() {
  //Serial.println ("Sending Message");
  sim.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  delay(200);
  //Serial.println ("Set SMS Number");
  sim.println("AT+CMGS="" + number + ""
"); //Mobile phone number to send message
  delay(200);
  String SMS = "Hello, how are you? greetings from miliohm.com admin";
  sim.println(SMS);
  delay(100);
  sim.println((char)26);// ASCII code of CTRL+Z
  delay(200);
  _buffer = _readSerial();
}

void RecieveMessage() {
  Serial.println ("SIM800L Read an SMS");
  sim.println("AT+CMGF=1");
  delay(200);
  sim.println("AT+CNMI=1,2,0,0,0"); // AT Command to receive a live SMS
  delay(200);
  Serial.write ("Unread Message done");
}

String _readSerial() {
  _timeout = 0;
  while (!sim.available() && _timeout < 12000) {
    delay(13);
    _timeout++;
  }
  if (sim.available()) {
    return sim.readString();
  }
}

void callNumber() {
  sim.print (F("ATD"));
  sim.print (number);
  sim.print (F(";
"));
  _buffer = _readSerial();
  Serial.println(_buffer);
}
question from:https://stackoverflow.com/questions/65886095/sim800l-v2-keeps-blinking-every-second

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...