Libelium is offering new technical support channels, to contact with de Technical Support team to solve any issue our doubt please contact with your sales agent or visit our contact site



Post a new topicPost a reply Page 1 of 1   [ 8 posts ]
Author Message
 Post subject: (!)Error getting url GPRS+GPS Module Arduino uno SIM908
PostPosted: Thu Jan 23, 2014 1:18 pm 

Joined: Thu Jan 23, 2014 9:09 am
Posts: 2
Olá, antes de mais nada gostaria de pedir desculpas mas não falo Espanhol então resolvi escrever em português mesmo ao invés de usar algum tradutor que certamente acaberá estragando todo o idioma. Espero que entendam e possam me ajudar, gostaria também de parabenizar toda equipe de suporte e a qualidade dos tutoriais, videos e produtos da Cooking Hacks.

Devo confessar que escolhi iniciar este projeto justamente por ter um vasto material no fórum, respostas rápidas e tutoriais de cada produto.

Sou iniciante no mundo da eletrônica, mas tenho algum conhecimento assim como em programação, sou um grande entusiasta

Meu projeto é desenvolver um protótipo e futuramente embarcar o dispositivo em uma frota de ônibus, envolve um leitor de RFI, uma "catraca virtual" e um rastreador de posicionamento em tempo real.


Para desenvolver tal projeto comprei os seguintes produtos:
a) Parte do Rastreador em tempo real
1 Arduino Uno Rev.3
1 x GPRS+GPS Quadband Module for Arduino (SIM908)
1 x GPRS antenna
1 x GPS antenna

b) Parte do RFID
1 x RFID 125 KHZ MODULE FOR ARDUINO / RASPBERRY PI / WASPMOTE
1 x COMMUNICATION SHIELD (XBEE, BLUETOOTH, RFID)

C) Parte da "catraca virtual"
1 x DIGITAL INFRARED MOTION SENSOR (PIR)

Atualmente estou testando o módulo GPRS+GPS Quadband for Arduino (SIM908) para fazer o "geo tracking" e enfrentando os seguintes problemas.

Depois de testar a placar realizando alguns comandos AT via serial e usando o código da Cooking Hacks para envio de SMS consigo concluir que o chip SIM da minha operadora está funcionando assim como a placa! :D

Depois comecei alguns testes de envio de URL via HTTP usando ainda os códigos disponibilizados pela Cooking Hacks no tutorial comecei a enfrentar problemas e não tive sucesso!

Então resolvi logo ir para o código que vou usar no meu projeto, o Realtime geolocation tracking.

Abaixo vou postar uma foto da placa como está montada, assim como o código que estou usando e o retorno na serial com o erro! :roll:

Minha Placa esta alimentada por usb e uma bateria 9v como se vê na foto abaixo, liguei os 2 fios da bateria na protoboard e liguei suas respectivas conexões em Vin e GND no arduino uno.

Foto da Placa:
http://sdrv.ms/1jDE6LQ


Códigoque estou usando:
Code:
...


Mensagem de Erro que tenho na Serial:
Quote:
gmaps Starting...
AT
AT+CPIN=8486
AT+CGPSPWR=1
AT+CGPSRST=0
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CREG?
AT+SAPBR=3,1,"Contype","GPRS"
AT+SAPBR=3,1,"APN","zap.vivo.com.br"
AT+SAPBR=3,1,"USER","vivo"
AT+SAPBR=3,1,"PWD","vivo"
AT+SAPBR=1,1
AT+CGPSINF=0
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://homolog.tk/pi_lab/arduino/43geotracker/demo_sim908.php?visor=false&latitude=-23.620174&longitude=-46.635189&altitude=0&time=20140123120438&satellites=4&speedOTG=0.492697&course=227.850327áì"
AT+HTTPACTION=0
Error getting url
AT+HTTPTERM
AT+CGPSINF=0
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://homolog.tk/pi_lab/arduino/43geotracker/demo_sim908.php?visor=false&latitude=-23.620626&longitude=-46.636203&altitude=67&time=20140123120513&satellites=4&speedOTG=0.341828&course=175.829254àt"
AT+HTTPACTION=0
Error getting url
AT+HTTPTERM
AT+CGPSINF=0
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://homolog.tk/pi_lab/arduino/43geotracker/demo_sim908.php?visor=false&latitude=-23.620630&longitude=-46.636241&altitude=68&time=20140123120549&satellites=4&speedOTG=0.350552&course=175.837006áü"
AT+HTTPACTION=0
Error getting url
AT+HTTPTERM
AT+CGPSINF=0
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://homolog.tk/pi_lab/arduino/43geotracker/demo_sim908.php?visor=false&latitude=-23.620630&longitude=-46.636253&altitude=68&time=20140123120625&satellites=4&speedOTG=0.365415&course=174.896835à„"
AT+HTTPACTION=0


