Start a new topic

Display GPS map on nextion screen

I have an arduino mega and GPS shield. How is possible show the map from where I am on the screen?


1 person likes this idea

Hey Mario


Which Nextion model? (I am wondering about screen resolution and amount of flash storage)

How much area are you looking to track yourself within?  (Few Blocks, City, Province)?

What kind of resolution (1m 5m 10m)?

Does the Arduino Mega have an available SD card?

Is the Nextion model an enhanced model with gpio?

What map data will you be using?

What format is your map data in?

Is this expected to work inside?   Do you have a clear line of site to the outside sky?

How much do you know about how GPS's work?

How much do you know about how the Arduino Mega works?

How much do you know about GIS, cartography and the math used for such?

How skilled are you at programming?  If not who is doing the programming?  Are they skilled?

Which GPS shield - do you have a link to its data sheet?

Which Arduino Mega - link for its data sheet?


Basically, a GPS module will receive information from three or more orbiting satellites and will work out your current position on earth based on the information and timings from the data received by those orbiting satellites to yield a latitude, longitude and an altitude.


You will need to program your Mega to communicate with the GPS module to get your processed answer from the GPS Module.  You will need to design your HMI for the Nextion to either store your maps, or program your Mega to draw your maps.  You will need to calculate which map data you will use based upon the position given to you by the GPS module, and then calculate where you are on that map and put a marker on the screen as to your position.


Then if you are moving, you might like to periodically track your way points.

Is the enhanced model, 7" (res: 800×480, FLASH Memory: 32 MB).

A city would be nice, dont need so much resolution.

For the moment I have a microSD module where I save the latitude and longitude and works fine. The gps is EM506.

I dont know what format I should use for the map, or they are images?

Where I can store the map?

How display that images and dont show the borders between images?

How can I calculate the point where I am on the map?


I saw this page for map. https://www.openstreetmap.org/#map=2/46.7/-14.8


sry for my english

Thanks

This is a complex project and will require much effort indeed.

The Garmin or TomTom GPS navigational systems are not as simple as blinking an LED


In its simplicity, you will need to make a fair number of decisions regarding your data.

There will be some cycles of trial and error. 


However, one of the more simple approach you can begin with is

- to take each segment of your city and create a map/image that you can store in the Nextion pictures.

- your Nextion model has 32MB, this model can hold a maximum of ~43 full 800x480 pictures.

- divide you city map into 40 or so segments and store as pictures in the Nextion

- as you move from one city segment to another city segment, you would change the picture displayed.


You state you are already able to retrieve lat/long from the GPS unit and store to microSD module on your Mega, this is good.  For each of your map segments you need to determine what is the top, bottom longitudes, and what is the left, right latitudes.  (Assuming top will be north - is the easiest).


Perhaps what I might do if it were my project, would be to visit the location at each of the 4 corners of your map segment and get a few GPS readings for the location at each corner - and average these readings.

Then for that one map segment, you know what the GPS boundaries are. You will also want to take 4 reading for each of the midway points along the edges of the map and take averages for each mid point.  This will let see how much curve there is to your map - the amount maybe acceptable, or you may want to find better maps and redo your map images.


Now one thing you do know is the resolution of your map picture.  If it is an 800x480 map picture, then and assuming horizontal orientation, then this makes it easier.

The delta difference in latitude is at the latitude top (North) - the latitude at the bottom (South)

The delta difference in longitude is at the longitude left (West) - the longitude at the right (east).


By taking the delta latitude and dividing by 480 pixels, you will know roughly how many pixels on y

By taking the delta longitude and dividing by 800 pixels, you will know roughly how many pixels on x

With these two values of x and y you can plot your location on the map

   cirs 326,267,10,BLUE  // assuming y is 267 and x is 326 ... will put a blue circle size 10 where you are.


The higher your resolution (1m, 5m), the less area covered by the map - the lower the amount of issues you will have to address in the curvature of the earth.  If you can generate a flat map that is skewed and does NOT take into consideration any of the earths curves, then your map will mostly work using the above techniques - you will need to experiment with it for certain.


Techniques for dealing with curvatures are varied and become rather complex.  It isn't necessarily agreed upon as standards by all members in the GIS communities and can be a trigger of much debate.


It should be noted that simple road,river,boundary map data for say Canada/USA can easily exceed 30GBs.  So you have to consider that the 8K data page limitations of the Nextion HMI design will have to be used wisely.  Storing your map as a picture on the Nextion will use very little of that 8K data space.

You will need find good maps for your scenario that will work well for you.   You will have to strategize.


If you wanted buttons around your maps in your HMI design, then you would desire a smaller map say 700x400 and this would allow for you to divide the city into ~57 segments.  Other issues will be drving to the edge of a map and not seeing what is coming up next - so you will need to strategize how your map overlays will work (where the next map image is swapped out before reaching the borders).


As I stated, these can become very complex systems and will most likely require much effort.

Login or Signup to post a comment