Arduino GSM GPS Shield 不执行 GSM_READY 检查 [英] Arduino GSM GPS Shield doesn't do the GSM_READY check
问题描述
在将此问题标记为重复之前,请注意我已经尝试过这个,这个 &这个
Before you mark this question as duplicate, please note that I have already tried this, this & this
我买了一个 Arduino UNO R3 &最近有一个 SIM808 GSM/GPS 屏蔽.Shield 的 RX 连接到 Arduino 的 Pin 11,TX 连接到 Pin 10,两个 GND 相互连接.我已使用 USB 将 Arduino 连接到我的计算机.屏蔽通过 12V 适配器连接到外部电源.此外,我已将 Arduino 的 3.3V 连接到屏蔽的 Vcc.
I bought an Arduino UNO R3 & a SIM808 GSM/GPS shield recently. The RX of the Shield is connected to Pin 11 of Arduino, TX to Pin 10 with both the GNDs connected to each other. I have connected my Arduino to my computer with the USB & the shield is connected to an external power supply with a 12V Adapter. Additionally, I have connected the 3.3V of the Arduino to Vcc of the shield.
以下是我用过的草图:
// 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++;
}
}
}
}
这里的问题与那些链接帖子中提到的问题相同.
Problem here is same as that mentioned in those linked posts.
条件 if (gsmAccess.begin(PINNUMBER) == GSM_READY)
永远不会被执行.else
部分也不执行.
The condition if (gsmAccess.begin(PINNUMBER) == GSM_READY)
never gets executed. Neither does the else
part execute.
串行监视器永远不会超过短信发送者.
Serial monitor never goes past SMS Messages Sender.
请注意,我使用的是 AirTel India,我有一个完全激活的数据计划 &PIN 码已更改为 0000.
Please note that I am using AirTel India, I have a fully activated Data Plan & the PIN Number has been changed to 0000.
如果有人能提出有用的建议,我们将不胜感激.
Would really appreciate if someone could suggest something helpful.
感谢您的时间!
推荐答案
您无法使用 Arduino 的 3.3V 电压为 GSM 模块供电!GSM 需要 3A 的峰值电流(是的,安培,而不是毫安培).你真的需要一块锂电池来为 GSM 供电.实际上,如果您需要移动解决方案,您可以使用同一个 LiPo 电池为 3V Arduino 供电,但反过来不行.
You cannot power a GSM module from the 3.3V of Arduino! a GSM needs peak currents of 3A (yes, Amps, not milli-amperes). You really need a LiPo battery to power the GSM. You could power a 3V Arduino from the same LiPo battery, actually, if you need a mobile solution, but not the other way around.
这篇关于Arduino GSM GPS Shield 不执行 GSM_READY 检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!