# how to use GPS to measure the distance traveled.

I have to use GPS for measuring the distance run by a vehicle, but i am running out of ideas on how to use the GPS NEO6M module for it. The thing is that, as i ride my vehicle, let us assume 5kms, the module must help me to run for 5kms and then alert me after as soon as I complete riding the vehicle after 5kms. This is what I am searching for! pls reply!!...

you can use that old time formula

distance = sqrt ( (y2-y1)² + (x2-x1)² )

given the coordinates of two points (x1,y1) and (x2,y2)

x for longitude, y for latitude

KASSIMSAMJI: you can use that old time formula

distance = sqrt ( (y2-y1)² + (x2-x1)² )

given the coordinates of two points (x1,y1) and (x2,y2)

x for longitude, y for latitude

does the co.ordinates of 2 points mean the start point and stop point?

agyogesh619: does the co.ordinates of 2 points mean the start point and stop point?

Yes but the formula only works if you're travelling in a perfectly straight line between the two points. Is that what you are doing?

If you're travelling other than in a straight line you need to take frequent points, maybe every few seconds, calculate those distances and then add them all up to give you the total distance.

Steve

GPS modules return latitude and longitude positions in degrees and minutes.

To measure distances between GPS positions, study the information on this site.

Unfortunately, standard Arduinos use single precision 32 bit floating point math (not double precision), which is too inaccurate to use for short distance calculations with GPS coordinates.