Click here to Skip to main content
15,891,649 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all
I am attempting to make a simple Vehicle to Vehicle V2V commutation system using 2 nRF24L01 as transmitter and receiver connected to Arduino Uno. Then i connected 2 GPS devices for each Arduino board type Adafruit Ultimate GPS Breakout Version 3. Is there a mathematical equation or a simple code that can be used to deal with the longitude and latitude obtained from the two devices to know the distance between the two vehicles as well as determine the direction, for example cars approaching or moving away depending on the updated values sent from the sender.

What I have tried:

In the next lines i put a part of the serial monitor that i have got when i connect the GPS during my experiments.


10:56:06.194 -> Time: 7:56:6.0
10:56:06.194 -> Date: 28/8/2020
10:56:06.194 -> Fix: 1 quality: 1
10:56:06.194 -> Location: 3230.0673N, 4426.9941E
10:56:06.194 -> Location (in degrees, works with Google Maps): 32.5011, 44.4499
10:56:06.194 -> Speed (knots): 0.11
10:56:06.194 -> Angle: 190.40
10:56:06.194 -> Altitude: 32.50
10:56:06.194 -> Satellites: 4
10:56:06.896 -> $PGTOP,11,2*6E
10:56:06.896 -> $GPGGA,075607.000,3230.0673,N,04426.9943,E,1,04,2.13,32.5,M,1.3,M,,*6E
10:56:06.989 -> $GPRMC,075607.000,A,3230.0673,N,04426.9943,E,0.10,215.01,280820,,,A*68
10:56:07.927 -> $PGTOP,11,2*6E
10:56:07.927 -> $GPGGA,075608.000,3230.0673,N,04426.9944,E,1,04,2.13,32.6,M,1.3,M,,*65
10:56:08.021 -> $GPRMC,075608.000,A,3230.0673,N,04426.9944,E,0.07,210.06,280820,,,A*64

Thank you
Posted
Updated 14-Sep-20 12:10pm

1 solution

Quote:
GPS distance between two points in arduno

Look at : Great-circle distance - Wikipedia[^]
 
Share this answer
 
Comments
CPallini 15-Sep-20 2:12am    
5.
Patrice T 15-Sep-20 2:20am    
Thank you
Hussein Awadh1 16-Sep-20 4:55am    
Thank you my friend for sharing me this link. I tried to calculate the distance within the coverage area provided by nRF24L01 which provide 500 meters, i mean the suggested method work under these conditions.
For Example a straight road with 2 vehicles when the 1st vehicle enter the range of the 2nd vehicle i can got the approximation distances in real time between these vehicles by taking the advantages for the GPS located in both vehicles.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900