# LLG accuracy on real data

A project log for Light level geolocator

If you have a lot of time, you can decide your position on Earth just using watches and eyes. Or RTC and LDR.

I finally made the reverse sunrise equation to work. As usual, it wasn't that hard, but it took another one great input from @Ted Yapo  to get there. The equation

can be expressed as

alternatively as

with substitution of

from now it's just matter of applying some standard high-school math to solve the equation for L into form that can be easily calculated on MCU. That is for calculating latitude.

I thought calculating longitude is trivial, but as usual it's not quite like that. When oversimplifying reality, it's just counting how many hours of difference is between local noon and noon at Greenwich; being roughly at 12:00 UTC and multiply this number by 15 degrees for every hour. The key word here is the 'roughly' word. Trying to synchronize clock to sun over the length of year is a bit more complicated, because simple looking movement of Earth versus the Sun is somehow more complicated by axial tilt and its eccentricity, bringing error of a few minutes into the sync. This doesn't look like too much, but it can mean a few hundred of kilometers error for longitude calculation. So, I have to take this effect, named equation of time into account. Fortunately, it can be calculated as sum of two sine functions with different periods as

where is d is day of year, starting at 1 at first of January. This difference should be subtracted from measured local solar noon and then scaled to 15 degrees per hour. This is quite good approximation for my needs, so I decided to move on.

I did some more work on LLG hardware, got myself to implement proper segment mapping table, so I'm finally able to display some meaningful messages.

Above that, I reorganized my measured data so I can import it into my source files for LLG and adjusted the sources so that LLG calculates the geographical position from the data - is if the LLG would sit at the place and capturing data on its own. The calculations ran on real hardware, being outputted via serial link from MCU.

At first I imported daylight data from my own place, got set of latitude/longitude pairs, entered them into custom map at google maps and here is how it looks. I started with my own place, as this is where I have the most of data

The orange home icon is where the logger really was, the blue points are determined locations from LLG. I can see the latitude to be more dispersed than longitude, but otherwise half of the measurements got into 75km circle, average accuracy being around 100km.

The logger on another side of my country was somehow worse, especially in determining the longitude. I assume that's because it was placed on window of tall building, casting shadows during phases of day, shifting the results.

Interesting is what happed to measurement from Spain.

The three results are almost perfectly aligned, with differences within a few kilometers. Though all being shifted from real location - that is probably due to sunrise/sunset zenith angle being determined slightly wrong, but I didn't want to change the algorithm to fit the data, that would be cheating. The error in zenith angle didn't show in other examples, as those had much less repeatability due to suboptimal logger placement.

The difference between the last result and the previous two is that measurement in Spain took place in minimal light smog, open view to sky; unlike the previous ones, with buildings, trees and other obstacles in view. Even worse were measurement made by valuable contributor @davedarko  in Germany

Both longitudes and latitudes quite far away from original place, but consider conditions where the measurement was done:

## Discussions

zoomx wrote 01/17/2018 at 09:45 point

I read that this method is used for low power geotaggers for animals migrations

See here, maybe you will find some useful informations

Are you sure? yes | no

chris owens wrote 01/06/2018 at 22:41 point

I have thought about this project for years, since the days when GPS units were \$\$\$\$\$! Great job actually building the device! :) :)

Are you sure? yes | no

davedarko wrote 01/06/2018 at 22:22 point

You didn't say I wasn't allowed to take it on the yacht :D well we had some rough dark days, if I recall correctly. I'm impressed that it is that "close"!

Are you sure? yes | no

jaromir.sukuba wrote 01/06/2018 at 22:42 point

Measurement from your balcony is absolutely perfect and very valuable.

I can try to find correlation of LLG outputs versus weather history available for example here http://www.weatheronline.co.uk/weather/maps/city?LANG=en&WMO=11816&ART=SON&CONT=euro&R=0&LEVEL=150®ION=0001&LAND=SK&NOREGION=0&MOD=&TMX=&TMN=&SON=&PRE=&MONAT=&OFFS=&SORT=&MM=12&YY=2017&WEEK=2

Are you sure? yes | no

Ted Yapo wrote 01/06/2018 at 22:03 point

"The Equation of Time" sounds like science fiction.  Awesome.

Are you sure? yes | no