Skip to content

ryansuchocki/panpi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PanPI

'Raspberry Pi' based panadapter.

screenshot

About

PanPI is primarily an application which renders a realtime 'spectrogram' and 'waterfall' display based on an I/Q sample stream. While it is fully portable software, PanPI has been developed and tested on a Raspberry Pi (model 4B).

PanPI is designed to perform a specific job very well, with minimal bells, whistles and other distractions.

Background

I started this project after finding myself in need of a self-contained panadapter unit for my Elecraft KX3 transceiver and being told (by Elecraft's UK distributor) that the companion 'PX3 Panadapter' is no longer available. Sadly: PX3s on the second-hand market seem to be rare to non-existent.

I was pleased to find that some high quality pressed steel enclosures are available to fit the Raspberry Pi along with an inexpensive TFT display. I found that running established desktop SDR software such as 'Gqrx' on a small screen is just about feasible however performance is severely compromised and screen space is wasted. I also found a few existing software projects intended to render a straight-forward panadapter display however the software on offer was either poorly designed, unmaintained or had unnecessary and/or obsolete dependencies.

Design

PanPI is written in C and is designed to use a small fraction of the power/resources available on the Raspberry Pi 4. This leaves open the possibility of porting to a much lower power platform in the future.

Although it is possible to run PanPI in a desktop window for off-target development, it is intended to run "full screen" on a dedicated display. The software design takes advantage of this fact to minimise the amount of rendering work needed.

In particular: the FFT size (i.e. number of frequency bins) is chosen to be close to the horizontal width of the spectrogram/waterfall displays. This maximises the fidelity of the image while avoiding the need for a graphical "stretching" (interpolating) or curve-drawing stage. Simple integer-based routines are used to produce the curves/lines of the spectrogram graphic and fast recursive filtering is used to 'tweak' the characteristics of the display for maximum usefulness.

PanPI is designed to have minimal external dependencies and make as few assumptions about the platform as possible. It does currently depend on the source data taking the form of baseband I/Q samples delivered by a 'sound card', however the software has been written with future extensions (such as an RTL-SDR source option) in mind.

Platform

The platform on which PanPI has been developed and tested is as follows: (Note that the software is portable and is in no way restricted to the following)

Hardware

Operating System

  • Arch Linux ARM (Using the 'ARMv7' version)
  • The following packages are needed to build and run the software. The package versions used for development are recorded here but should not be taken as requirements:
    • git 2.37.1-1
    • make 4.3-3.1
    • gcc 12.1.0-2.1
    • fftw 3.3.10-3
    • libx11 1.8.1-3
    • alsa-lib 1.2.8-1

photo

Display config

The core drivers for my particular TFT screen were already built-in to the kernel, but a "device tree overlay" file is needed to tell Linux how it is connected.

The documentation for the display directed me to the LCD-Show repository. The top-level 'install' scripts provided in that repository are very fragile, dependent on one particular operating system and assume that the user wants to install a full desktop manager along with the display driver. Fortunately, after a little digging, the necessary 'device tree overlay' file can be extracted easily.

I ran the following commands on the Pi in order to download the file and copy it into place:

  1. $ curl -LO "https://github.com/goodtft/LCD-show/raw/master/usr/tft35a-overlay.dtb"
  2. $ sudo cp tft35a-overlay.dtb /boot/overlays/tft35a.dtbo

The following lines were added to my /boot/config.txt file:

dtparam=spi=on

dtoverlay=tft35a:rotate=270,speed=160000000,fps=60

I gave the alarm user permission to access the 'framebuffer' device by running:

$ sudo usermod -aG video alarm

After rebooting, I was able to verify that the display driver was loaded by displaying random data to the screen using:

$ sudo cat /dev/urandom > /dev/fb0

Building and Running

  1. $ git clone https://github.com/ryansuchocki/panpi.git --recurse-submodules
  2. $ cd panpi
  3. $ make
  4. $ cp panpi.cfg.template panpi.cfg
  5. Customise panpi.cfg (see below)
  6. $ ./panpi

Configuration

PanPI is configured via the panpi.cfg file. This file follows a simple format whereby each valid line takes the form key: value. Lines not matching this format, or correctly formed lines with unrecognised keys, are simply ignored.

After initial loading: PanPI "watches" the file for changes and, where possible, applies changes straight away to match the new configuration. This provides a rudimentary form of runtime control, but this is liable to change in the future.

See comments within the file itself for details of the available configuration items.

Roadmap

  • MVP (Minimal Viable Product)
    • Hardware/OS selection for development
    • Capturing input samples using ALSA
    • Calculating FFT using fftw
    • Rendering a realtime 'spectrogram' display
    • Rendering a scrolling 'waterfall' display
    • Rendering to a cheap TFT screen using fbdev
  • Goals for 'V1'
    • Rendering to a desktop window (using X11) for off-target development
    • Handling different screen sizes
    • Runtime controls
    • Zoom/span controls
    • Useful documentation
  • Possible future extensions
    • Porting to a lower power microcontroller platform
    • Alternative input sources (rtl-sdr?)
    • Per-band IQ balance calibration
    • Per-mode passband markers
    • Per-band scaling memory
    • Pre-amp compensation
    • Spectrogram peak hold

License

MIT License

Copyright (c) 2022 Ryan Suchocki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

Pan-adapter for the Raspberry Pi

Resources

License

Stars

Watchers

Forks

Packages

No packages published