Librem 5 GPS/Location Tracking

Yes, it is.

Or in the fact 10 dBHz difference is 10 times higher power of the signal which means that actual measured Voltage is about 3 times higher (sqrt 10).

Can you confirm that you observe reasonable performance?

I have gone through manual again, may it be I have remembered threshold 20 from some discussion. I have found that manual states

GNSS positioning CN0 (signal to noise ratio) Threshold from 9 till 40 default 15 dB

But may it be, I have spotted somewhere else that four satellites at more than 20 are required to start algorithm…

There are more commands which can tune parameters $PSTMSETTHTRK (minimal angle and CN0 for tracking), $PSTMSETTHPOS (minimal angle and CN0 for positioning), $PSTMCFGGNSS (complete configuration), $PSTMCFGTHGNSS combined set of the thresholds only.

So it is chance that by tuning these values we can reach fix earlier. But on the other hand position fluctuation was about 20 to 50 meters when I have reached the fix (after paying and long time during walk around and on the top of the hill there) and recorded and processed NMEA message later. So I think that S/N ratio is under level for solid position computation on my Librem 5 piece so lowering the thresholds does not help too much.

I have not found some Teseo-LIV3 specific values but random papers speaks about 40 to 50 dB max for the satellite in zenith. Marek reports list with maximum at 42 from Xiaomi Mi8 phone under the roof of his home. But he expect that roof is light, so it would not be much better outdoor and he report that this phone has extraordinary good GPS block.

So it is question what is the expected range and performance on Librem 5 and what can be tuned etc… But at least, it is necessary to get some clue what is typical what can be easily solved etc…

1 Like

Marek send more clarification, I try to translate his description of the noise.

We can consider for 20 dBHz carrier to noise ratio that for signal sampling at 2*100Hz of the correlation process output there is not any correlation peak observable above the noise (signal to noise ratio is 100 times lower at 100 Hz so noise level is same as signal). For GPS where 10 Hz sampling and output is usually/probably expected, the value of 20 dBHz means that there is already detectable correlation peak but it is weak and does not allow good fix. So his interpretation of the theory matches observation and default Teseo-LIV3 threshold 15 dBHz for satellite masking out.

3 Likes

GNSS isn’t a major priority for me, so I have done only limited testing, but the few times I have rushed outside running a grep on /dev/gnss0 I have got reasonable results (a sample of SNR values is given above) and I have got a (correct) location fix fairly quickly.

I have no idea what factors other than the phone itself determine success (assuming that the phone is outside and with an uninterrupted skyview) e.g. latitude, altitude, weather conditions, space weather conditions??

(One of the main reasons why I want GNSS is so that my photos get geotagged correctly - and that needs a fair bit more work on the camera software to be able to get decent photos at all i.e. the geotagging will be the cherry on top.)

Thanks for information. It seems that in your case is sensitivity at better and probably sufficient level. This is positive information which means that there is variance between Librem 5 Evergreen pieces and small tuning, cleaning of screw, adjusting of grounding, abrade of frame location used for grounding contact etc can enhance situation significantly.

Marek reports that professional equipment (Septentrio PolaRx5) does start given satellite tracking when signal level is at least 20 dBHz and use it for positioning when value is above 33 dBHz. He thinks that maximum is about 56 dBHz. But that is with equipment where only antenna cost more than 8 k EUR and is impractical for handy phone.

By the way he knows more people designing professional GNSS equipment in person and at our university more such systems (Witch GPS even open) has been designed. The first one by Petr Panek around 1985 when GPS encoding has not been documented/known by public.

As for the signal strength factors, all you list are significant. I live at latitude 50 deg N. But it is in full reach of GPS satellites which go in zenith there. It is true till 60 degs, then the problems can appear.

6 Likes

Thanks. Yesterday I was finally able to get a fix again. I manually sent the command to clear time/almanac etc, then once outside with gpsd running for ~20minutes I got a fix. The fix is easily lost but at least it means the gps module is still working. I’m not sure if mine has a grounding issue or not

2 Likes

Weak antenna sensitivity corrected a little. I have sent request to the support week ago and received confirmation that it would be routed further. But there is no reply to technical and warranty after self repair questions. So I have decided to carefully disassembled the Librem 5 according to the instructions. My company colleague had done me assistance to not overlook something and help to hold some parts etc… We have got to the state when main board was bend out on the cables. This allowed us to have problematic ground contact to metal phone frame accessible. The main board top edge was outside of the phone frame. The metal spring lamella/plate/contact is quite complex bend piece of metal. I have pulled its tip out of the PCB edge and make it longer. When device is assembled I have carefully guided the tip to go into the cutout of the frame. The contact can be seen on the already referenced picture

