Awesome Pocket SDR (realtime positioning function)
Introduction
Pocket SDR, published on GitHub by Professor Tomoji Takasu of Tokyo University of Marine Science and Technology, is an open source software radio that receives and processes radio waves from positioning satellites (GNSS: global navigation satellite system). Since its release on GitHub in October 2021, Pocket SDR has been continuously updated, with version 0.13 released in July 2024.
I have been using Pocket SDR version 0.8 with Python installed on my macOS PC. Previous versions focused on processing the recorded radio signals, and I found it very useful for repeatedly testing conditions that could not be predicted in advance.
I knew that the version upgrade had maintained the previous functions while porting the source code from Python to C language, tuning for real-time processing and speed, and improving documentation. In particular, this version 0.13 officially supports not only Windows PC and Linux PC, but also macOS PC and Raspberry Pi, making real-time positioning easier. In addition, hardware design documents and firmware source code for the 4-channel version that can record signals with a wider frequency range have also been released. It can be said that Pocket SDR is the strongest SDR that covers all GNSS civil signals.
Here, I will try out real-time positioning with version 0.13 using both Pocket SDR hardware: the 2-channel version I already own, and the 4-channel version sold by DATAGNSS.
Compiling and Configuring the Pocket SDR Software
Here, we used a macOS (Macbook Air, Apple Silicon M2) officially supported in version 0.13 and a Raspberry Pi 5 (8GB, SC1112) as the PC.
First, we set up the Pocket SDR software on macOS. The results of running uname -a
and neofetch
on this Macbook Air are as follows.
sat@mba:~$ uname -a
Darwin mba.tkhs 23.6.0 Darwin Kernel Version 23.6.0: Wed Jul 31 20:53:05 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_T8112 arm64 arm Darwin
If you follow the instructions on the Pocket SDR GitHub page for How to install, the compiled binary files will be stored in the bin
directory. Pocket SDR does not create any files outside the source tree, so you can safely run make install
.
Next, we will configure it to efficiently execute the FFT (fast Fourier transform) used for GNSS signal tracking. Run fftw_wisdom
in the bin
directory and move the created file to the python
directory. The Pocket SDR software references fftw_wisdom.txt
in the python
directory.
cd bin
./fftw_wisdom
mv fftw_wisdom.txt ../python/
I was able to compile the software on a Raspberry Pi using the exact same steps. While fftw_wisdom
took about a second to run on macOS, it took nearly five minutes to complete on my Raspberry Pi 5.
sat@rpi5a:~/works/pocketsdr1/bin$ time ./fftw_wisdom
FFTW wisdom generated as ./fftw_wisdom.txt (N=48000).
TIME(s) = 247.420
real 4m7.421s
user 4m7.403s
sys 0m0.004s
sat@rpi5a:~/works/pocketsdr1/bin$
Now we are ready to go.
Realtime positioning with Pocket SDR and Mac
Realtime positioning with GPS and QZSS
Connect the Pocket SDR hardware 2-channel version to macOS, connect an antenna to the Pocket SDR hardware, and perform realtime positioning.
Previously, it was necessary to set the conditions used for radiowave recording in pocket_trk
. In version 0.13, the radiowave recording function has been integrated into pocket_trk
, and the calculation conditions are automatically set from the given configuration file. In addition, it is now possible to analyze multiple GNSS signals simultaneously by listing the signal names and PRN (pseudo random noise) numbers, which is very convenient.
First, perform real-time positioning of GPS and Michibiki L1C/A signals. In the terminal, go to the Pocket SDR bin
directory and run ./pocket_trk -sig L1CA -prn 1-32,194-199
.
This argument means that the PRNs of the L1C/A signal, 1 to 32 (GPS01 to GPS32), 194 (QZS-2), 195 (QZS-4), 196 (QZS-1R), and 199 (QZS-3) will be received. Because this is an all-in-view method (a reception method in which correlators for all candidate satellites are prepared in advance) used in high-end GNSS receivers, the coordinates were displayed in about 36 seconds after reception began!
I usually keep my terminal in dark mode, but here I’m using light mode. In iTerm, you can temporarily change to light mode by clicking two fingers on the terminal screen → Edit Session...
→ Colors
→ Color Presets...
→ Light Background
.
When using Pocket SDR hardware on Linux or Raspberry Pi, you need administrative privileges, so you must start the command with sudo
. On the other hand, on a Mac, you do not need to add sudo
. However, when you plug the Pocket SDR into the USB port, you need to give permission to use the accessory.
Realtime positioning with Galileo
Next, try positioning using only European Galileo satellites. The execution command is ./pocket_trk -c ../conf/pocket_L1L5_24MHz.conf -sig E1B -prn 1-36
.
In Japan, due to the limited number of Galileo satellites available compared to GPS, it takes about 90 seconds to estimate coordinates using Galileo alone.
Receiving messages from QZSS CLAS, QZSS MADOCA-PPP, and Galileo HAS
Next, we will try receiving the QZSS and Galileo high-precision positioning augmentation signals. Here, I used the two-channel Pocket SDR, so I set channel 1 to the L1 frequency band and channel 2 to the L6 frequency band. I have prepared two terminal screens, and are running pocket_trk
on the upper screen and nc
on the lower screen. The arguments set for pocket_trk
have the following meanings:
- -c ../conf/pocket_L1L6_16MHz.conf (which configures a sample rate of 16 MHz in the L1 and L6 frequency bands)
- -sig L1CA -prn 1-32,194-199 (receives GPS01 to 32 of L1C/A signals, Michibiki 1, 2, 3, 1R)
- -sig E1B -prn 1-36 (receives Galileo E1B signals E01 to E36)
- -sig L6D -prn 194-199 (receives L6D signals broadcasting QZSS CLAS)
- -sig L6E -prn 204-209 (receives L6E signals broadcasting QZSS MADOCA-PPP)
- -sig E6B -prn 1-36 (receives E6B signals broadcasting Galileo HAS)
- -rtcm :2000 (Pocket SDR logs will be output to TCP port 2000. If you specify a file name, the logs will be output to that file)
The screen below shows the Pocket SDR log contents on nc localhost 2000
.
The Pocket SDR log screen included GPS, Galileo, and QZSS navigation messages, as well as CLAS, MADOCA-PPP, and HAS messages, estimated coordinates, and time. The Pocket SDR’s great thing is that it can simultaneously receive CLAS, MADOCA-PPP, and HAS. It’s also great that it can receive CLAS and MADOCA-PPP without receiving L1 C/A signals.
Currently, Pocket SDR does not use this augmentation information, but by using it in conjunction with CLASLIB and MADOCALIB published by the Cabinet Office, Government of Japan and MALIB published by JAXA, high-precision positioning is possible.
In my environment, the -log
option outputs NMEA log, the -nmea
option outputs RTCM message, and the -rtcm
option outputs Pocket SDR log. It’s a very small error.
Contents of MADOCA-PPP and HAS messages
Next, we check the MADOCA-PPP and HAS contents received by Pocket SDR with QZS L6 Tool. In a separate window, execute ./pocket_trk -c ../conf/pocket_L1L6_16MHz.conf -sig L6E -prn 209 -sig E6B -prn 1-36 -rtcm :2000
to output the MADOCA-PPP message of QZS-3 and the HAS messages of multiple Galileo satellites to TCP port 2000. Then,
- Use
nc
and the Pocket SDR pluginpsdrread.py
of QZS L6 Tool to separate MADOCA-PPP messages and HAS messages from the Pocket SDR log, - Display the contents of MADOCA-PPP messages with
qzsl6read.py
, - Display the contents of HAS messages with
gale6read.py
.
MADOCA-PPP reception is limited to messages from QZS-3 because the current QZS L6 Tool cannot analyze multiple L6 signal inputs.
When comparing MADOCA-PPP and HAS, due to the method, HAS is more likely to output the augmentation result first. MADOCA-PPP messages are composed every 30 seconds, so it takes a maximum of 30 seconds from the start of reception to the start of decoding. On the other hand, HAS transmits mask information at any timing, so decoding can start in a short time depending on the operation of Galileo HAS.
Use of Pocket SDR 4 channel version
A 4-channel version has been added to the Pocket SDR hardware. This hardware version uses four MAX2771 radio front-end ICs and can cover all civil GNSS signals. In addition to CLAS, MADOCA-PPP, and HAS, you can also receive BeiDou PPP-B2b simultaneously for high-precision positioning augmentation signals alone!
While the receiving function has become much more powerful, the USB interface for connecting to a PC in this 4-channel version has become USB3, and the interface IC has changed from FX2LP to FX3. This FX3 has IC pins that are BGA (ball gate array), which makes manual soldering extremely difficult. At the manufacturing site of PC boards that use BGA, X-ray inspection equipment is apparently used for quality inspection.
However, I heard the news that DATASOURCE, which manufactures and sells GNSS receivers under the trade name DATAGNSS, is manufacturing and selling the 4-channel version of Professor Takasu’s Pocket SDR hardware (FE4CH: front-end 4-channel) for general sale. I ordered this on August 18, 2024, immediately after hearing the news, and have been using it with pleasure.
This product also came with pre-programmed firmware. I’m happy about that. Also, a short pin was included, but we won’t use it during normal use, just use it when we rewrite the firmware, so I’ll keep it safe. The on/off status of the short pin is reversed between the conventional 2-channel version and the 4-channel version, so long-time Pocket SDR users should be careful.
The shell script pocket_trk_ALL_test.sh
in the test
directory will take advantage of all the features of this FE4CH at the maximum 48 MHz sampling. When I ran this shell script, I was able to receive a lot of signals!
In this shell script, the settings for receiving Michibiki’s L6D and L6E signals were commented out, but I removed the comment and turned on these reception functions. With the comment out, it can receive 900 channels simultaneously, and with the comment out, it can receive 920 channels simultaneously. Great!
Realtime positioning using Pocket SDR and Raspberry Pi
I connected this Pocket SDR 4-channel version to a Raspberry Pi 5 with 8GB of memory and ran this pocket_trk_ALL_test.sh
.
sat@rpi5a:~/works/pocketsdr1/test$ sudo ./pocket_trk_ALL_test.sh
1970-01-01 00:00:00.000 0.0000000 0.0000000 0.00 0/ 0 --- BUFF: 5% SRCH: 6 LOCK: 1/900
CH RF SAT SIG PRN LOCK(s) C/N0 (dB-Hz) COFF(ms) DOP(Hz) ADR(cyc) SYNC #NAV #ERR #LOL FEC
2 1 G02 L1CA 2 5.67 40.3 |||||| 0.9658120 3111.6 17613.4 ---- 0 0 0 0
./pocket_trk_ALL_test.sh: 26 行: 4285 強制終了 ../bin/pocket_trk $L1 $G1 $E1 $B1C $I1 $L1C $L2 $G2 $L5 $E5A $B2A $I5 $L6 $E6 $B3I -c ../conf/pocket_ALL_48MHz.conf -rtcm :10015 -nmea :10016 -log :10017 $@
sat@rpi5a:~/works/pocketsdr1/test$
Forced termination…So I checked the syslog
and found that the OOM-Killer (out of memory killer), which randomly terminates processes when Linux runs out of system memory, had been triggered. It seems that all-in-view reception of GNSS civilian signals is difficult with the Raspberry Pi.
2024-10-11T22:40:01.710614+09:00 rpi5a kernel: [ 1572.999321] [ 4285] 0 4285 1673909 503962 8077312 9760 0 pocket_trk
2024-10-11T22:40:01.710615+09:00 rpi5a kernel: [ 1572.999324] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null), cpuset=/,mems_allowed=0,global_oom,task_memcg=/,task=pocket_trk,pid=4285,uid=0
2024-10-11T22:40:01.710616+09:00 rpi5a kernel: [ 1572.999768] Out of memory: Killed process 4285 (pocket_trk) total-vm:26782544kB, anon-rss:8062880kB, file-rss:512kB, shmem-rss:0kB, UID:0 pgtables:7888kB oom_score_adj:0
So I limited myself to receiving GPS, Michibiki’s L1C/A signal, and Michibiki’s sub-meter-class augmentation signal (L1S signal). This was successfully received. The command I used was ./pocket_trk -sig L1CA -prn 1-32,193-199,120-158 -sig L1S -prn 184-189 -c .../conf/pocket_ALL_48MHz.conf
. Since it is 48 MHz sampling, it is still a big burden.
Conclusion
I tried out pocket_trk
, one of the C-language applications for Pocket SDR version 0.13, on my Mac and Raspberry Pi. It’s amazing how it can receive all kinds of GNSS signals. Not only can it perform realtime GNSS positioning in an all-in-one view, but it also has extensive log output.
In addition, Pocket SDR hardware is now commercially available, making ultra-high performance receivers more accessible. I’m happy about that.
Related article(s):
- Galileo E6B signal reception with Pocket SDR, a open source software-defined radio 27th January 2023
- Failure in reflow soldering 19th January 2023
- Pocket SDR hardware production (part 3) 30th September 2022
- Pocket SDR hardware production (part 2) 14th September 2022
- Pocket SDR hardware production (part 1) 4th September 2022
- Awesome PocketSDR (order of hardware parts) 9th April 2022
- I want to use bladeRF with PocketSDR AP, part 2 16th March 2022
- I want to use bladeRF with PocketSDR AP 5th March 2022
- Awesome PocketSDR (snapshot positioning) 23rd February 2022
- Awesome PocketSDR (reducing processing time with FFTW) 19th February 2022
- Awesome PocketSDR (L6 band signal decode) 19th January 2022
- Awesome PocketSDR (pocket_trk) 28th December 2021
- Awesome PocketSDR(pocket_acq) 4th December 2021