Global Earthquake Display on ILI9341 TFT using ESP8266.

Place your projects here
User avatar
Fernando Perez
Posts: 118
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 62 times
Been thanked: 67 times

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Post by Fernando Perez »

Thanks Marcello. I'm happy for Andy. This is what my screen looks like right now with his program:
image.png
Well, it looks better, the photo is not very good.
You do not have the required permissions to view the files attached to this post.
cicciocb
Site Admin
Posts: 401
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 90 times
Been thanked: 289 times
Contact:

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Mon Aug 09, 2021 6:19 pm Thanks Marcello. I'm happy for Andy. This is what my screen looks like right now with his program:
image.png
Well, it looks better, the photo is not very good.
No problem Armando :D
User avatar
Electroguard
Posts: 272
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 54 times
Been thanked: 127 times

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Post by Electroguard »

I'm afraid the Strait of Gibraltar is being shown on the wrong continent.
User avatar
Fernando Perez
Posts: 118
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 62 times
Been thanked: 67 times

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Post by Fernando Perez »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Sun Aug 08, 2021 1:43 pm With more data from earthquakes, I see that my latitude-to-point conversion calculation "y" on the graph is not working correctly.
I have also tried without success with:

Code: [Local Link Removed for Guests]

' Convert longitude and latitude of event to screen co-ordinates.
    x = cInt(convert.map(lon, -180, 180, 0, 480))
    y = cInt(convert.map(lat, -90, 90, 0, 320))
    y = (320 - y) + 52
However, the conversion for the x-axis does seem correct.
Do any of you know the subject of geographic coordinates?
You can help me?
Right, Robin.
Currently the code I posted seems to correctly calculate the x-axis (longitude) value but fails on the y-axis (latitude).
I have to enter a conversion factor as latitude is not linear.
While waiting for Andy to dismiss his guests :lol:, I have obtained a csv file to treat in Excel and calculate the formula to be applied:

Code: [Local Link Removed for Guests]

file$ = "/latitud.txt"
for lat = -90 to 90 step 0.5
  y = cInt(convert.map(lat, -90, 90, 0, 320))
  line$ = str$(lat) + ";" + str$(y) + chr$(10)
  file.append file$, line$
  wlog line$
next lat  
But I am stopped.
If something occurs to you, I'll listen to you.

[External Link Removed for Guests]
[External Link Removed for Guests]
[External Link Removed for Guests]
User avatar
Fernando Perez
Posts: 118
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 62 times
Been thanked: 67 times

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Post by Fernando Perez »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Mon Aug 09, 2021 11:02 pm
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Mon Aug 09, 2021 6:19 pm Thanks Marcello. I'm happy for Andy. This is what my screen looks like right now with his program:
image.png
Well, it looks better, the photo is not very good.
No problem Armando :D
Francesco, this is my last neuron taking a vacation. :o
image.png
You do not have the required permissions to view the files attached to this post.
User avatar
Electroguard
Posts: 272
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 54 times
Been thanked: 127 times

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Post by Electroguard »

Yeah 'Fernando, I'm sure Andy will sort you out as soon as he is able.

I only pointed out Strait of Gibraltar error in case it hadn't already been noticed, whereas it was immediately apparent to me cos I used to see Gibraltar every day when I lived in Estepona Spain.

I hope your neuron has not gone to Gib for holiday cos the border queues were horrendous so you might not get it back for a while!
cicciocb
Site Admin
Posts: 401
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 90 times
Been thanked: 289 times
Contact:

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Post by cicciocb »

The map should be calibrated.

Are you able to superpose some kind of latitude reference on the map ?

Taking into account the latitude reference, a calibration map could be created with linear interpolation or with a polynomial one
cicciocb
Site Admin
Posts: 401
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 90 times
Been thanked: 289 times
Contact:

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Post by cicciocb »

This should be the latitude grid.
As you can see it is not linear
map2.jpg
Using GIMP I extracted all the Y pixel position for each latitude :

Code: [Local Link Removed for Guests]

Degrees	|	Y (pixel)
90		|		0
75		|		68
60		|		122
45		|		155
30		|		181
15		|		202
0		|		223
-15		|		243
-30		|		265
-45		|		290
-60		|		319
You do not have the required permissions to view the files attached to this post.
User avatar
Fernando Perez
Posts: 118
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 62 times
Been thanked: 67 times

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Post by Fernando Perez »

If I apply:

Code: [Local Link Removed for Guests]

   y = cInt (convert.map (lat, -60, 90, 319, 0))
I get this:
image.png
Tonight I will have time to try to get the correlation.
Thanks, as always.
(We're not leaving Andy anything to do 8-) )
You do not have the required permissions to view the files attached to this post.
cicciocb
Site Admin
Posts: 401
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 90 times
Been thanked: 289 times
Contact:

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Post by cicciocb »

I used an online service to determine the polynomial conversion parameters. [External Link Removed for Guests]
The conversion should be :

Code: [Local Link Removed for Guests]


Y = 2.78e-10 * lat^6 -2.5483e-8 * lat^5 -2.116389e-6 * lat^4 +2.5858636e-5 * lat^3 +3.483879e-3 * lat^2 -1.417675 * lat + 221.9496

Seems complicate but it works; the error max is less than 2 pixels.
Simply copy and paste this line into Annex and that's all.

Code: [Local Link Removed for Guests]

lat	|	  y	|	   ypoly6
===============================
-60	|	319	|	319.3412732
-45	|	290	|	288.778745
-30	|	265	|	266.0250102
-15	|	243	|	243.8266594
0	|	223	|	221.949551
15	|	202	|	201.4322453
30	|	181	|	181.1223806
45	|	155	|	156.4959924
60	|	122	|	120.7597748
75	|	68	|	68.23628393
90	|	0	|	0.032084131

Post Reply