用于arduino的SIM800L模块有时不会打电话或发送消息

SIM800L module for arduino will not call or send message sometimes

代码有效,但很多时候即使接口正确连接,它也无法发送 call/send 消息。它失败了大约 10%,程序正在继续。如果调用有任何错误(可能是信号或其他),如何重试调用?我想我必须处理 AT commands but I don't know how to handle that. I am using this library. AT commands are here . My full code is here

#include <GPRS_Shield_Arduino.h>
#include <SoftwareSerial.h>
#include <Wire.h>


#define PIN_TX    7
#define PIN_RX    8
#define BAUDRATE  9600
#define PHONE_NUMBER "003xxxxxxxxxx"
#define MESSAGE  "Temp is high"

GPRS gprsTest(PIN_TX, PIN_RX, BAUDRATE); //RX,TX,BaudRate

void setup() {
  Serial.begin(9600);

  // code 

}

void loop() {

// ..code..


  if (temp>35) {
    call_and_text();
  }

// ..code..

}

call_and_text() {
  while (!gprsTest.init()) {
    delay(1000);
    Serial.print("init error1\r\n");
  }
  Serial.println("gprs init success");
  Serial.println("start to send message ...");
  gprsTest.sendSMS(PHONE_NUMBER, MESSAGE); //define phone number and text
  Serial.println("Init success, start to call...");
  gprsTest.callUp("003xxxxxxxxx");

}

可以使用sendSMScallUp函数的return判断是否成功。

关于您的问题,您是否正确地为 GSM 屏蔽供电? 我的意思是正确的,不是通过 USB 从您的计算机。

如果是这种情况,请尝试使用功率充足的外接电源。电源应该能够提供高达 2A 的电流。


编辑您的最后一条评论。

在打电话或发信息的那一刻,你的GSM shield需要爆发力。你的 0.7mA 可能不够。

如果你有另一个可以提供更多电力的电源,试试吧。请注意,您的 arduino 可以从 6-20V 供电,尽管推荐的电压是 7-12V

然而,理想的方法是分别为你的盾牌和你的 arduino 供电,并有一个共同的地面。这样一来,您始终可以通过 USB 为 arduino 供电,而它的防护罩是一个合适的电源。