I have tried the sample code of PocketSDR that Professor Tomoji Takasu of Tokyo University of Marine Science and Technology published on GitHub.
The material on this GitHub is about software defined radio (SDR) for receiving GNSS (Global Navigation Satellite System) signals, and consists of hardware design materials for receiving radiowaves and software for signal processing.
For receiving actual GPS signals, hardware is necessary. However, the data recorded by this hardware is attached as a sample, so if we can execute the positioning codes as described in the material, and we can try the signal acquisition not only on Windows but also on macOS.
I have confirmed that the code is successfully work with two Mac minis with an Intel CPU (macOS Big Sur, version 11.6.1) and a Mac mini with an Apple Silicon M1 CPU (macOS Monterey, version 12.0.1). I used python interpreter of a package manager Homebrew.
It is assumed that Homebrew settings are complete.
Since the Python that comes with macOS is as old as version 2.7, we will use Python from Homebrew, which is a version 3 series.
$ brew upgrade $ pip3 install numpy scipy matplotlib $ git clone https://github.com/tomojitakasu/PocketSDR pocketsdr
Capturing the new signal L1 C/B sent from the QZSS (Michibiki) 1 Replacement
The successor to QZSS-1 was successfully launched at 11:19:37 on October 26, 2021. Here, we try to capture the L1 C/B signal broadcast from the satellite. Modify the path of the execution example of the signal capture program
pocket_acq.py from a backslash in Windows to a slash, and explicitly specify Python for Homebrew.
$ cd pocketsdr/python $ python3 pocket_acq.py ../sample/L1_20211201_054600_24MHz_I.bin -f 24 -fi 6 -sig L1CB -prn 203 -p
I am thrilled to be able to display the correlation plot of the L1 C/B signal, which cannot be received by commercial receivers yet. The terminal shows the time taken to capture the signal
TIME = 495.3 ms. The upper row plots the correlation for timing for the pseudo random noise (PRN) number 203 specified here, and the lower row plots the correlation for the code offset based on that time timing. The graph also shows the captured timing, Doppler frequency, and the value C/N0 that is the value proportional to the signal strength. In the lower graph, there are two sub-peaks in addition to one main peak. This is a feature of BOC (binary offset code) correlation plots such as L1 C/B.
pocket_acq.py takes a data file as an argument, and it has following options:
- name of signal,
- PRN number,
- signal search integration time in units of cycles,
- time offset in milliseconds,
- sampling frequency in megahertz,
- intermediate frequency in megahertz,
-fi will specify the values at the time of data recording.
For the PRN number, we can specify multiple PRN numbers with a comma sign and a PRN number range with a minus sign. Specifying multiple PRN numbers results in a C/N0 plot for the PRN numbers.
Also, a display option of
-p adds a correlation plot, and one of
-3d makes a 3D plot. These explanations were in the source code of
An example of plot of this L1 C/B signal in 3D is:
$ python3 pocket_acq.py ../sample/L1_20211201_054600_24MHz_I.bin -f 24 -fi 6 -sig L1CB -prn 203 -3d
Signal acquisition in GNSS is to find the correlation peak by performing a two-dimensional search between the Doppler frequency direction and the code offset time direction.
Acquisition of other satellite signals
By changing the PRN number with
-prn option and the signal type with
-sig option, it is possible to capture other satellites. For example, I tried to capture the conventional signal L1 C/A of QZSS 1, which is not the successor.
python3 pocket_acq.py ../sample/L1_20211201_054600_24MHz_I.bin -f 24 -fi 6 -sig L1CA -prn 193 -p
According to the smartphone app GNSS View, PRN numbers of L1 C/A signal visibility in Tokyo at time 2021-12-01 05:46 UTC are 10, 12, 15, 23, 24, 25, 193, 194, and 199 with the mask angle of 20 degrees. Therefore, we plot the signal strength of these satellites.
python3 pocket_acq.py ../sample/L1_20211201_054600_24MHz_I.bin -f 24 -fi 6 -sig L1CA -prn 10,12,15,23,24,25,193,194,199
Reading this code will be very educational. PocketSDR is also used as a teaching material for human resources development to accelerate satellite positioning technology that has entered a new phase for university students. Young people have a lot of opportunities.