Sim900 gsm/gps vehicle tracker

Status
Not open for further replies.

Eng_mohamad

Newbie level 3
Joined
May 5, 2013
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,319
hello
My graduation project is a GSM/GPS Car Tracker.
I am using pic18f452, Mikroc and sim900
i almost finish the project but i have a problem.
i store the coordinates that come from the sim900 to the pic via uart in an array and then i need to convert the coordinates from ddmm.mmmmmm format to decimal format but i cant.
the problem in ddmm.mmmmmm format that i cant send it in a google map link it wont work it must be either dd mm.mmmmmm'E or the ordinary decimal format that consist of degress only dd.dddd something like that
i tried every thing i could think of but i cant manipulate the data inside the array
here is the code:
void GPS(){
char Pos_lo[15],Pos_la[15],Spe[15],x[15];

UART1_Write_Text("AT+CGPSINF=0");
uart1_write(13);

while(1){

if(uart1_data_ready){
Data=UART1_Read();
if(Data==',')break; //data that the micro controller will recieve will be like this:
// mode,longitude,latitude,UTCtime,ttff,num,speed,course
} // all i want is longitude , latitude , speed
} // so i skipped the mode using this command



uart1_read_text(Pos_lo,",",15); //and then stored the longitude inside Pos_lo
uart1_read_text(Pos_la,",",15); //and then stored the latitude inside Pos_la
for(i=0;i<4;i++){ //and then i skipped UTCtime,ttff,num
uart1_read_text(x,",",30);

}
uart1_read_text(Spe,",",30); //and i stored the speed in Spe
}
}
this works fine and i got the longitude and latitude and speed but i cant convert it please help my graduation project presentation is on 22/6/2013
and i still have many things to do
 

i posted the c code it starts from void GPS() and ends at the last }
i cant post the whole project code because it is very big
what i can do is to tell you the coordinates that i get it will be in this format(as an example):
Latitude 3006.487442 (ddmm.mmmmmm)
Longitude 3122.38873
Speed 0.000000
 

Give an example of your latitude and logitude data. Tell how do you want it to be to send to google maps. Data will be in string format. You can't send it directly if you have to send decimal numbers to google maps. If your latitude array contains something like below

lat[20] = "3020.34789124" then while sending data to google maps if you have to send it like 3020.34789124 then you have to create a for loop and loop from 0 to slrlen - 1. and then send each element of array like this

buffer = lat - 0x30 and retain the dot.
 

First thanks for your reply
The data i want to put in the google maps link must be one of these:
30 20.34789124'N,31 22.38873'E (dd mm.mmmmmm) Space between the degree and minutes must exists
or
30.10812403333,31.3731455(dd.ddddd)
these are the formats that the google map accepts but the format i get from the module is :
3006.487442 (ddmm.mmmmmm)
3122.38873 (ddmm.mmmmmm) without space between degress and minutes so the link will not work
i dont have a problem in adding the 'N and 'E because i will add them as a string after the array that contains the lat and long
but the problem that i cant add the space because it will be inside the array or i cant transform it to (dd.dddddd)because i have to get the elements out of the array and do some math on it.i know how to do the math to convert it but i cant get out each element from the array.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…