Server with gsm

hey, i want to upload my server online, to send my GPS data to it with GSM ,to show it on the map, there is free way to upload it ?
iam using
GSM908
SkyNav SKM53 GPS

there is free way to upload it ?

Why would anyone else want to pay to host your data?

PaulS:
Why would anyone else want to pay to host your data?

it's a graduation project, and we want to show the data on online website.

You could post your data to a free web service such as Parse.com?

Or get a free hosting plan with mysql server and just post the data to the database and make a webpage read it :slight_smile:

Marciokoko:
You could post your data to a free web service such as Parse.com?

Or get a free hosting plan with mysql server and just post the data to the database and make a webpage read it :slight_smile:

second choice, how to send data by gsm to server , if it's offline , i already had offline server by WAMP.

You have a gsm/gprs module, right?

Marciokoko:
You have a gsm/gprs module, right?

yes i have GSM SIM908

Oh wow! Well I am coincidentally trying to set up my SIM900:

But Im having a problem because I think the sketch Im using which imports the GSM.h, is using the GSM.h from the included Arduino IDE library instead of my SIM900 library. Which library are you using?

I can definitely help you posting your data to the web as long as you get your gars connection working. I already post data using wifi but im trying to use gprs now.

Marciokoko:
Oh wow! Well I am coincidentally trying to set up my SIM900:

http://forum.arduino.cc/index.php?topic=325525.0

But Im having a problem because I think the sketch Im using which imports the GSM.h, is using the GSM.h from the included Arduino IDE library instead of my SIM900 library. Which library are you using?

I can definitely help you posting your data to the web as long as you get your gars connection working. I already post data using wifi but im trying to use gprs now.

i don’t use the library , i couldn’t find suitable library, but iam working with AT Commands and i have code for Sending data to the server

int8_t answer;
int onModulePin= 13;

char data[100];
int data_size;

char aux_str[30];
char aux;
int x = 0;
char N_S,W_E;

char url[] = "";
char frame[200];

char latitude[15];
char longitude[15];



void setup(){

    pinMode(onModulePin, OUTPUT);
    Serial.begin(115200);

    Serial.println("Starting...");
    power_on();

    delay(3000);

    // sets the PIN code
    sendATcommand("AT+CPIN=****", "OK", 2000);

    delay(3000);

    // starts the GPS and waits for signal
    while ( start_GPS() == 0);

    while (sendATcommand("AT+CREG?", "+CREG: 0,1", 2000) == 0);

    // sets APN , user name and password
    sendATcommand("AT+SAPBR=3,1,\"Contype\",\"GPRS\"", "OK", 2000);
    sendATcommand("AT+SAPBR=3,1,\"APN\",\"internet.vodafone.net\"", "OK", 2000);
    sendATcommand("AT+SAPBR=3,1,\"USER\",\"internet\"", "OK", 2000);
    sendATcommand("AT+SAPBR=3,1,\"PWD\",\"internet\"", "OK", 2000);

    // gets the GPRS bearer
    while (sendATcommand("AT+SAPBR=1,1", "OK", 20000) == 0)
    {
        delay(5000);
    }

}

void loop(){

    // gets GPS data
    get_GPS();

    // sends GPS data to the script
    send_HTTP();

    delay(5000);

}

void power_on(){

    uint8_t answer=0;

    // checks if the module is started
    answer = sendATcommand("AT", "OK", 2000);
    if (answer == 0)
    {
        // power on pulse
        digitalWrite(onModulePin,HIGH);
        delay(3000);
        digitalWrite(onModulePin,LOW);

        // waits for an answer from the module
        while(answer == 0){
            // Send AT every two seconds and wait for the answer
            answer = sendATcommand("AT", "OK", 2000);
        }
    }

}

