From b748b0b65795e05dcca2402f1062144fb909e411 Mon Sep 17 00:00:00 2001 From: assada Date: Sat, 22 Jul 2023 03:50:13 +0300 Subject: [PATCH] Init commit --- README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++ aprs.py | 46 ++++++++++++++++++++++++++++++++ aprs.sh | 2 ++ dire_sdr.conf | 11 ++++++++ 4 files changed, 131 insertions(+) create mode 100644 README.md create mode 100644 aprs.py create mode 100644 aprs.sh create mode 100644 dire_sdr.conf diff --git a/README.md b/README.md new file mode 100644 index 0000000..af1cd41 --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +# APRS to IRC Gateway via RTL-SDR + +## Install RTL-SDR + +```bash +sudo apt-get install libasound2-dev libudev-dev libax25 ax25-apps ax25-tools git-core git cmake libusb-1.0-0-dev build-essential +cd ~ +cat <no-rtl.conf +blacklist dvb_usb_rtl28xxu +blacklist rtl2832 +blacklist rtl2830 +EOF +sudo mv no-rtl.conf /etc/modprobe.d/ +git clone git://git.osmocom.org/rtl-sdr.git +cd rtl-sdr/ +mkdir build +cd build +cmake ../ -DINSTALL_UDEV_RULES=ON +make +sudo make install +sudo ldconfig +cd ~ +sudo cp ./rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/ +sudo reboot +``` + +## Install Direwolf + +```bash +git clone https://github.com/wb2osz/direwolf.git +cd direwolf +mkdir build && cd build +cmake .. +make -j4 +sudo make install +make install-conf +``` + +## Radio stack + +### Create config file + +```bash +ACHANNELS 1 +ADEVICE null null +CHANNEL 0 + +MYCALL CALLSIGN-10 +#IGSERVER aunz.aprs2.net +#IGLOGIN 23018 + +MODEM 1200 +AGWPORT 8000 +KISSPORT 8001 + +``` + +### Start radio stack + +```bash +rtl_fm -f 144.80M - | direwolf -c ./dire_sdr.conf -r 24000 -D 1 - +``` + +or `chmod a+x aprs.sh` and `./aprs.sh` + +## Run IRC Gateway + +```shell +pip install kiss3 irc + +KISS_HOST=localhost KISS_PORT=8001 IRC_HOST=irc.example.com IRC_PORT=6697 CHANNEL_NAME="#example" BOT_NICK=aprs python3 aprs.py +``` diff --git a/aprs.py b/aprs.py new file mode 100644 index 0000000..959e067 --- /dev/null +++ b/aprs.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +import asyncio +import logging +import os +import irc.client +import irc.client_aio + +from ax253 import Frame +import kiss + +from functools import partial + +MYCALL = os.environ.get("MYCALL", "N0CALL") +KISS_HOST = os.environ.get("KISS_HOST", "10.10.10.91") +KISS_PORT = os.environ.get("KISS_PORT", "8001") + +server = os.environ.get('IRC_HOST', "irc.dead.guru") +port = int(os.environ.get('IRC_PORT', 6697)) +channel = os.environ.get('CHANNEL_NAME', "#spau") +nickname = os.environ.get('BOT_NICK', "aprsbot") + +logger = logging.getLogger(__name__) +logging.basicConfig(level=logging.DEBUG) + +async def main(): + loop = asyncio.get_event_loop() + + c = await irc.client_aio.AioReactor(loop=loop).server().connect( + server, port, nickname, connect_factory=irc.connection.AioFactory(ssl=True) + ) + + transport, kiss_protocol = await kiss.create_tcp_connection( + host=KISS_HOST, + port=KISS_PORT, + loop=loop, + ) + + c.privmsg(channel, '[APRS] Starting...') + + async for frame in kiss_protocol.read(): + print('Got frame') + c.privmsg(channel, str(frame)) + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/aprs.sh b/aprs.sh new file mode 100644 index 0000000..d74d39b --- /dev/null +++ b/aprs.sh @@ -0,0 +1,2 @@ +#!/bin/bash +rtl_fm -f 144.80M - | direwolf -c ./dire_sdr.conf -r 24000 -D 1 - diff --git a/dire_sdr.conf b/dire_sdr.conf new file mode 100644 index 0000000..af99e21 --- /dev/null +++ b/dire_sdr.conf @@ -0,0 +1,11 @@ +ACHANNELS 1 +ADEVICE null null +CHANNEL 0 + +MYCALL AS5ADA-10 +#IGSERVER aunz.aprs2.net +#IGLOGIN 23018 + +MODEM 1200 +AGWPORT 8000 +KISSPORT 8001