【问题标题】:Arduino GSM GPS Shield doesn't do the GSM_READY checkArduino GSM GPS Shield 不进行 GSM_READY 检查
【发布时间】:2016-04-30 03:40:46
【问题描述】:

在将此问题标记为重复之前,请注意我已经尝试过this、this & this

我最近买了一个 Arduino UNO R3 和一个 SIM808 GSM/GPS 扩展板。 Shield 的 RX 连接到 Arduino 的 Pin 11,TX 连接到 Pin 10,两个 GND 相互连接。我已经使用 USB 将我的 Arduino 连接到我的计算机,并且屏蔽连接到使用 12V 适配器的外部电源。另外,我已经将 Arduino 的 3.3V 连接到了 shield 的 Vcc。

以下是我使用的草图:

// Include the GSM library
#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess;
GSM_SMS sms;

void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.println("SMS Messages Sender");

  // connection state
  boolean notConnected = true;

  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while (notConnected) {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
      notConnected = false;
    } else {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("GSM initialized");
}

void loop() {

  Serial.print("Enter a mobile number: ");
  char remoteNum[20];  // telephone number to send sms
  readSerial(remoteNum);
  Serial.println(remoteNum);

  // sms text
  Serial.print("Now, enter SMS content: ");
  char txtMsg[200];
  readSerial(txtMsg);
  Serial.println("SENDING");
  Serial.println();
  Serial.println("Message:");
  Serial.println(txtMsg);

  // send the message
  sms.beginSMS(remoteNum);
  sms.print(txtMsg);
  sms.endSMS();
  Serial.println("\nCOMPLETE!\n");
}

/*
  Read input serial
 */
int readSerial(char result[]) {
  int i = 0;
  while (1) {
    while (Serial.available() > 0) {
      char inChar = Serial.read();
      if (inChar == '\n') {
        result[i] = '\0';
        Serial.flush();
        return 0;
      }
      if (inChar != '\r') {
        result[i] = inChar;
        i++;
      }
    }
  }
}

这里的问题与那些链接帖子中提到的问题相同。

条件if (gsmAccess.begin(PINNUMBER) == GSM_READY) 永远不会被执行。 else 部分也不执行。

串行监视器永远不会超过 SMS 消息发送者。

请注意,我使用的是 AirTel India,我有一个完全激活的数据计划,并且 PIN 码已更改为 0000。

如果有人能提出一些有用的建议,我们将不胜感激。

感谢您的宝贵时间!!

【问题讨论】:

    标签: arduino gsm arduino-uno arduino-ide


    【解决方案1】:

    您无法使用 Arduino 的 3.3V 为 GSM 模块供电! GSM 需要 3A 的峰值电流(是的,安培,不是毫安)。你真的需要一个锂聚合物电池来为 GSM 供电。实际上,如果您需要移动解决方案,您可以使用相同的 LiPo 电池为 3V Arduino 供电,但反之则不行。

    【讨论】:

      【解决方案2】:

      请先检查模块是否响应下一个代码Example Code

      其他东西电源电压范围必须是3.4~4.4V,尽量不要用低电压。

      【讨论】:

        【解决方案3】:

        Arduino的GSM库用于移远M10 GSM/GPRS模块,不兼容SimCom SIMxxx模块。

        这是可用于 SIM808 模块的库https://github.com/MarcoMartines/GSM-GPRS-GPS-Shield(repo 中包含示例)。请注意,此库使用 SIM900 库,它允许与 SimCom 模块进行低级接口。

        为了进一步阅读这里有两个 adafruit 链接:

        http://wiki.iteadstudio.com/SIM808_GSM/GPRS/GPS_Module
        https://www.adafruit.com/products/2637

        屏蔽层连接到一个 12V 的外部电源 适配器。此外,我已将 Arduino 的 3.3V 连接到 Vcc 盾牌。

        你这是什么意思?您需要为您的屏蔽提供所需的电压,以提供所需的安培数。您还需要与您的 arduino 有共同点。

        此外,如果您的屏蔽是 3.3V,您还需要使用分压器来转移来自 arduino 的 Tx 线(因为它是 5V)。

        请注意,这些屏蔽还有一个软启动按钮,也需要连接,以允许代码启动您的模块。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2017-07-14
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2016-08-24
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多