I seem to be lucky that all other has been assembled and functions as before (camera, buttons etc…). The anthenna sensitivity has increased a little, I estimate that carrier to noise ratio enhanced by 5 dB or little more for the similar conditions as in the previous test. I have seen values above 30 dB sometimes and I can get fix on the street. It takes quite long before required four satellites are accepted into solution list but visible list is much longer and appears sooner. There are problems with restart after fix is lost etc… But generally, receiver can be used for software testing. I have compared track recorded by next command

socat unix-client:/var/run/gnss-share.sock - >track.nmea
gpsbabel -i nmea -f track.nmea -o gpx -F track.gpx

with same walk record form Garmin GPS Map 60CSx GPS and the sensitivity, accuracy is still much worse. But GPS Map has large antenna. When phone is in the pocket then body shields signal and fix is lost. So it is step forward and as prototype to test software it works. But report from Purism with the signal to noise values they have achieved on different batches would be really useful and they should provide documentation for the antenna design and PCB to make tuning possible. We have been short of time so not investigated antenna realization much. Signal is probably connected really through screw to something conductive on the frame under a display. But construction has not been clear to us from the short glimpse under main board…

7 Likes

Geoclue 2 setup and GPXsee

I have found possible problem in the geoclue.conf config. At least on my Librem 5 there has been referenced socket with path /var/run/gnss_share.sock which matched gnss_share Python prototype. But I have GO version after update which creates socket at path /var/run/gnss-share.sock. The application allowed to access location should be listed in the config as well. Because I want to test GPXSee which reports as the gpxsee when attaching to Geoclue D-Bus I need to add it the whitelist.

To make Geoclue 2 work, check that correct source is setup in /etc/geoclue/geoclue.conf.

Se section

[network-nmea]
enable=true
nmea-socket=/var/run/gnss-share.sock

Ensure that socket name matches unix socket path created
by gnss-share and that [agent] section whitelist includes gpxsee
and gpxsee section is provided

[gpxsee]
allowed=true
system=false
users=

There was a problem with Qt5 positioning source setup in the GPXSee. The preferred method default to all sources which would lead to selection of rough data on city level to be selected on Geoclue 2 side for the given client. The location hops between our city district centers. When the code has been fixed to prefer satellite obtained position then the application started to work.

QGeoPositionInfoSource has to be configured by setPreferredPositioningMethods for QGeoPositionInfoSource::SatellitePositioningMethods to get actual GPS position. See issue

GPXSee fix for Geoclue source

The fix is available in my zoom-by-pinch branch. See https://github.com/ppisa/GPXSee/commit/f7e0282fda93be5ff64147f4a5a571df1b3a208b and has been accepted into mainline but zoom by pinch seems not to be accepted soon.

The standard Gnome Maps application available from Pure OS works after the fixes as well but it has disadvantage that requires online data access. May it be, somebody can experiment with the local OpenStreetMap tile server? But I expect that it would be memory, power and storage hungry. Some OBF format based vector offline map application like OsmAnd would be great in future… Even better implementation of OBF rendering into Gome Maps…

5 Likes

