Go Down

Topic: GoogleMaps/Earth, Coding, TinyGPS, EM406a, UNO (Read 1 time) previous topic - next topic

gargoor

Nov 14, 2012, 11:39 am Last Edit: Nov 14, 2012, 03:12 pm by gargoor Reason: 1
I would like to know how to display my gps data in google map or google earth ?


I am using EM406a connected to arduino uno via shield. Download TinyGPS library and now using  Simple TinyGPS example, with some addition of mine on line codes. This is my result :

Latitude: 52.239700
Longitude: 6.856480
Satallites in range: 6
Date: 14/11/2012
Time: 10:8:0
CHARACTERS=1608 SENTENCES=12 CHEKSUM ERR=0


Coding questions/probs i got are the following :

1-->Time.
it shows 0 instead of 1 ?? for whatever mins or seconds or hours
Code: [Select]
Serial.print("\n Time: "); Serial.print(hour); Serial.print(":");
   Serial.print(minute, DEC); Serial.print(":"); Serial.print(second, DEC);


2--> the present time is 11 but it shows the GMT time how to change it

3--> is there an opposite code for ss.available , say ss.notavailable? while info is not available i want to count how much time it takes till gps display the info

4--> I tried to understand, but couldn't 
Code: [Select]
gps.encode(c)

5-->  What does the question mark stand for and why 6 in the end ?
Code: [Select]
Serial.print(" \n Longitude: ");
    Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);


Your help will be highly appreciated  $)

PaulS

Quote
it shows 0 instead of 1 ?? for whatever mins or seconds or hours

What does this mean? The sample stuff you show presumably came from the print statements you show, so they are not printing 0 everywhere. Nor are they showing 1 everywhere.

Quote
2-->would like to know how to display my information every second or two seconds or every minute, right now it gives info every
Time: 10:8:1
Time: 10:8:3
Time: 10:8:5
Time: 10:8:6
Time: 10:8:8
Time: 10:8:9

The time is when the GPS fix was received. You can't make it receive fixes more often. You can print the fix data only when the minute value changes, if you want.

Quote
3--> the present time is 11 but it shows the GMT time how to change it

Move to somewhere else. The GPS only shows GMT time. You have to apply the correct offset for your time zone.

Quote
4--> I tried to understand, but couldn't 

Can't help you there. I understand it, and I don't understand what you don't understand.

It's calling the encode() method of the TinyGPS instance, with the last character received from the GPS. That function returns true or false (true when the NMEA sentence is complete; false when it is not).

Quote
5-->  What does the question mark stand for and why 6 in the end ?

The ? mark and : are the only ternary operator in C. It says to evaluate the expression before the ? and return the value before the : if the expression is true and the value after the : if the expression is false.

The expression then evaluates to:

Code: [Select]
Serial.print(flon, 6);
or
Code: [Select]
Serial.print(0.0, 6);
So, now you can see what the 6 is for, right?

gargoor

PaulS thank you for replying in such short time
Concerning 1 :
i meant that my result for time is
Time: 10:8:0  (where it should be 10:8:1)
Time: 11:0:0  (where it should be 11:1:1)
how to make 0 appear as minute 1 or second 1
Time: 10:8:1
Time: 11:1:1
-------
Concerning 2:
I would to know how to shift the time by GMT+1
-----
thank you very much for explaining 4 and 5 now its clear to me
whats remaining beside the above is

A: I would like to know how to display my gps data in google map or google earth ?

B: is there an opposite code for ss.available , say ss.notavailable? while info is not available i want to count how much time it takes till gps display the info

PaulS

Quote
i meant that my result for time is
Time: 10:8:0  (where it should be 10:8:1)
Time: 11:0:0  (where it should be 11:1:1)

How do you know that?

Code: [Select]
Serial.print("\n Time: "); Serial.print(hour); Serial.print(":");
   Serial.print(minute, DEC); Serial.print(":"); Serial.print(second, DEC);

Why are you supplying a second argument for 2 of the 3 ints? Supply it for all or none. Make sure that you understand WHAT that optional argument is doing.

Quote
I would to know how to shift the time by GMT+1

You have the time as a series of integers. It's not rocket science to increment the hour by the required amount, and test for overflow. Adding to the day and month and year is a little more challenging, but possible.

Quote
A: I would like to know how to display my gps data in google map or google earth ?

Do you know how to do that from ANY other platform? From the Arduino, it's the same.

Quote
B: is there an opposite code for ss.available , say ss.notavailable? while info is not available i want to count how much time it takes till gps display the info

The available() method returns the number of bytes of data available to be read. You can do one thing (read the data) if the value is greater than 0, and something else (mark time) when it is 0.

gargoor

I solved the GMT+1 by
Code: [Select]
Serial.print("\n Time: ");
   Serial.print(hour+1); //GMT+1


I would like to use google map on pc so later i move to presenting my data on mobile phone. And no i don't know how to display gps data on other platforms , i tried mini gps and SirfDemo but didn't manage to display anything  :smiley-eek-blue:

"
Quote
Why are you supplying a second argument for 2 of the 3 ints? Supply it for all or none. Make sure that you understand WHAT that optional argument is doing.
I didn't get what you mean by that.However, I am printing each separately so it look neat, otherwise if i use date and time function
Code: [Select]
TinyGPS::get_datetime(unsigned long *date, unsigned long *time, unsigned long *age)
it will show in hhmmss and ddmmyy format. instead of hh:mm:ss and dd:mm:yy

Cybernetician

Quote
I would like to use google map on pc so later i move to presenting my data on mobile phone. And no i don't know how to display gps data on other platforms , i tried mini gps and SirfDemo but didn't manage to display anything 


http://www.sourcecodester.com/visual-basic/how-use-google-map-api-and-google-earth-plug-vb6.html
From Idea To Invention

PaulS

Quote
solved the GMT+1 by

As 23:56, what is that code going to say the time is?

gargoor

PaulS that's a good point, i'll look it up as soon as i can

Cybernetician
i'll look it up , thanks.. i was wishing though it is arduino sketch related not VB6 because i never used it before while time is not on my side currently.


Go Up