Giter VIP home page Giter VIP logo

raspi-pico-aprs-tnc's Introduction

GitHub last commit

raspi-pico-aprs-tnc

A TX-only TNC (Terminal Node Controller) to generate the AFSK (Audio Frequency-Shift Keying) audio tones for APRS (Automatic Packet Reporting System) messages using a RP2040 microcontroller on a Raspberry Pi Pico board.

Signal Flow

Block diagram showing the signal flow

An analog line-out audio signal will be generated by a band-pass filter connected to GPIO-pin 'GP0' which provides the binary PWM signal. You can probe it by a scope, listen to it by using an audio amp, or connect it to any RF transceiver to send it on the air (ham radio license required).

AFSK scope screenshot

Image: Line-out signal (see below) probed by a DSO. We clearly see the 1200 Hz and 2200 Hz tones of the 1200 Bd 2-AFSK.

Both a static library libaprs_pico.a and a demo application will be generated by the build.

Prerequisites

Your host platform for cross-compilation is assumed to be LINUX.

  1. Install the Pico-SDK following the instructions given in the Raspberry Pi 'Getting Started' Guide (pdf)
  2. Set the PICO_SDK_PATH environment variable to point to your Pico-SDK installation directory
  3. Install the pico-extras libraries:
  cd $PICO_SDK_PATH/..
  git clone -b master https://github.com/raspberrypi/pico-extras.git
  cd pico-extras
  git submodule update --init

Hardware

We just need a simple band-pass filter to extract the analog AFSK-signal from the binary PWM signal:

band-pass filter

The line-out voltage can be as high as 2.7 Vpp (~1 Vrms) (at full-scale volume setting in the software and high-impedance load).

Build the library and the 'beacon' demo application

NOTE: In case you want to allow the Pico to control the PTT (Push-To-Talk) input of your transmitter, set the appropriate #define parameters in src/aprs_pico_beacon_demo.c.

git clone https://github.com/eleccoder/raspi-pico-aprs-tnc.git
cd raspi-pico-aprs-tnc
cmake -S . -B build
cmake --build build

build/lib/libaprs_pico.a and build/aprs_pico_beacon_demo[.uf2|.elf|.bin|.hex] will be generated, as well as the testing application build/aprs_pico_tone_test[.uf2|.elf|.bin|.hex].

Run the 'beacon' demo application

The analog AFSK audio signal will be available at the filter's line-out. You can probe it by a scope, listen to it by using an audio amp, or connect it to any RF transceiver to send it on the air (ham radio license required).

But for testing the signal integrity, you can feed the signal into the soundcard of your computer and let decode its data content by Dire Wolf - see down below.

Flash the Pico

cd build

Flash aprs_pico_beacon_demo[.uf2|.elf|.bin|.hex] to the Pico board as you're usually doing.

Test the 'beacon' demo application using Dire Wolf (on LINUX)

We can use the famous Dire Wolf CLI software to decode the APRS data after sampling our APRS audio signal by means of a soundcard.

  1. Connect the line-out of our circuit above to the microphone input of your soundcard of your (ALSA-supported) LINUX system.
  2. Check if you can hear the typical APRS 'modem-sound' on your audio output device by monitoring the input signal (44.1 kHz, mono, WAVE):
arecord -f cd -c 1 - | aplay
  1. Install Dire Wolf on your system. Probably, you just have to run:
sudo apt install direwolf
  1. Let's sample the APRS audio signal fed to the soundcard and forward the audio stream to Dire Wolf (44.1 kHz, mono, WAVE):
arecord -f cd -c 1 - | direwolf -
  1. Enjoy the decoded APRS message:

Decoded APRS message by Dire Wolf

Audio file of the 'beacon' demo

Here is a recorded audio wav-file (44.1 kHz, mono, WAVE) captured by the soundcard using:

arecord -f cd -c 1 > aprs_pico_beacon_demo.wav

You can replay and decode this file by:

cat aprs_pico_beacon_demo.wav | direwolf -

Going on the air: RF-transmission with the Baofeng UV-5 HT

If you actually want to RF-transmit the APRS signal, you can simply do it by one of the many cheap HTs, like the Baofeng UV-5. The complete schematic including PTT control looks like this:

APRS-Pico with Baofeng_UV-5

Don't forget to set the appropriate #define parameters in src/aprs_pico_beacon_demo.c to configure PTT control.

TODO

  • Send the APRS message on the console (USB or UART) rather than hard-coding

Ingredients / Acknowledgements

  • For APRS Payload => AX.25 => AFSK (PCM) conversion I'm using my modified version of fsphil's ax25beacon project.
  • For PCM => PWM conversion I'm using the pico_audio_pwm library from pico-extras (NOTE: ATTOW, maturity seems to be rather alpha/beta).
  • Basic PWM audio rendering with the Pi Pico has been spotted in the pico-playground.

raspi-pico-aprs-tnc's People

Contributors

eleccoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

raspi-pico-aprs-tnc's Issues

Failed assertion when running demo apps

Are you able to run the demo apps with the current pico-extras revision? I'm running into this failed assertion exception when calling the sendAPRS method.

The assertion in question can be found here.

Here is my call stack when the assertion fails:

__breakpoint@0x10006c28 (c:\Program Files\...\pico-sdk\src\rp2_common\pico_platform\include\pico\platform.h:345)
_exit@0x10006ddc (c:\Program Files\...\pico-sdk\src\rp2_common\pico_runtime\runtime.c:187)
__assert_func@0x10006e88 (c:\Program Files\...\pico-sdk\src\rp2_common\pico_runtime\runtime.c:271)
producer_pool_blocking_give<FmtPWM, FmtS16>@0x100016b2 (c:\Program Files\...\pico-extras\src\common\pico_audio\include\pico\sample_conversion.h:261)
producer_pool_blocking_give_to_pwm_s16@0x10001610 (c:\Program Files\...\pico-extras\src\rp2_common\pico_audio_pwm\sample_encoding.cpp:411)
give_audio_buffer@0x10005fb8 (c:\Program Files\...\pico-extras\src\common\pico_audio\audio.cpp:216)
aprs_pico_renderAudioSamples@0x1000b29c (raspi-pico-aprs-tnc\src\aprs_pico.c:163)
aprs_pico_sendAPRSAudioCallback@0x1000b32e (raspi-pico-aprs-tnc\src\aprs_pico.c:183)
ax25_frame@0x1000bd34 (Unknown Source:0)
ax25_beacon@0x1000b568 (Unknown Source:0)
aprs_pico_sendAPRS@0x1000b42e (raspi-pico-aprs-tnc\src\aprs_pico.c:256)
main@0x10000356 (raspi-pico-aprs-tnc\src\aprs_pico_beacon_demo.c:64)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.