You can try PureMaps (https://www.flathub.org/apps/details/io.github.rinigus.PureMaps) with OSM Scout Server (https://www.flathub.org/apps/details/io.github.rinigus.OSMScoutServer) for local map data.

2 Likes

Ping @rinigus - if there is something to ask from PureMaps dev, since this seems to be going technical…

Ping with the question :slight_smile:

3 Likes

I had a long mail conversation (since Nov 2021) with purism about my gnss-module having near to no reception. the people at purism have no clue and are quite helpless. they mix layers, can’t do proper testing, have problems determining the right conclusions from facts and on. it seems they haven’t even a low level test suite to check the hardware. it’s tiring. finally they said they have no “other suggestions”. the suggestion was to change a geoglue config which i neither have nor relate to the problem. i have a L5 for sale…

1 Like

Dear M., the reception of the signal from large distance is a problem. You probably know, energy of signal spreads, intensity decreases with square of distance. It is miracle that any mobile phone can have fix. If you see classical older GPS receivers, they have large antennas protruding from the body out etc…

Yes it is shown on other phones that today technology is able to squeeze the functionality into so insufficient space and together with other sources (in comparison massive) of all kinds of frequency interference etc…

So yes, if you need Librem 5 as reliable positioning tool then it is not at that state now and question is if it will be. I have asked technical support to provide carrier to noise rations observed on different pieces and batches. That information has not been provided yet.

But I have got some promising response with some screenshots with PCB components which can be replaced, tuned etc. I have not time for this this month, I have to deliver measurements on other project to European Space Agency. But if there is will to cooperate, my colleague at ESA can help. He works on GNSS, Galileo and its future replacements and he is willing to look at Librem 5 as onto interesting species to test and hack and he has equipment for his two way satellite time synchronization system development personally. May it be, he can use even ESA equipment for community/public experiments.

But be aware that Marek Peca is short of time as well, so no timing provided. Among many of his projects, he is now waiting to be granted up-link connection time on VZLUSAT2 satellite to test his Xilinx Zynq FPGA based design to capture pictures from cameras which he delivered. It is today, when the first beacon signal (after release form Falcon 9 and then launcher platform has been received) https://dashboard.satnogs.org/d/L8ywE9oMz/vzlusat-2?orgId=1 . So he waits for his while for satellite hacking. But he expressed interest to look at Librem 5. We have or can find people with equipment. For sure as an enthusiast project. We have to pay for real one, I pay lab to do measurement for me 4 k EUR for three/four days… So yes, we can find even professional commercial help, but price would be unacceptable for Purism and their product price.

But if there are more enthusiasts on the forum we can try to join forces and really open phone and HW can attract more people in this GNSS and RF area.

7 Likes

Months ago (see posting #55 in this thread), Purism sent me a tool gnss_test.py which worked. When I now start this it gives only an error:

sudo ./gnss_test.py
Traceback (most recent call last):
  File "/home/purism/guru/gnss_test.py", line 284, in <module>
    gnsst = GnssThread(gsIP, gsPort)                          
  File "/home/purism/guru/gnss_test.py", line 129, in __init__
    self.gnss.connect('/var/run/gnss_share.sock')             
FileNotFoundError: [Errno 2] No such file or directory

What does this mean? I haven’t changed to tool, something must have changed in my L5… Is there now some service missing for GNSS?

Maybe, I did not test, you have to use /var/run/gnss-share.sock (so, not an underscore, but a minus sign).

Also called “a dash” or “a hyphen” in American English. :slight_smile: (In case anyone wants to know.)

1 Like

To get a better understanding if, or if not, my GNSS chip has a FIX and when, I came up with the small shell script below. You run it for a while (~30 minutes) and grep the log for the FIX, i.e.

sudo ./readGNSS.sh > gnss.log
grep GLL gnss.log | grep ,A, | more

and you see when the chip got the FIX, if any. See the comments in the script why grepping for ,A,:

#!/bin/sh
#
# run as: sudo ./readGNSS.sh
#
# reads the device /dev/gnss0 and grep for GSV, GGA and GLL lines which
# contain, together with the time in [...] brackets (real location data
# is overwritten with nnnn):
#
# [07:52:04]: $GLGSV,3,2,09,65,35,309,,88,23,291,,75,18,182,,81,13,343,*66
#                                    ^^         ^^
# [07:52:04]: $GPGLL,nnnn.06996,N,nnnnn.48512,E,065204.000,V,N*44
#                                                         ^^
# [07:52:05]: $GPGGA,065205.000,nnnn.06996,N,nnnnn.48512,E,0,00,99.0,610.39,M,0.0,M,,*64
#
# explanation for the ^^ market values:
#                                                         ^^
# in $GLGSV line the ^^ market values should contain a 2-digit signal/noise ratio
# between 00...99 which must be more than 20 for to be taken by the GNSS chip as
# satellite for an FIX
#
# in $GPGGA lines the digit after the letter 'E' (note 'E' for east or 'W' for west)
# means 0 = FIX not available or invalid, 1 = GPS, SPS Mode, FIX valid 
#
# in $GPGLL lines the letter 'V' means invalid and 'A' valid location data
#
# see also: https://www.st.com/resource/en/user_manual/um2229-teseoliv3-gnss-module--software-manual-stmicroelectronics.pdf chapter 11.4.1, ...

while read line; do 
    echo -n "[$(date '+%T')]: "; 
    echo $line ; 
    done < /dev/gnss0  |

egrep -a 'GSV|GGA|GLL'

HIH

1 Like

I run the script readGNSS.sh for nearly an hour, from 09:47 to 10:41, and the chip got a FIX (not only once) and sometimes it lost it again, see the transitions below from “E,0” (0 = FIX not available or invalid) to “E,1” (1 = GPS, SPS Mode, FIX valid). Why is this so unstable? Well, today it’s cloudy and rainy.

$ grep GGA log | grep ,E,0 | wc -l
1727
$ grep GGA log | grep ,E,1 | wc -l
1522
$ grep GGA log  | wc -l
3249

i.e. more than half of the $GPGGA lines do not have a valid fix. Here are some of such transitions form 0 to 1 or back to 0:

grep GGA log
[09:47:36]: $GPGGA,145532.200,nnnn.15848,N,nnnnn.36669,E,0,00,99.0,599.04,M,0.0,M,,*6D
[09:47:36]: $GPGGA,145533.000,nnnn.15848,N,nnnnn.36669,E,0,00,99.0,599.04,M,0.0,M,,*6E
[09:47:37]: $GPGGA,145534.000,nnnn.15848,N,nnnnn.36669,E,0,00,99.0,599.04,M,0.0,M,,*69
[09:47:38]: $GPGGA,145535.000,nnnn.15848,N,nnnnn.36669,E,0,00,99.0,599.04,M,0.0,M,,*68
...
[10:00:19]: $GPGGA,090019.000,nnnn.15199,N,nnnnn.33670,E,1,04,7.0,571.23,M,47.5,M,,*65
[10:00:20]: $GPGGA,090020.000,nnnn.15163,N,nnnnn.33655,E,1,04,7.0,571.51,M,47.5,M,,*68
[10:00:21]: $GPGGA,090021.000,nnnn.15166,N,nnnnn.33599,E,1,04,7.0,571.04,M,47.5,M,,*6F
...
[10:04:08]: $GPGGA,090408.000,nnnn.15247,N,nnnnn.30094,E,0,02,99.0,559.72,M,47.5,M,,*50
[10:04:09]: $GPGGA,090409.000,nnnn.15247,N,nnnnn.30094,E,0,02,99.0,559.72,M,47.5,M,,*51
[10:04:10]: $GPGGA,090410.000,nnnn.15247,N,nnnnn.30094,E,0,02,99.0,559.72,M,47.5,M,,*59
[10:04:11]: $GPGGA,090411.000,nnnn.15247,N,nnnnn.30094,E,0,03,99.0,559.72,M,47.5,M,,*59
[10:04:12]: $GPGGA,090412.000,nnnn.15193,N,nnnnn.28809,E,1,03,99.0,559.66,M,47.5,M,,*51
[10:04:13]: $GPGGA,090413.000,nnnn.15203,N,nnnnn.28699,E,1,03,99.0,559.66,M,47.5,M,,*5D
[10:04:14]: $GPGGA,090414.000,nnnn.15218,N,nnnnn.28645,E,1,04,5.5,559.60,M,47.5,M,,*60
[10:04:15]: $GPGGA,090415.000,nnnn.15228,N,nnnnn.28581,E,1,04,5.5,559.60,M,47.5,M,,*69
[10:04:16]: $GPGGA,090416.000,nnnn.15231,N,nnnnn.28519,E,1,04,5.5,559.60,M,47.5,M,,*63
[10:04:17]: $GPGGA,090417.000,nnnn.15228,N,nnnnn.28473,E,1,04,5.5,559.60,M,47.5,M,,*67
...

The two L5 I own, both get a FIX with the script readGNSS.sh and with the tool which was published in Librem 5 GPS/Location Tracking

Which real consumer, i.e. which maps app, could use the location now?

The Gnome maps need permanent data connection, at least for now. Or there is option to run a tile server on Librem 5. It should work, I would be happy to hear experience.

I have done experiment with use GPXsee for offline maps where I have quite lot Garmin format images compiled from OSM. My fix to prefer satellite position over GSM and IP address base guess has propagated into mainline. Zoom by pinch not. You can use zoom-by-pinch branch from my fork https://github.com/ppisa/GPXSee/tree/zoom-by-pinch . If there interest I prepare Pure OS ARM64 binary DEB package. The application is desktop one but for basic location and looking into map works pretty well on Librem 5 screen.

6 Likes

On my Ubuntu mobile I run a small Python webserver which offers the tiles as OSM does from the SD card where I have them for 5-6 towns/places I’m going to frequently. Can the URL in Google maps configured somehow?