Arduino 3G GPRS盾无法正常工作

时间:2014-06-13 08:40:18

标签: arduino at-command

我正在研究从ITEADSTUDIO购买的3G GPRS屏蔽。它有一个SIM5216 WCDMA模块。

我现在对盾牌有以下限制

  • 我如何理解屏蔽已成功连接到网络提供商?
  • 如何在3G Shield上调用AT-Commands?
  • 如何从3G GPRS屏蔽发送短信?

请为我提供上述限制的解决方案。

提前谢谢

1 个答案:

答案 0 :(得分:0)

首先,根据你的帖子的风格,我只是想警告你,没有办法在你的盾牌上搜索地狱,并将你的头撞在墙上,以弄清楚如何使用你买的东西。在接下来的帖子中,我将写出你所有问题的答案,并且它会给你一个良好的开端,但你仍然需要谷歌地狱的一切你不会理解并尝试所有这些,直到...之前。

如果您没有使用arduino进行一些练习,请阅读"开始使用arduino。"

1。)您可以进行多项测试。 Here是一个带有AT命令的教程,可用于编程盾牌。我建议为AT命令上传一个"串行继电器"到您的arduino板上,然后尝试发送或接收来自您的arduino的短信。这是我使用的串行继电器。请注意,代码不适用于屏蔽,因为tx / rx引脚设置不同。 (在我的盾牌--seeedstudio GPRS 2.0上,tx和rx引脚设置在引脚7和8上。在你的they are set up on 1-6上。)幸运的是,盾牌上的引脚设置可能允许你使用arduino IED附带的GSM库示例。

//Serial Relay - Arduino will patch a 
//serial link between the computer and the GPRS Shield
//at 19200 bps 8-N-1
//Computer is connected to Hardware UART
//GPRS Shield is connected to the Software UART 

#include <SoftwareSerial.h>

SoftwareSerial GPRS(7, 8);
unsigned char buffer[64]; // buffer array for data recieve over serial port
int count=0;     // counter for buffer array 
void setup()
{
  GPRS.begin(19200);               // the GPRS baud rate   
  Serial.begin(19200);             // the Serial port of Arduino baud rate.

}

void loop()
{
  if (GPRS.available())              // if date is comming from softwareserial port ==> data is comming from gprs shield
  {
    while(GPRS.available())          // reading data into char array 
    {
      buffer[count++]=GPRS.read();     // writing data into array
      if(count == 64)break;
  }
    Serial.write(buffer,count);            // if no data transmission ends, write buffer to hardware serial port
    clearBufferArray();              // call clearBufferArray function to clear the storaged data from the array
    count = 0;                       // set counter of while loop to zero


  }
  if (Serial.available())            // if data is available on hardwareserial port ==> data is comming from PC or notebook
    GPRS.write(Serial.read());       // write it to the GPRS shield
}
void clearBufferArray()              // function to clear buffer array
{
  for (int i=0; i<count;i++)
    { buffer[i]=NULL;}                  // clear all index of array with command NULL
}

2.)上传串行中继(用于直接从键盘发送AT命令)或将其嵌入到arduino代码中,就像在GSM示例中一样。要使用串行中继,请阅读有关终端基础知识的this文章。 (熟悉sparkfun.com。它是一个很棒的网站。还有instructables和adafruit)。

3.。)你的ide中的GSM库中有示例代码,它应该适用于你的盾牌。或者,一旦进行了串行继电器设置,就可以使用终端中的命令执行此操作。执行此操作的命令应该在我在答案1中给出的链接中。

还有一个想法让我搞砸了一段时间:确保你有适合你的SIM卡的数据计划和相应的APN。我使用ATT gophone,所以apn是wap.cingular。

祝你好运。

相关问题