2016-04-30 41 views
1

之前紀念這個問題的重複,請注意,我已經嘗試this,​​& thisArduino的GSM GPS盾不做GSM_READY檢查

我買了一個Arduino UNO R3 &一個SIM808 GSM/GPS最近盾牌。屏蔽的RX連接到Arduino的引腳11,TX到引腳10,兩個GND相互連接。我通過USB &將我的Arduino連接到了我的電腦上,屏蔽層通過12V適配器連接到外部電源。另外,我已經將3.3V的Arduino連接到屏蔽的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,我有一個完全激活數據計劃& PIN號碼已被更改爲0000

會很感激,如果有人能提出一些有幫助的。

感謝您的時間!

回答

1

請先檢查模塊與下一個代碼Example Code

其他事情的電源電壓範圍必須在3.4〜4.4V響應,儘量不要使用較少的電壓。

0

Arduino的GSM庫適用於Quectel M10 GSM/GPRS模塊,並且與SimCom SIMxxx模塊不兼容。

以下是您可以用於SIM808模塊https://github.com/MarcoMartines/GSM-GPRS-GPS-Shield(包含在回購中的示例)的庫。請注意,該庫使用SIM900庫,允許SimCom模塊具有低級別接口。

對於這裏進一步閱讀2個Adafruit的鏈接:

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

屏蔽被連接到具有12V 適配器的外部電源。此外,我已將3.3V的Arduino連接到屏蔽的Vcc 。

你是什麼意思?您需要爲您的屏蔽提供所需的電壓,以提供所需的功放。而且你也需要與你的arduino有共同點。另外,如果你的屏蔽是3.3V,那麼你需要使用分壓器將Tx線從Arduino中移出(因爲它是5V)。

請注意,這些屏蔽也有一個軟啓動按鈕,需要連接以允許代碼爲模塊供電。

1

您無法從3.3V的Arduino中爲GSM模塊供電! GSM需要3A的峯值電流(是,安培,不是毫安)。你真的需要一個LiPo電池來爲GSM供電。實際上,如果您需要移動解決方案,您可以使用相同的LiPo電池爲3V Arduino供電,但不能以其他方式。