Hi everyone!
Recently I started a project where I would read data with my GBoard 1.0 arduino based board which have imlemented SIM900 module and send it over AT commands to server. I made it work with ThingSpeak server, but when I realized it can't save more then 100 entries I had to find another solution for storage server.
Then I found out about Google Sheets and uploading data over google scripts implemented to Sheets that receives HTTP GET over [pushingbox] http://www.pushingbox.com api, but that won't work no matter what I tried.
Here's the code:
#include <SoftwareSerial.h>
SoftwareSerial gprsSerial(2, 3);
#include <String.h>
#define GSM_ON 6
#define GSM_RESET 7
#define GSM_POWER 2
void setup()
{
Serial.begin(9600); // the GPRS baud rate
// the GPRS baud rate
gprsSerial.begin(9600);
pinMode(GSM_ON, OUTPUT);
pinMode(GSM_RESET, OUTPUT);
pinMode(GSM_POWER, INPUT);
// By default SIM900 needs to turn on manually, this simulates it and turns ON SIM900 module
if ((String)digitalRead(GSM_POWER) != "1") { // GPIO D2 is high(1) when SIM900 module is working
Serial.println("Turning ON - GSM Shield.");
digitalWrite(GSM_ON, HIGH);
delay(5000);
digitalWrite(GSM_ON, LOW);
}
delay(1000);
}
void loop() {
if (gprsSerial.available())
Serial.write(gprsSerial.read());
gprsSerial.println("AT");
delay(500);
gprsSerial.println("AT+CPIN?");
delay(500);
gprsSerial.println("AT+CREG?");
delay(500);
gprsSerial.println("AT+CGATT?");
delay(500);
gprsSerial.println("AT+CIPSHUT");
delay(500);
gprsSerial.println("AT+CIPSTATUS");
delay(1000);
gprsSerial.println("AT+CIPMUX=0");
delay(1000);
ShowSerialData();
gprsSerial.println("AT+CSTT=\"internet.ht.hr\"");//start task and setting the APN,
delay(500);
ShowSerialData();
gprsSerial.println("AT+CIICR");//bring up wireless connection
delay(2000);
ShowSerialData();
gprsSerial.println("AT+CIFSR");//get local IP adress
delay(1000);
ShowSerialData();
gprsSerial.println("AT+CIPSPRT=0");
delay(2000);
ShowSerialData();
gprsSerial.println("AT+CIPSTART=\"TCP\",\"api.pushingbox.com\",\"80\"");//start up the connection
delay(3000);
ShowSerialData();
gprsSerial.println("AT+CIPSEND");//begin send data to remote server
delay(4000);
ShowSerialData();
String str="GET http://api.pushingbox.com/pushingbox?devid=vA0453B54ED5B189&t=" + String(10) + "&h=" + String(20) + "&PM10=" + String(30);
Serial.println(str);
delay(500);
gprsSerial.println(str);//begin send data to remote server
delay(2000);
ShowSerialData();
gprsSerial.println((char)26);//sending
delay(2000);//waitting for reply, important! the time is base on the condition of internet
gprsSerial.println();
ShowSerialData();
gprsSerial.println("AT+CIPSHUT");//close the connection
delay(100);
ShowSerialData();
}
void ShowSerialData()
{
while (gprsSerial.available() != 0)
Serial.write(gprsSerial.read());
delay(5000);
}
and here's the output:
AT
OK
AT+CPIN?
+CPIN: READY
OK
AT+CREG?
+CREG: 0,AT+CSTT="internet.ht.hr"
OK
AT+CIICR
OK
AT+CIFSR
10.152.145.145
AT+CIPSPRT=0
OK
AT+CIPSTART="TCP","api.pushingbox.com","80"
OK
CONNECT OKAT+CIPSEND
GET http://api.pushingbox.com/pushingbox?devid=vA0453B54ED5B189&t=10&h=20&PM10=30 HTTP/1.0
HTTP/1.1 408 Request Time-out
content-length: 110
cache-contr
This same code worked with thingspeak write API Key, but won't work with pushingbox API.
Did any1 have similar problem and have any idea how to fix it?