Post a new topicPost a reply Page 1 of 1   [ 10 posts ]
Author Message
 Post subject: Send GPS data with XBee
PostPosted: Fri Jan 13, 2012 12:24 pm 

Joined: Tue Jan 03, 2012 5:19 pm
Posts: 35
Hello Libelium world,

I would like to get and send GPS data with my XBee module but when I run my code I have nothing on the serial monitor.
Before I tried the same code but with USB and it works well so I think I have an error in my GPS code but I don't know where.
Could you please help me?
Thanks in advance.

Best regards.

My code is the following :

---------------------------------------------------------------------------

packetXBee* paq_sent;
char aux[200];
int8_t state=0;
uint8_t direccion[8]={0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF};

void setup(){
//setup for Serial port
//USB.begin();

// setup the GPS module
//USB.println("Setting up GPS...");

GPS.ON();

// waiting for GPS is connected to satellites
while( !GPS.check() ) delay(1000);

//USB.println("Connected");

// Inits the XBee XSC library
xbeeZB.init(ZIGBEE,FREQ2_4G,NORMAL);

// Powers XBee
xbeeZB.ON();


}

void loop(){

paq_sent=(packetXBee*) calloc(1,sizeof(packetXBee));
paq_sent->mode=BROADCAST;
paq_sent->MY_known=0;
paq_sent->packetID=0x52;
paq_sent->opt=0;
xbeeZB.hops=0;
xbeeZB.setOriginParams(paq_sent,MAC_TYPE);

sprintf(aux,"Time:%s Date:%s Latitude:%s Longitude:%s Altitude:%s Speed:%s Course:%s",GPS.timeGPS,GPS.dateGPS,GPS.latitude,GPS.longitude,GPS.altitude,GPS.speed,GPS.course);


xbeeZB.setDestinationParams(paq_sent, direccion, aux, MAC_TYPE, DATA_ABSOLUTE);
xbeeZB.sendXBee(paq_sent);

free(paq_sent);
paq_sent = NULL;

delay(1000);


// Getting Time
/*GPS.getPosition();
USB.println("---------------");
USB.print("Time: ");
USB.println(GPS.timeGPS);
USB.print("Date: ");
USB.println(GPS.dateGPS);
USB.print("Latitude: ");
USB.println(GPS.latitude);
USB.print("Longitude: ");
USB.println(GPS.longitude);
USB.print("Altitude: ");
USB.println(GPS.altitude);
USB.print("Speed: ");
USB.println(GPS.speed);
USB.print("Course: ");
USB.println(GPS.course);
USB.println("---------------");*/

}


Top
 Profile  
 
 Post subject: Re: Send GPS data with XBee
PostPosted: Fri Jan 13, 2012 2:52 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7516
Dear Galileo,

Just to clarify your problem, and before going deep into your code:

We understand that you want to collect GPS data and send it through an Xbee. But when you run the code, there are no messages received on the other Xbee, right?
Besides that, you also say that if you plug an USB , then it works, right?

Please confirm us that for the better understanding of the problem and we kindly try to help solving it.

Kind regards


Top
 Profile  
 
 Post subject: Re: Send GPS data with XBee
PostPosted: Fri Jan 13, 2012 3:08 pm 

Joined: Tue Jan 03, 2012 5:19 pm
Posts: 35
Dear Libelium-dev,

Thank you for your quick reply and you have right.
My first trial was with a basic GPS code using USB connection.
Then I have tried to send the GPS data with XBee connection (Waspmote + Gateway) after tuned the first code.
And this trial didn't work (Serial monitor is empty when I run my code). I am sure it was my code syntax because I am not the best programmer ever...

Thank you for your help.

Best regards


Top
 Profile  
 
 Post subject: Re: Send GPS data with XBee
PostPosted: Mon Jan 16, 2012 1:08 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7516
Galileo,

In order to discard other causes, are you able to receive messages into your gateway, using example codes (like the one posted here viewtopic.php?f=14&t=7741) for your Zigbee modules?

