Cannot send data to 000webhost server using sim900. AT+CIPSEND ERROR

this is the code of arduino ide. i want to send value data latitude and longitude from gps modul to 000webhost server using sim900. but i always have error from the AT+CIPSEND.

#include <SoftwareSerial.h>
#include <TinyGPS++.h>
#include <String.h>

SoftwareSerial SIM900(7,8);
SoftwareSerial gpsSerial(4,3);

TinyGPSPlus gps;  // The TinyGPS++ object

float latitude = 32;
float longitude = 32;

 
void setup()
{
  Serial.begin(9600);    
  SIM900.begin(9600);    
  delay(100);
  
  Serial.println("Initializing...");
  delay(1000);
  SIM900.println("AT");
  updateSerial();
  SIM900.println("AT+CPIN?");
  updateSerial();
  SIM900.println("AT+CREG?");
  updateSerial();
  SIM900.println("AT+COPS?");
  updateSerial();
  delay(1000);
}

void updateSerial()
{
  delay(500);
  while (Serial.available()) 
  {
    SIM900.write(Serial.read());
  } 
  while(SIM900.available()) 
  {
    Serial.write(SIM900.read());
  }
} 

void send_data()
 {
  Serial.begin(9600);   
  SIM900.begin(9600); 
  delay(100);
  SIM900.println("AT+CGATT?");
  updateSerial();
  SIM900.println("AT+CIPSHUT");
  updateSerial();
  SIM900.println("AT+CIPSTATUS");
  updateSerial();
  SIM900.println("AT+CIPMUX=0");
  updateSerial();
  SIM900.println("AT+CGATT?");
  updateSerial();
  SIM900.println("AT+CSTT=\"airtelgprs.com\"");
  updateSerial();
  SIM900.println("AT+CIICR");
  delay(2000);
  updateSerial();
  SIM900.println("AT+CIFSR");
  updateSerial();
  SIM900.println("AT+CIPSPRT=0");
  delay(3000);
  updateSerial();
  SIM900.println("AT+CIPSTART=\"TCP\",\"xxxxx.000webhostapp.com\",\"80\"");
  delay(3000);
  updateSerial();
  SIM900.println("AT+CIPSEND");
  delay(15000);
  updateSerial();
  String str="GET /coba.php?latitude=" + String(latitude) + "&longitude=" +String(longitude);
  Serial.println(str);
  SIM900.println(str);
  updateSerial();
  SIM900.println((char)26);
  delay(5000);
  SIM900.println();
  updateSerial();
  SIM900.println("AT+CIPSHUT");
  delay(100);
  }
void loop()
{
    Serial.println("daftar lokasi kendaraan");
    lokasi();
    send_data();
} 

void lokasi()
{
  Serial.begin(9600);
  gpsSerial.begin(9600);
  while(1)
  {
   while (gpsSerial.available() > 0)
    { gps.encode(gpsSerial.read()); }

      if (gps.location.isUpdated())
      {
       latitude=gps.location.lat();
       longitude=gps.location.lng();
       break;
      }

 }
   Serial.println("LATITUDE=" + String(latitude,6));
   Serial.println("LONGITUDE=" + String(longitude,6));
   delay(1000);
  }

there is the error of my code. THE OTHERS AT COMMAND can response OK. Please help my problem

AT+CIPSEND

CLOSED

ERROR
GET /coba.php?latitude=-7.79&longitude=110.39
GET /coba.php?latitude=-7.79&longitude=110.39

SIM900 R11.0


I'm not familiar with GSM stuff. Did you siolve the problem that you had in GSM SIM 900 cannot connect to Network ?

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project :wink: See About the Installation & Troubleshooting category.

yes. the problem before about sim900 cannot connect to network. Now i have problem with send data to 000webhost server. Thank you very much

Remember that SoftwareSerial can only listen to one RX pin at a time. While you are listening to SIM900, any characters arriving from gpsSerial will be lost. While you are listening to gpsSerial, any characters arriving from SIM900 will be lost.

how can i solved the problem. because i using 2 modul, sim900 and gps modul so i write the code like that. may you help me to correct my code?

I think the best solution is an Arduino with more hardware serial ports. The Arduino MEGA has four ports total.

A more compact solution would be the Arduino Micro. That has a USB port (Serial) to talk to the host, a hardware serial port (Serial1), and you could use SoftwareSerial for a third.

the problem about AT+CIPSEND ERROR solved. but after that i have error like this:

SEND OK
<html>
<head><title>404 Not Found</title></head>daftar lokasi kendaraan

what's the problem?. I am very sure if the url I created is correct. please give me a solution. thanks

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.