/arduino-liquid-dsp

digital signal processing library for software-defined radios

Primary LanguageCMIT LicenseMIT

liquid-dsp

Software-Defined Radio Digital Signal Processing Library - https://liquidsdr.org

Core CI codecov MIT License Packaging status

liquid-dsp is a free and open-source digital signal processing (DSP) library designed specifically for software-defined radios on embedded platforms. The aim is to provide a lightweight DSP library that does not rely on a myriad of external dependencies or proprietary and otherwise cumbersome frameworks. All signal processing elements are designed to be flexible, scalable, and dynamic, including filters, filter design, oscillators, modems, synchronizers, complex mathematical operations, and much more.

This is an adapted version of Joseph D. Gaeddert's liquid-dsp so that it can be used as Arduino library.

// get in, manipulate data, get out
#include <liquid.h>

void setup() {
    unsigned int M  = 4;     // interpolation factor
    unsigned int m  = 12;    // filter delay [symbols]
    float        As = 60.0f; // filter stop-band attenuation [dB]

    // create interpolator from prototype
    firinterp_crcf interp = firinterp_crcf_create_kaiser(M,m,As);
    std::complex<float> x = 1.0f;   // input sample
    std::complex<float> y[M];       // interpolated output buffer

    // repeat on input sample data as needed
    {
        firinterp_crcf_execute(interp, x, y);
    }

    // destroy interpolator object
    firinterp_crcf_destroy(interp);
    return 0;
}

void loop(){}

For more information, please refer to the documentation online.

Arduino Installation

You can download the library as zip and call include Library -> zip library. Or you can git clone this project into the Arduino libraries folder e.g. with

cd  ~/Documents/Arduino/libraries
git clone pschatzmann/arduino-liquid-dsp.git

I recommend to use git because you can easily update to the latest version just by executing the git pull command in the project folder.

Examples

Nearly all signal processing elements have a corresponding example in the examples/ directory. However you need to adapt them e.g. replace the main() with setup() to use them in Arduino.

PlatformIO

Install platformio (brew install platformio on macOS, sudo -H python3 -m pip install -U platformio on Linux). Add liquid-dsp to your platform.io list of dependencies:

lib_deps = https://github.com/pschatzmann/arduino-liquid-dsp.git

Available Modules

  • agc: automatic gain control, received signal strength
  • audio: source audio encoders/decoders: cvsd, filterbanks
  • buffer: internal buffering, circular/static, ports (threaded)
  • channel: additive noise, multi-path fading, carrier phase/frequency offsets, timing phase/rate offsets
  • dotprod: inner dot products (real, complex), vector sum of squares
  • equalization: adaptive equalizers: least mean-squares, recursive least squares, semi-blind
  • fec: basic forward error correction codes including several Hamming codes, single error correction/double error detection, Golay block code, as well as several checksums and cyclic redundancy checks, interleaving, soft decoding
  • fft: fast Fourier transforms (arbitrary length), discrete sin/cos transforms
  • filter: finite/infinite impulse response, polyphase, hilbert, interpolation, decimation, filter design, resampling, symbol timing recovery
  • framing: flexible framing structures for amazingly easy packet software radio; dynamically adjust modulation and coding on the fly with single- and multi-carrier framing structures
  • math: transcendental functions not in the C standard library (gamma, besseli, etc.), polynomial operations (curve-fitting, root-finding, etc.)
  • matrix: basic math, LU/QR/Cholesky factorization, inversion, Gauss elimination, Gram-Schmidt decomposition, linear solver, sparse matrix representation
  • modem: modulate, demodulate, PSK, differential PSK, QAM, optimal QAM, as well as analog and non-linear digital modulations GMSK)
  • multichannel: filterbank channelizers, OFDM
  • nco: numerically-controlled oscillator: mixing, frequency synthesis, phase-locked loops
  • optim: (non-linear optimization) Newton-Raphson, evoluationary algorithms, gradient descent, line search
  • quantization: analog/digital converters, compression/expansion
  • random: (random number generators) uniform, exponential, gamma, Nakagami-m, Gauss, Rice-K, Weibull
  • sequence: linear feedback shift registers, complementary codes, maximal-length sequences
  • utility: useful miscellany, mostly bit manipulation (shifting, packing, and unpacking of arrays)
  • vector: generic vector operations

License

liquid projects are released under the X11/MIT license. Short version: this code is copyrighted to me (Joseph D. Gaeddert), I give you full permission to do whatever you want with it except remove my name from the credits. Seriously, go nuts. See the LICENSE file or https://opensource.org/licenses/MIT for specific terms.