int8_t start_GPS(){

    unsigned long previous;

    previous = millis();
    // starts the GPS
    sendATcommand("AT+CGPSPWR=1", "OK", 2000);
    sendATcommand("AT+CGPSRST=0", "OK", 2000);

    // waits for fix GPS
    while(( (sendATcommand("AT+CGPSSTATUS?", "2D Fix", 5000) ||
        sendATcommand("AT+CGPSSTATUS?", "3D Fix", 5000)) == 0 ) &&
        ((millis() - previous) < 90000));

    if ((millis() - previous) < 90000)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

int8_t get_GPS(){

    int8_t counter, answer;
    long previous;

    // First get the NMEA string
    // Clean the input buffer
    while( Serial.available() > 0) Serial.read();
    // request Basic string
    sendATcommand("AT+CGPSINF=0", "AT+CGPSINF=0\r\n\r\n", 2000);

    counter = 0;
    answer = 0;
    memset(frame, '\0', 100);    // Initialize the string
    previous = millis();
    // this loop waits for the NMEA string
    do{

        if(Serial.available() != 0){
            frame[counter] = Serial.read();
            counter++;
            // check if the desired answer is in the response of the module
            if (strstr(frame, "OK") != NULL)
            {
                answer = 1;
            }
        }
        // Waits for the asnwer with time out
    }
    while((answer == 0) && ((millis() - previous) < 2000));

    frame[counter-3] = '\0';

    // Parses the string
    strtok(frame, ",");
    strcpy(longitude,strtok(NULL, ",")); // Gets longitude
    strcpy(latitude,strtok(NULL, ",")); // Gets latitude

    convert2Degrees(latitude);
    convert2Degrees(longitude);

    return answer;
}

/* convert2Degrees ( input ) - performs the conversion from input
 * parameters in  DD°MM.mmm’ notation to DD.dddddd° notation.
 *
 * Sign '+' is set for positive latitudes/longitudes (North, East)
 * Sign '-' is set for negative latitudes/longitudes (South, West)
 *
 */
int8_t convert2Degrees(char* input){

    float deg;
    float minutes;
    boolean neg = false;

    //auxiliar variable
    char aux[10];

    if (input[0] == '-')
    {
        neg = true;
        strcpy(aux, strtok(input+1, "."));

    }
    else
    {
        strcpy(aux, strtok(input, "."));
    }

    // convert string to integer and add it to final float variable
    deg = atof(aux);

    strcpy(aux, strtok(NULL, '\0'));
    minutes=atof(aux);
    minutes/=1000000;
    if (deg < 100)
    {
        minutes += deg;
        deg = 0;
    }
    else
    {
        minutes += int(deg) % 100;
        deg = int(deg) / 100;
    }

    // add minutes to degrees
    deg=deg+minutes/60;


    if (neg == true)
    {
        deg*=-1.0;
    }

    neg = false;

    if( deg < 0 ){
        neg = true;
        deg*=-1;
    }

    float numeroFloat=deg;
    int parteEntera[10];
    int cifra;
    long numero=(long)numeroFloat;
    int size=0;

    while(1){
        size=size+1;
        cifra=numero%10;
        numero=numero/10;
        parteEntera[size-1]=cifra;
        if (numero==0){
            break;
        }
    }

    int indice=0;
    if( neg ){
        indice++;
        input[0]='-';
    }
    for (int i=size-1; i >= 0; i--)
    {
        input[indice]=parteEntera[i]+'0';
        indice++;
    }

    input[indice]='.';
    indice++;

    numeroFloat=(numeroFloat-(int)numeroFloat);
    for (int i=1; i<=6 ; i++)
    {
        numeroFloat=numeroFloat*10;
        cifra= (long)numeroFloat;
        numeroFloat=numeroFloat-cifra;
        input[indice]=char(cifra)+48;
        indice++;
    }
    input[indice]='\0';


}

void send_HTTP(){

    // Initializes HTTP service
    answer = sendATcommand("AT+HTTPINIT", "OK", 10000);
    if (answer == 1)
    {
        // Sets CID parameter
        answer = sendATcommand("AT+HTTPPARA=\"CID\",1", "OK", 5000);
        if (answer == 1)
        {
            // Sets url
            sprintf(aux_str, "AT+HTTPPARA=\"URL\",\"http://%s/index.php?", url);
            Serial.print(aux_str);
            sprintf(frame, "visor=false&latitude=%s&longitude=%s",
            latitude, longitude);
            Serial.print(frame);
            answer = sendATcommand("\"", "OK", 5000);
            if (answer == 1)
            {
                // Starts GET action
                answer = sendATcommand("AT+HTTPACTION=0", "+HTTPACTION:0,200", 30000);
                if (answer == 1)
                {

                    Serial.println(F("Done!"));
                }
                else
                {
                    Serial.println(F("Error getting url"));
                }

            }
            else
            {
                Serial.println(F("Error setting the url"));
            }
        }
        else
        {
            Serial.println(F("Error setting the CID"));
        }
    }
    else
    {
        Serial.println(F("Error initializating"));
    }

    sendATcommand("AT+HTTPTERM", "OK", 5000);

}


int8_t sendATcommand(char* ATcommand, char* expected_answer1, unsigned int timeout){

    uint8_t x=0,  answer=0;
    char response[100];
    unsigned long previous;

    memset(response, '\0', 100);    // Initialize the string

    delay(100);

    while( Serial.available() > 0) Serial.read();    // Clean the input buffer

    Serial.println(ATcommand);    // Send the AT command


        x = 0;
    previous = millis();

    // this loop waits for the answer
    do{
        if(Serial.available() != 0){
            response[x] = Serial.read();
            x++;
            // check if the desired answer is in the response of the module
            if (strstr(response, expected_answer1) != NULL)
            {
                answer = 1;
            }
        }
        // Waits for the asnwer with time out
    }
    while((answer == 0) && ((millis() - previous) < timeout));

    return answer;
}

Yikes! I hope I can find a library!

Do you know how to post data to a php script?

int8_t answer;
int onModulePin= 13;

char data[100];
int data_size;

char aux_str[30];
char aux;
int x = 0;

char url[] = "write here your website URL";
char frame[200];




void setup(){

    pinMode(onModulePin, OUTPUT);
    Serial.begin(115200);

    Serial.println("Starting...");
    power_on();

    delay(3000);

    // sets the PIN code
    sendATcommand("AT+CPIN=****", "OK", 2000);

    delay(3000);

    
    while (sendATcommand("AT+CREG?", "+CREG: 0,1", 2000) == 0);

    // sets APN , user name and password
    sendATcommand("AT+SAPBR=3,1,\"Contype\",\"GPRS\"", "OK", 2000);
    sendATcommand("AT+SAPBR=3,1,\"APN\",\"APN FOR Your SIM\"", "OK", 2000);
    sendATcommand("AT+SAPBR=3,1,\"USER\",\"USER FOR APN\"", "OK", 2000);
    sendATcommand("AT+SAPBR=3,1,\"PWD\",\"PASSWORD FOR APN\"", "OK", 2000);

    // gets the GPRS bearer
    while (sendATcommand("AT+SAPBR=1,1", "OK", 20000) == 0)
    {
        delay(5000);
    }

}

void loop(){


    send_HTTP();

    delay(5000);

}

void power_on(){

    uint8_t answer=0;

    // checks if the module is started
    answer = sendATcommand("AT", "OK", 2000);
    if (answer == 0)
    {
        // power on pulse
        digitalWrite(onModulePin,HIGH);
        delay(3000);
        digitalWrite(onModulePin,LOW);

        // waits for an answer from the module
        while(answer == 0){
            // Send AT every two seconds and wait for the answer
            answer = sendATcommand("AT", "OK", 2000);
        }
    }

}


void send_HTTP(){

    // Initializes HTTP service
    answer = sendATcommand("AT+HTTPINIT", "OK", 10000);
    if (answer == 1)
    {
        // Sets CID parameter
        answer = sendATcommand("AT+HTTPPARA=\"CID\",1", "OK", 5000);
        if (answer == 1)
        {
            // Sets url
            sprintf(aux_str, "AT+HTTPPARA=\"URL\",\"PHP URL HERE", url);
            Serial.print(aux_str);
            sprintf(frame, "visor=false&DATAtosend=%s&DATAtosend=%s",
            Datatosend, Datatosend);
            Serial.print(frame);
            answer = sendATcommand("\"", "OK", 5000);
            if (answer == 1)
            {
                // Starts GET action
                answer = sendATcommand("AT+HTTPACTION=0", "+HTTPACTION:0,200", 30000);
                if (answer == 1)
                {

                    Serial.println(F("Done!"));
                }
                else
                {
                    Serial.println(F("Error getting url"));
                }

            }
            else
            {
                Serial.println(F("Error setting the url"));
            }
        }
        else
        {
            Serial.println(F("Error setting the CID"));
        }
    }
    else
    {
        Serial.println(F("Error initializating"));
    }

    sendATcommand("AT+HTTPTERM", "OK", 5000);

}


int8_t sendATcommand(char* ATcommand, char* expected_answer1, unsigned int timeout){

    uint8_t x=0,  answer=0;
    char response[100];
    unsigned long previous;

    memset(response, '\0', 100);    // Initialize the string

    delay(100);

    while( Serial.available() > 0) Serial.read();    // Clean the input buffer

    Serial.println(ATcommand);    // Send the AT command


        x = 0;
    previous = millis();

    // this loop waits for the answer
    do{
        if(Serial.available() != 0){
            response[x] = Serial.read();
            x++;
            // check if the desired answer is in the response of the module
            if (strstr(response, expected_answer1) != NULL)
            {
                answer = 1;
            }
        }
        // Waits for the asnwer with time out
    }
    while((answer == 0) && ((millis() - previous) < timeout));

    return answer;
}

LOOK AND Modify this code, i wrote to u some instructions, replace it with your information.

how did u make the webserver online?
u said you sent data by wifi shield, u sent data to local server or online?

Well I come from iOS programming and some php/asp experience.

So I made a php script on a linux server that simply takes the data POST-ed to it and saves it into a MySQL db on that server.

Do you have access to a server with that configuration?

Marciokoko:
Well I come from iOS programming and some php/asp experience.

So I made a php script on a linux server that simply takes the data POST-ed to it and saves it into a MySQL db on that server.

Do you have access to a server with that configuration?

not yet, cause i can’t upload my server, u go with this config and find out what will happen, if ur server online , it will work.

Well Im going to keep searching for a suitable library a bit longer.

What do you mean by "not yet, cause i can't upload my server"?

Btw, Im using the SIM900 library and it seems to be working.

my server couldn't work online and i can't send data by using data service,

Have you searched for 'free web hosting'? I used such a service a few years ago which supported MySql and PHP, in return they place adverts on the web pages.

When you talk about your server, do you mean a server created on Arduino which serves data from Arduino via the SIM900?

i have created server on the wamp server program , but till now i wouldn't upload it to online server or arduino , and i asked if i can upload it on arduino and serve data by SIM908 or upload it online with free website,any advises?