URL em que está hospedado o PHP:
http://homolog.tk/pi_lab/arduino/43geotracker/demo_sim908.php




Agradeço desde já a ajuda!


Last edited by fabioraphael on Fri Jan 24, 2014 11:19 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: (!)Error getting url GPRS+GPS Module Arduino uno SIM908
PostPosted: Fri Jan 24, 2014 8:37 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hello fabioraphael,

Could you send us the information in english or spanish (use the google traslator)?

Regards.


Top
 Profile  
 
 Post subject: Re: (!)Error getting url GPRS+GPS Module Arduino uno SIM908
PostPosted: Fri Jan 24, 2014 10:00 am 

Joined: Thu Jan 23, 2014 9:09 am
Posts: 2
Hello , first of all like to apologize I do not speak Spanish. :/ I would also like to congratulate the whole team of support and quality of tutorials , videos and Cooking Hacks products.

I must confess that I chose to start this project just to have a vast amount of material on the forum quick answers and tutorials for each product.

I am a beginner in the world of electronics, but I have some knowledge as well as programming , I am a big fan!

My project is to develop a prototype device and eventually embark on a fleet of buses , involves a reader RFI , a "virtual ratchet " and a crawler positioning in real time.


To develop such a project bought the following products:
a) Part of the geotracker in real time
1 Arduino Uno Rev.3
1 x GPS + GPRS Quadband Module for Arduino ( SIM908 )
1 x GPRS antenna
1 x GPS antenna

b ) Part of RFID
1 x 125 KHZ RFID MODULE FOR ARDUINO / RASPBERRY PI / Waspmote
1 x COMMUNICATION SHIELD ( XBEE , BLUETOOTH , RFID )

C ) Part of the "virtual ratchet "
1 x DIGITAL INFRARED MOTION SENSOR ( PIR )

I'm currently testing the GPS + GPRS Quadband for Arduino ( SIM908 ) module to do the " geotracking" and facing the following problems .

After performing test score some AT commands via serial code and using the Cooking Hacks for SMS can conclude that the SIM chip from my carrier is working as well as the board ! :)

Then I started some tests sending URL via HTTP still using the codes provided by Cooking Hacks in the tutorial started facing problems and had no success!

So I decided to just go to the code that I use in my project, Realtime geolocation tracking .
Below I will post a picture of the board is mounted as well as the code I am using and return in serial with the error !

Error getting url on serial!

My board this powered by usb and a 9v battery as shown in the photo below , called the 2 battery wires on the breadboard and turned their respective connections to Vin and GND on the arduino uno .

Photo of board:
http://sdrv.ms/1jDE6LQ


