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   [ 6 posts ]
Author Message
 Post subject: [DISCUSS] GPS TRACKER USING 3G/GPS shield and Rpi B+
PostPosted: Sun Oct 04, 2015 6:10 am 

Joined: Tue Sep 29, 2015 12:44 am
Posts: 24
Good Day :D

Hello, have anyone tried this project?
https://www.cooking-hacks.com/documenta ... al-sim-900

Im want to try this project with different hardware stated at the subject.
My question is, will it work or should it work if try it with 3G/GPS shield?
It should be the same right? even if it different, only slightly different right?
Can anyone provide me some insight on this.

Zar.


Top
 Profile  
 
 Post subject: Re: [DISCUSS] GPS TRACKER USING 3G/GPS shield and Rpi B+
PostPosted: Mon Oct 05, 2015 7:52 am 

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

we only can ensure that it works with the same hardware:
https://www.cooking-hacks.com/gprs-quad ... or-arduino

Regards.


Top
 Profile  
 
 Post subject: Re: [DISCUSS] GPS TRACKER USING 3G/GPS shield and Rpi B+
PostPosted: Wed Oct 28, 2015 4:00 am 

Joined: Tue Sep 29, 2015 12:44 am
Posts: 24
hello libelium-dev,
can you show the tutorial to enable internet data without making the 3g shield as modem.. thanks


Top
 Profile  
 
 Post subject: Re: [DISCUSS] GPS TRACKER USING 3G/GPS shield and Rpi B+
PostPosted: Wed Oct 28, 2015 9:13 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hi Zar,

All the tutorials that we have are in the tutorials section:

https://www.cooking-hacks.com/index.php ... rial/index

Regards


Top
 Profile  
 
 Post subject: Re: [DISCUSS] GPS TRACKER USING 3G/GPS shield and Rpi B+
PostPosted: Sat Dec 05, 2015 4:09 pm 

Joined: Tue Sep 29, 2015 12:44 am
Posts: 24
Thanks for the reply,

Can you modify this code from http in https://www.cooking-hacks.com/projects/ ... on-tracker so that it can be used with raspberry pi.

Code:

/* 
 *  Geocaching Santa Claus
 * 
 *  Copyright (C) Libelium Comunicaciones Distribuidas S.L.
 *  http://www.libelium.com
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *  a
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see http://www.gnu.org/licenses/.
 * 
 *  Version:           2.0
 *  Design:            David Gascón
 *  Implementation:    Luis Martin
 */


int8_t answer;
int onModulePin= 2;
char gps_data[100];
int counter;

char aux_string[30];
char phone_number[]="*********";

int data_size = 0;
int end_file = 0;

char aux_str[100];

char data[350];
int x = 0;
long previous;

char url[ ]="cooking-hacks.com";
int port= 80;
char request[ ]="GET /t/gps-route.php?gps=";
char request1[ ]= "HTTP/1.1\r\nHost: cooking_hacks.com\r\nContent-Length: 0\r\n\r\n";

void setup(){

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

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

    delay(5000);
          // starts GPS session in stand alone mode
    answer = sendATcommand("AT+CGPS=1,1","OK",1000);   
    if (answer == 0)
    {
        Serial.println("Error starting the GPS");
        Serial.println("The code stucks here!!");
        while(1);
    }

    delay(3000);

    while( (sendATcommand("AT+CREG?", "+CREG: 0,1", 500) ||
        sendATcommand("AT+CREG?", "+CREG: 0,5", 500)) == 0 );

    // sets APN, user name and password
    sendATcommand("AT+CGSOCKCONT=1,\"IP\",\"movistar.es\"", "OK", 2000);
    sendATcommand("AT+CSOCKAUTH=1,1,\"movistar\",\"movistar\"", "OK", 2000);

}
void loop(){

    answer = sendATcommand("AT+CGPSINFO","+CGPSINFO:",1000);    // request info from GPS
    if (answer == 1)
    {

        counter = 0;
        do{
            while(Serial.available() == 0);
            gps_data[counter] = Serial.read();
            counter++;
        }
        while(gps_data[counter - 1] != '\r');
        gps_data[counter] = '\0';
        if(gps_data[0] == ',')
        {
             Serial.println("No GPS data available"); 
             delay(3000);
        }
        else
        {
        answer = sendATcommand("AT+CGPS=0","OK",1000);   
    
        // request the url
     sprintf(aux_str, "AT+CHTTPACT=\"%s\",%d", url, port);
        answer = sendATcommand(aux_str, "+CHTTPACT: REQUEST", 60000);

        if (answer == 1)
         {       
          Serial.print(request);
     Serial.print(gps_data);
          Serial.println(request1);
          // Sends
          aux_str[0] = 0x1A;
          aux_str[1] = 0x00;
          answer = sendATcommand(aux_str, "+CHTTPACT: DATA,", 60000);

        if (answer == 1)
        {
            Serial.print("Sent ");   
           
            int a=0;
            for(int a=0;a<60;a++){  //Wait 30 minutes
              delay(30000);
             }

             // starts GPS session in stand alone mode
              answer = sendATcommand("AT+CGPS=1,1","OK",1000);   
              if (answer == 0)
              {
                 Serial.println("Error starting the GPS");
                Serial.println("The code stucks here!!");
                while(1);
              }
        }
        else
        {
            Serial.print("error ");
        }
    }
    else
    {
        Serial.print("error ");
        Serial.println(answer, DEC);
    }


        }       

    }
    else
    {
        Serial.println("Error");
    }


}

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 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;
}
       


Top
 Profile  
 
 Post subject: Re: [DISCUSS] GPS TRACKER USING 3G/GPS shield and Rpi B+
PostPosted: Wed Dec 09, 2015 8:54 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hi Zar,

Sorry but we only have implemented this code to work with Arduino, if you want to work with Raspberry Pi you have to modify it.

Regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 6 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.