Location alert if exceed specific distance

Hi

Looking at a new project and wondering whether it is feasible/if anyone has done similar and could share

I want to define a preset location using GPS, and if a module exceeds a given distance (say 50 metres) from the base location, a buzzer or LED turns on

Has anyone got any advice how to do this?

Thanks

GPS modules send out position data over UART using a protocol called NMEA 0183.

There are libraries like TinyGPS that decode the messages for you. They are simple to use because they are just parsing data, so they run on any Arduino.

Once you have the longitude and latitude you can simply calculate the distance between two points and switch your LED accordingly.

That will not be easy. The accuracy for conventional GPS is some 10 meters. Experienced people claims GPS doesn't work indoors.

hobbm013:
Hi

Looking at a new project and wondering whether it is feasible/if anyone has done similar and could share

I want to define a preset location using GPS, and if a module exceeds a given distance (say 50 metres) from the base location, a buzzer or LED turns on

Has anyone got any advice how to do this?

Thanks

Thats not difficult, Arduino libraries such as TinyGPS++ have routines that will calculate the distance and direction from two sets of GPS co-ordinates.

It rather depends on the accuracy you need, outdoors with a good view of the sky a standard GPS will give a position error in the range of 3-5m, but it can extend to an error of 10m or more, depending on the vicinity of buildings and trees etc.

It can work indoors, however the accuracy can vary from normal to zero (no satellite reception).

aarg:
It can work indoors, however the accuracy can vary from normal to zero (no satellite reception).

Agreed, the times I have checked the postion accuracy 'indoors' it can be 50m or worse, but take the GPS just a few metres 'outdoors' of the 'indoors' location and position accuracy rises to the 3-5m range.

Thanks for all the responses so far. I would only be looking at using it outdoors so the issue of range is something which shouldn't be too bad.

Being a beginner to arduino, does anyone have any further advice of which components I may need, how to wire them up and the code required?

Many thanks

In which parts of this project do You feel You have knowledge, some experience?

I’ve built basic circuits before and have a basic understanding of how to put a circuit together. But anything complex I am not great at, although I do find I am improving

Coding is probably my biggest weakness

How are the base station and the portable piece going to talk to each other? You will likely need a radio link that is reliable at 50 meters. Maybe LoRa radios? Maybe over the cellular network?

Okey.
I built a GPS based speedometer to use in veteran trains. Studiyng the interface of the NEO-6M GPS and using their example code made things happend. That was the base for the final sketch. A phone charging powerbank is the power source. An I2C communicated LCD shows the information.

I feel it sounds so simple on the surface but always end up getting stressed out when it comes to the finer details and actually making things work!

I have a neo-6m component so I might look into that. I’m sure my mind is over complicating things as it usually does

Use the example code and add on one function at the time and make that work. Develping the software will be taking most of Your time.

Sorry for the stupid question but any idea where I can find the example code? Is it a simple google search?

Good question. I don't remember and I made some failing tries.
Use tinyGPS++.h library. I guess that the library contains example code. No, didn't find it there.
Wait a little for some more sharp helper will answer!

hobbm013:
I want to define a preset location using GPS, and if a module exceeds a given distance (say 50 metres) from the base location, a buzzer or LED turns on

Every boat GPS has one, called "anchor alarm".
Leo..

hobbm013:
Sorry for the stupid question but any idea where I can find the example code? Is it a simple google search?

Most all Arduino libraries contain code examples that show how to use the libraries functions, look in the libraries \example folder.

Some of the TinyGPS++ examples do include demonstration code of how to calculate the distance from the GPSs current position to a given (fixed) set of GPS co-ordinates.

Made a little bit of progress. Got the Neo6m to work and provide raw gps data, but for some reason it does not work with the tiny GPS library.

Any advice? I haven't been able to find much example code for what I am trying to do

Use TinyGPS++ library!

Well, did you actually try the examples from the TinyGPS++ library ?

If you looking for an 'example' that does exactly what you want, you might well search for a long time.