Code:
Code:
/*
int8_t answer;
int onModulePin= 2;

char data[100];
int data_size;

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

char url[] = "homolog.tk/pi_lab/arduino/43geotracker";
char frame[200];

char latitude[15];
char longitude[15];
char altitude[6];
char date[16];
char time[7];
char satellites[3];
char speedOTG[10];
char course[10];


void setup(){

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

    Serial.println("vivo 43 gmaps Starting...");
    power_on();

    delay(3000);

    // sets the PIN code
    sendATcommand("AT+CPIN=8486", "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\",\"zap.vivo.com.br\"", "OK", 2000);
    sendATcommand("AT+SAPBR=3,1,\"USER\",\"vivo\"", "OK", 2000);
    sendATcommand("AT+SAPBR=3,1,\"PWD\",\"vivo\"", "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
    strcpy(altitude,strtok(NULL, ".")); // Gets altitude
    strtok(NULL, ",");   
    strcpy(date,strtok(NULL, ".")); // Gets date
    strtok(NULL, ",");
    strtok(NULL, ","); 
    strcpy(satellites,strtok(NULL, ",")); // Gets satellites
    strcpy(speedOTG,strtok(NULL, ",")); // Gets speed over ground. Unit is knots.
    strcpy(course,strtok(NULL, "\r")); // Gets course

    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/demo_sim908.php?", url);
            Serial.print(aux_str);
            sprintf(frame, "visor=false&latitude=%s&longitude=%s&altitude=%s&time=%s&satellites=%s&speedOTG=%s&course=%s",
            latitude, longitude, altitude, date, satellites, speedOTG, course);
            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;
}





Error on serial:

Quote:
Starting...
AT
AT+CPIN=8486
AT+CGPSPWR=1
AT+CGPSRST=0
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CGPSSTATUS?
AT+CREG?
AT+SAPBR=3,1,"Contype","GPRS"
AT+SAPBR=3,1,"APN","zap.vivo.com.br"
AT+SAPBR=3,1,"USER","vivo"
AT+SAPBR=3,1,"PWD","vivo"
AT+SAPBR=1,1
AT+CGPSINF=0
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://homolog.tk/pi_lab/arduino/43geotracker/demo_sim908.php?visor=false&latitude=-23.620174&longitude=-46.635189&altitude=0&time=20140123120438&satellites=4&speedOTG=0.492697&course=227.850327áì"
AT+HTTPACTION=0
Error getting url
AT+HTTPTERM
AT+CGPSINF=0
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://homolog.tk/pi_lab/arduino/43geotracker/demo_sim908.php?visor=false&latitude=-23.620626&longitude=-46.636203&altitude=67&time=20140123120513&satellites=4&speedOTG=0.341828&course=175.829254àt"
AT+HTTPACTION=0
Error getting url
AT+HTTPTERM
AT+CGPSINF=0
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://homolog.tk/pi_lab/arduino/43geotracker/demo_sim908.php?visor=false&latitude=-23.620630&longitude=-46.636241&altitude=68&time=20140123120549&satellites=4&speedOTG=0.350552&course=175.837006áü"
AT+HTTPACTION=0
Error getting url
AT+HTTPTERM
AT+CGPSINF=0
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://homolog.tk/pi_lab/arduino/43geotracker/demo_sim908.php?visor=false&latitude=-23.620630&longitude=-46.636253&altitude=68&time=20140123120625&satellites=4&speedOTG=0.365415&course=174.896835à„"
AT+HTTPACTION=0




PHP URL:
http://homolog.tk/pi_lab/arduino/43geot ... sim908.php

please, help me!
Thx for all!


Top
 Profile  
 
 Post subject: Re: (!)Error getting url GPRS+GPS Module Arduino uno SIM908
PostPosted: Mon Jan 27, 2014 9:27 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hello fabioraphael,

Maybe coulb be a power supply problem.

Could you test the code with a 2A power supply?

Regards.


Top
 Profile  
 
 Post subject: Re: (!)Error getting url GPRS+GPS Module Arduino uno SIM908
PostPosted: Sun Feb 02, 2014 11:11 pm 

Joined: Sun Feb 02, 2014 10:14 pm
Posts: 9
Dear fabioraphael,

before checking power (2A) i would start with checking your URL.
In your serial monitor screenshot is clearly visible, that your URL is corrupted by adding strange characters after your last parameter which should be course

like:

course=174.896835à„

Correct URL should look like

script.php?visor=false&latitude=%s&longitude=%s&altitude=%s&time=%s&satellites=%s&speedOTG=%s&course=%s

I have tried this demo script o my own SIM908 machine, its the same jibberish.
I recommend to change code and try to sanitize course variable from strange characters.
Maybe retyping to int and back to char will help you.

Mgx


Top
 Profile  
 
 Post subject: Re: (!)Error getting url GPRS+GPS Module Arduino uno SIM908
PostPosted: Mon Feb 03, 2014 9:18 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hello mgx,

Thanks for your contribution!

Regards.


Top
 Profile  
 
 Post subject: Re: (!)Error getting url GPRS+GPS Module Arduino uno SIM908
PostPosted: Mon Apr 11, 2016 9:46 pm 

Joined: Mon Apr 11, 2016 9:38 pm
Posts: 1
Olá FábioRapphael,
Estou passando pelo mesmo problema que vc.
Vc chegou a resolver o problema acima.

Sou do Brasil (RJ)

att.


Hello FábioRapphael ,
I'm going through the same problem vc .
Vc came to solve the above problem .

I'm from Brazil (RJ )

att .


Last edited by gopereira on Tue Apr 12, 2016 2:27 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: (!)Error getting url GPRS+GPS Module Arduino uno SIM908
PostPosted: Tue Apr 12, 2016 7:14 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
gopereira wrote:
Olá FábioRapphael,
Estou passando pelo mesmo problema que vc.
Vc chegou a resolver o problema acima.

Sou do Brasil (RJ)

att.


Hi gopereira,

Could you send us the information in english or spanish (use the google traslator)? Please open a new post with all your information to help you better.

Regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 8 posts ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use.