I have a Django web application hosted on a Heroku server. Currently I am using the free package for hosting. I want to send data from an Arduino using a SIM900L GPRS module to the web application. I want to know if it is possible. I have searched for a solution but couldn't find a proper guide or example for it. My web application accepts get requests and updates values in the database when url is entered. However if the Arduino sends data using the same url I get the following error:
AT+CIPSTART="TipCP","https://.herokuapp.com",80 ERROR
Any tested example or suggestions about what I am doing wrong or what I should be doing instead?
void gprs(float *value1, float *value2, float *value3, float *AFR, float *value5, float *value6)
{
String APN = "";
String UNAME = "";
String PWD = "";
char fid[] = "";
char nid[] = "";
char s_ip[] = "https://<appname>.herokuapp.com";
char apikey[] = "";
wdt_reset();
digitalWrite(A4, HIGH);
Serial.println(F("GPRS-1 Function"));
delay(5000);
wdt_reset();
delay(5000);
wdt_reset();
char buffer1[10];
uint8_t GSMTries = 0;
String res;
//wdt_reset();
// the below code establishes connection and if not successful
// tries three times in total
do {
sendData(F("AT\r\n"), 1000, DEBUG);
sendData(F("AT+CIPSHUT\r\n"), 2000, DEBUG);
sendData(F("AT+CIPMUX=0\r\n"), 2000, DEBUG);
sendData(F("AT+CSQ\r\n"), 2000, DEBUG);
sendData("AT+CSTT= \"" + APN + "\", \"" + UNAME + "\", \"" + PWD + "\"\r\n", 2000, DEBUG);
sendData(F("AT+CIICR\r\n"), 2000, DEBUG);
sendData(F("AT+CIFSR\r\n"), 2000, DEBUG);
sendData(F("AT+CSQ\r\n"), 2000, DEBUG);
String scnt = "AT+CIPSTART=\"TipCP\",\"" ;
scnt += s_ip ;
scnt += "\",80\r\n" ;
res = sendData(scnt, 10000, DEBUG);
GSMTries++;
wdt_reset();
} while (((res.indexOf("ERROR") != -1) || (res.indexOf("CONNECT") == -1)) && (GSMTries < 3));
/*
if(res.indexOf("ERROR") != -1){
delay(200);
sendData(scnt, 10000, DEBUG);
}
*/
String api = "GET /value?apkey=" ;
api += apikey;
api += "&&fid=";
api += fid;
api += "&&nid=";
api += nid;
Serial.println(F("API......."));
Serial.flush();
Serial.println(F("here-1"));
String Data1 = "";
//wdt_reset();
//Co ordinator data is compiled along with html commands
//and sent through GPRS
String sensor = dtostrf(*value1, 4, 2, buffer1);
Data1.concat(api);
Data1.concat(F("&field1="));
Data1.concat(sensor);
sensor = dtostrf(*value2, 4, 2, buffer1);
Data1.concat(F("&field2="));
Data1.concat(sensor);
sensor = dtostrf(*value3, 4, 2, buffer1);
Data1.concat(F("&field3="));
Data1.concat(sensor);
sensor = dtostrf(*AFR, 4, 2, buffer1);
Data1.concat(F("&field4="));
Data1.concat(sensor);
sensor = dtostrf(*value4, 4, 2, buffer1);
Data1.concat(F("&field5="));
Data1.concat(sensor);
sensor = dtostrf(*value6, 4, 2, buffer1);
Data1.concat(F("&field6="));
Data1.concat(sensor);
Data1.concat(F("\r\n"));
delay(1000);
String cipSend = "AT+CIPSEND=";
cipSend.concat(Data1.length());
cipSend.concat("\r\n");
sendData(cipSend, 8000, DEBUG);
sendData(Data1, 8000, DEBUG);
sendData(F("AT+CIPCLOSE\r\n"), 5000, DEBUG);
digitalWrite(A4, LOW);
wdt_reset();
}
The above is a part of code used in arduino to upload data to website. This code was being used before to upload data to thingspeak through its IP address and worked fine.