Also put the GPS.getPosition() function before use GPS position variables.

Let's try first establish communication between Waspmote and Gateway and later go into transmitted data.

Kind regards.


Top
 Profile  
 
 Post subject: Re: Send GPS data with XBee
PostPosted: Mon Jan 16, 2012 1:30 pm 

Joined: Tue Jan 03, 2012 5:19 pm
Posts: 35
Hi Libelium-dev,

Thank you for your reply. I have already tried to send data with XBee for other applications as weather station and it works well.
I will try to put the GPS.getPosition() function before using GPS position variable and I answer you.

Best regards


Top
 Profile  
 
 Post subject: Re: Send GPS data with XBee
PostPosted: Mon Feb 13, 2012 11:24 am 

Joined: Tue Jan 03, 2012 5:19 pm
Posts: 35
Hi Libelium-dev,

I have tried few trials but got no GPS data (with USB connection and your test program or with XBee)...

Here our code to transmit GPS data with USB. Please, help!

void setup(){
//setup for Serial port
USB.begin();

// setup the GPS module
USB.print("Setting on GPS...");

GPS.ON();

USB.print("OK\nSetting up GPS...");

// waiting for GPS is connected to satellites
while( !GPS.check() )
{
delay(1000);
USB.print(".");
}

USB.println("\nConnected");

}

void loop(){

// Getting Time
GPS.getPosition();
USB.println("---------------");
USB.print("Time: ");
USB.println(GPS.timeGPS);
USB.print("Date: ");
USB.println(GPS.dateGPS);
USB.print("Latitude: ");
USB.println(GPS.latitude);
USB.print("Longitude: ");
USB.println(GPS.longitude);
USB.print("Altitude: ");
USB.println(GPS.altitude);
USB.print("Speed: ");
USB.println(GPS.speed);
USB.print("Course: ");
USB.println(GPS.course);
USB.println("---------------");

}


We print "." until the GPS module receive satellite data. Concerning the procedure, we have placed our Waspmote with GPS module in wide area without buildings around. Moreover the module is in sight of space signals.

We think that it could be a GPS module problem...

Best regards


Top
 Profile  
 
 Post subject: Re: Send GPS data with XBee
PostPosted: Tue Feb 14, 2012 2:45 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7516
Dear Galileo,

Your code seems Ok, Do you have other GPS for test if it is a GPS problem?

If you have other Waspmote we kindly ask you to try with it, to discard a Waspmote problem.

Besides that, Did you test GPS with other example codes provided with the IDE. Are they running OK? Moreover, depending on satellite coverage, sometimes GPS spends a few minutes in connecting and getting coordinates. Please be quite patient with it.

Maybe your GPS is damaged, but first we ask you to try this couple of things just to be sure it is a hardware problem.

Let us know how is it going and we will discuss the best solution.

Best Regards.


Top
 Profile  
 
 Post subject: Re: Send GPS data with XBee
PostPosted: Thu Feb 16, 2012 4:50 pm 

Joined: Tue Jan 03, 2012 5:19 pm
Posts: 35
Dear Libelium-dev,

I have tested my 5 GPS modules on each Waspmote.
They work well except one GPS module. I have also tested if all the antennas work fine and they did it.

So, one of my module is damaged. How do we do now? Can I send you the device?

Best regards.


Top
 Profile  
 
 Post subject: Re: Send GPS data with XBee
PostPosted: Fri Feb 17, 2012 10:03 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7516
Galileo,

It seems that one of you GPS module has some hardware fault.

Please contact with our technical service filling this form and apply for a RMA process. They will tell you how to send your material.

Best Regards.


Top
 Profile  
 
 Post subject: Re: Send GPS data with XBee
PostPosted: Sat Feb 18, 2012 4:09 am 

Joined: Tue Jan 03, 2012 5:19 pm
Posts: 35
Hi Libelium-dev,

Thank you for your reply, we will do it.

Best regards


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


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