本帖最后由 weijinhe 于 2014-10-15 12:48 编辑
通过GPRS模块上传采集数据至machtalk平台 machtalk平台交流群:300250166
1、硬件准备 (1)Arduino uno (2)模拟声音传感器模块 (3)GPRS/GPS/GSM模块 (4)SIM卡一张(有流量) file:///C:\Users\ADMINI~1\AppData\Local\Temp\ksohtml\wps_clip_image-18129.png
2、硬件连接 (1)GPRS/GPS/GSM模块与Arduino uno连接。 (2)在GPRS/GPS/GSM三合一模块上插上SIM卡 (3)模拟声音传感VC GND out 分别与 5V GND A(0)连接 (4)开关S1先扳倒PROG,下载完毕后扳倒Comm;开关S2扳倒中间位置[mw_shl_code=c,true]void setup()
{
//设置引脚为输出模式
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
//GSM开机时序
digitalWrite(5,HIGH);
delay(1500);
digitalWrite(5,LOW);
digitalWrite(3,LOW);//使能GSM的TX、RX
digitalWrite(4,HIGH);//关闭GPS的TX、RX
//设置波特率
Serial.begin(9600);
//等待call ready
delay(5000);
delay(5000);
delay(5000);
}
void loop()
{
unsigned char t=25;
//发送AT命令同步
Serial.println("AT");
delay(2000);
Serial.println("AT");
delay(5000);
Serial.println("AT+CIPSTART=\"TCP\",\"api.machtalk.net\",7777");
delay(5000);
Serial.println("AT+CIPSEND");
delay(2000);
Serial.println("{\"cmd\":\"create\",\"data\": {\"APIKey\":\"7a19bd7874a541a6b4c50a831ea0b3b2\",\"device_id\":\"7bc8abb1b3cb434499e66ba39c206aba\",\"device_value_id\":\"1\",\"device_type_id\":\"1\"}}");
Serial.print("{\"cmd\":\"post\",\"data\":{\"value\":");
Serial.print(t);
Serial.println("}}");
Serial.println("{\"cmd\":\"close\"}");
delay(2000);
Serial.write(26);
delay(5000);
}[/mw_shl_code] 3、烧写代码 4、Machtalk物联网平台配置 Machtalk物联网平台配置、动作设置、触发器设置如例一所示,不再累述。
详细图文下载附件:
mactalk.net技术交流群:300250166
|