Librem 5 GPS/Location Tracking

Possibly a reference to: Librem 5 GPS/Location Tracking

I have consulted Librem 5 design with Marek Peca, long term expert for satellite two way time synchronization and microelectronic and optronics systems designs and reserach. His modulators and receivers are used in space and CZ company Eltvor.cz/ works on new modems delivery to ESA now. Time modems use similar but more advanced TDM and correlation techniques as GNSS. He works at ESA on next satellites etc.

We have analyzed Librem 5 Evergreen schematics diagram. It is shame that components placement is not provided. But we moved forward a little anyway. There seems to be multiple alternatives how to assemble the board. Actual design and assembly clamps U20 BGA725L6 Low Noise GNSS Amplifier (LNA) input to the screw TS3 SC-M1.4. The resistor R256 and inductor L3 are shortcut. Rest of adaptation/resonator is not assembled. Location of the ANT3 ECT818000500 connector is not clean, visible or is under LNA shielding. I have not disassembled my Librem 5 yet, I wait for Purism confirmation about warranty in such case. It seems that signal is sourced from the TS3 screw which is connected to some antenna on the other board side. May be on heat spreader or somewhere??? Has somebody a photo?

Colleague considers problematic about 20 mm narrow path against the board (probably FR4 prepreg) to LNA which can cause significant signal loses. He considers as strange relatively high distance between antenna input (screw) and grounding point marked in Purism’s note. He suggest to add another connection between frame and PCB ground near to the screw path. The design of the line through screw is suspicious to me, how is controlled line impedance computed through that point? It can be source of many reflections probably.

He suggest to bring signal by coax to the LNA input. He thinks that he have some antennas to test that. I can imagine that building Librem 5 remix with external connector and bigger GNSS antenna can result in high quality positioning device. External antenna can be outside of car or boat then. Simple quarter-wave antenna for 1575.42 MHz (wavelength 0.19 m) should be around 48 mm. In the case of need and probably some funding, I can ask people who develop systems for antenna design simulations at our university or may it be some would provide input on base of their enthusiasm. In the fact Marek experiments with antennas design for satellites now.

The Librem 5 photo and components analysis by Marek Peca

BlackBerry back cover GNSS antenna

Generally I understand that design in the constrained space is demanding, but there the seems to be some problem. I have never seen S/N above 27% of full scale on my Librem 5. Mostly around 10% which is miracle that STM TESEO-LIV3F even gets fix/lock sometimes. So all available design data should be provided to help with analysis and looking for solutions.

15 Likes

Most of your post is over my head (which is fine, I don’t pretend to design any electronics for a living, let alone specifically GNSS units) but maybe you should bring it to the attention of Purism or even get Purism directly in touch with your associate.

This is a fairly confusing way of quoting signal strength if you are actually just quoting the number that comes out of the GSV message.

OK, I really do not know what is expected GSV range and my adding percentage character is misleading. The Quote from the Teseo-LIV3 GNSS Module - Software manual:

SatxCN0 Decimal, 2 digits, from 00 till 99 Carrier to Noise Ratio for satellite x in dB,

So the maximal value which can be shown (full scale) is 99. Yes it is quite possible that such value cannot be reached and or can even mean signal level which can over-saturate receiver. But the Teseo-LIV3 manual specifies that it starts to compute position and attempt to reach position fix only when it is in sync with four satellites with S/N ratio above 20, i.e. 20 dB. Use of percentage is my mistake, but I was not looking into manual at that moment and considered 20 as percentage of whole scale to 99. Yes it is logarithmic…

Important is what are usual values S/N obtained on different Librem 5 pieces and what is expected range from Teseo-LIV3 designers. And I consider my typical read values about 20 or even less even for strongest satellites outdoor as really out of nominal expected range of the GNSS module designer.

I wait for response from Purism support and I have pointed them to this discussion. In the fact I did not plan to respond there until receive a reply. But Marek has gone through analysis further and attempted to locate components etc. so I have decided to pass his observations into public knowledge pool.

6 Likes

OK, thanks for the clarification. So my peak reading of 37 is actually, as it happens, ten times better signal than your reading of 27.

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